Jetson nano安装JupyterLab

1 先安装JupyterLab依赖

1.1 安装JupyterLab依赖及JupyterLab

1、安装依赖nodejs、npm

sudo apt install nodejs npm

2、安装libffi-dev

sudo apt install libffi-dev

3、pip3安装jupyter lab

pip3 install jupyter jupyterlab

Jupyter lab已经安装好了,在命令行输入jupyter lab,即可启动,在浏览器输入localhost:8888就可以访问Jupyter lab了,但只能在本机访问,局域网其他主机还不能访问

1.2 安装jupyterlab中可能报错:c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory

1、安装编译的过程中报错:c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory

c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
     #include <ffi.h>
              ^~~~~~~
    compilation terminated.
    error: command 'aarch64-linux-gnu-gcc' failed with exit status 1

2、解决方式(参考

sudo apt install libffi-dev

2 配置JupyterLab的登录ip、端口、密码等

通过配置JupyterLab的登录ip、端口、密码等,我们就可以在同一个局域网下访问JupyterLab了

1、首先关闭Jupyter lab进程,在当前终端中Ctrl+C,然后生成JupyterLab配置文件

jupyter lab --generate-config

会看到如下输出信息,会提示配置文件保存路径,x-robot是用户名:

Writing default config to: /home/x-robot/.jupyter/jupyter_notebook_config.py

2、修改位置文件jupyter_notebook_config.py

vim ~/.jupyter/jupyter_notebook_config.py

在里面找到并修改为下面的样子(嫌麻烦懒得找,在开头复制粘贴也行(参考)):

c.ServerApp.allow_remote_access = True
c.ExtensionApp.open_browser = False
c.ServerApp.ip = '0.0.0.0'
c.ServerApp.password_required = False
c.ServerApp.port = 8888
c.ServerApp.token = ''

3、启动JupyterLab

jupyter labjupyter-lab

此时,只要在通过一个局域网,其他主机也是可以在浏览器中打开JupyterLab服务的!

查看token

jupyter server list #能查看token

3 设置JupyterLab开机自启

1、最后一步添加自启动,没有自启动每次开机后都得手动开启,先确定安装位置(参考):

$ which jupyter
/home/x-robot/.local/bin/jupyter

2、创建 jupyter.service 文件

$ sudo vi /etc/systemd/system/jupyter.service

填入如下文件内容,注意修改UserExesStart 路径,并保存。

[Unit]
Description=Jupyter Lab

[Service]
Type=simple
User=x-robot
ExecStart=/home/x-robot/.local/bin/jupyter-lab

[Install]
WantedBy=default.target

3、启动服务

$ sudo systemctl enable jupyter
$ sudo systemctl start jupyter

4、检查服务是否正常

$ sudo systemctl status jupyter

4 安装JupyterLab中常见问题

4.1 安装JupyterLab插件的时候,提示nodejs版本太低

1、安装插件管理器的时候,提示nodejs版本太低:

shl@shl-desktop:~$ jupyter labextension install @jupyter-widgets/jupyterlab-manager
An error occured.
ValueError: Please install nodejs >=12.0.0 before continuing. nodejs may be installed using conda or directly from the nodejs website.
See the log file for details:  /tmp/jupyterlab-debug-dkd8gmqm.log
shl@shl-desktop:~$ 

2、升级nodejs版本(关于nodejs升级参考

$ sudo npm cache clean -f   # 清除npm缓存
$ sudo npm install -g n     # 安装nodejs的版本管理器n
$ sudo n stable             # 升级到最新稳定版

在这里插入图片描述

注意:

升级好之后,重新打开一个终端,然后再安装插件!!!

4.2 JupyterLab按Tab不能够代码补全

1、Jupyter按tab键无法补全,而且报错TypeError: __init__() got an unexpected keyword argument 'column'的解决办法

2、这个错误是由于jedi版本导致的,默认安装的是jedi==0.18.0,我们只需要降低其版本即可!(参考1参考2

  • jedi0.18.0降低到0.17.0或(0.17.2)版本之后,然后重新打开

在这里插入图片描述

注意:

最好是卸载jedi(pip3 uninstall jedi),然后再安装指定的版本pip3 install jedi==0.17.2,我尝试如果不卸载直接安装0.17.2版本,结果安装好之后还是0.18.0版本,迷惑行为!!!

4.3 关于JupyterLab设置密码

如下改为:c.ServerApp.allow_origin = '*'

#170 c.ServerApp.allow_origin = ''

如下改为:c.ServerApp.ip = '0.0.0.0'

#316 #c.ServerApp.ip = 'localhost'

设置密码(我的密码设置为123456,方便记忆):

zhihui@zhihui-desktop:~$ jupyter notebook password
Enter password: 
Verify password: 
[NotebookPasswordApp] Wrote hashed password to /home/zhihui/.jupyter/jupyter_notebook_config.json
zhihui@zhihui-desktop:~$ 

输入设置的密码,并没有进入:

在这里插入图片描述

如下改为:c.ServerApp.password = '123456'

386 #c.ServerApp.password = ''

但是输入密码之后还是进不去

在这里插入图片描述

注意:

设置密码命令为:jupyter lab password,因为我们用到是jupyter lab而不是jupyter notebook

直接把配置添加到开头,省去了查找的麻烦(参考):

c.ServerApp.allow_remote_access = True
c.ExtensionApp.open_browser = False
c.ServerApp.ip = '0.0.0.0'
c.ServerApp.password_required = False
c.ServerApp.port = 8888
c.ServerApp.token = ''

5 安装JupyterLab插件

1、安装中文插件(参考):

pip3 install jupyterlab-language-pack-zh-CN

参考:https://makeronsite.com/jetson-nano-install-jupyter-lab.html
参考:http://zh-wave.com/2020/07/01/jetson-nano-development-environment-build.html # 安装报错ffi.h
参考:https://zhuanlan.zhihu.com/p/342803670
参考:http://blog.openpilot.cc/archives/2293

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值