【问题标题】:Jupyter lab doesn't work in Colab after successful SSH access and python3 upgrade成功 SSH 访问和 python3 升级后,Jupyter 实验室在 Colab 中不起作用
【发布时间】:2020-10-24 14:15:54
【问题描述】:

成功 SSH 访问后,我尝试在 Colab 上启动 Jupyter 实验室。我收到以下错误消息并想知道任何解决方案。

[C 20:26:25.325 LabApp] The 'contents_manager_class' trait of <jupyterlab.labapp.LabApp object at 0x7f5cc9c73fd0> instance must be a type, but 'google.colab._contents_manager.ColabFileContentsManager' could not be imported

我的/root/.jupyter文件夹下的/jupyter_notebook_config.py配置文件编辑如下:

c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
c.NotebookApp.token = ''
c.NotebookApp.contents_manager_class = "jupytext.TextFileContentsManager"

最后一行只是为了使用Jupyter扩展jupytext

我今天将 Colab 默认 Python 3.6 升级到 Python 3.7 后,不知道为什么会收到此错误消息。相同的 Jupyter 设置工作流程始终适用于我,但今天。

这是我将本地计算机连接到 Colab 后在命令行中键入的命令列表。

# upgrade to python 3.7
sudo apt-get install python3.7
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2
sudo update-alternatives --config python3 
# Then I chose the option for "/usr/bin/python3.7 2 manual mode"

# To fix missing pip when issue pip3 command
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py --force-reinstall
sudo pip3 install --upgrade pip

# To install packages including jupyterlab
sudo pip3 install scipy==1.4.1 
sudo pip3 install numpy matplotlib pandas seaborn scikit-learn tensorflow keras jupyterlab

谢谢!

【问题讨论】:

    标签: python-3.x jupyter-notebook jupyter google-colaboratory


    【解决方案1】:

    我在 Colab 上安装了 Python 3.7,但忘记安装包 google-colab。这是解决此问题的快速答案。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-19
      • 2012-05-26
      • 1970-01-01
      • 1970-01-01
      • 2018-06-23
      • 1970-01-01
      相关资源
      最近更新 更多