简体   繁体   English

从 Anaconda 启动 Jupyter Notebook 时出现问题

[英]Problem launching Jupyter Notebook from Anaconda

I am having issues launching Jupyter Notebook.我在启动 Jupyter Notebook 时遇到问题。 I have tried to do it two ways and seem to get errors.我尝试过两种方法,但似乎出错了。

1 - Launching from the Anaconda Prompt using the command jupyter notebook or directly choosing from the Anaconda menu 1 - 从 Anaconda 启动提示使用命令jupyter notebook或直接从 Anaconda 菜单中选择

I get the following:我得到以下信息:

(base) C:\Users\metni>jupyter notebook
Traceback (most recent call last):
  File "C:\Users\metni\anaconda3\lib\site-packages\jsonschema\__init__.py", line 31, in <module>
    from importlib import metadata
ImportError: cannot import name 'metadata' from 'importlib' (C:\Users\metni\anaconda3\lib\importlib\__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\metni\anaconda3\lib\site-packages\nbformat\validator.py", line 12, in <module>
    from jsonschema import ValidationError
  File "C:\Users\metni\anaconda3\lib\site-packages\jsonschema\__init__.py", line 33, in <module>
    import importlib_metadata as metadata
ModuleNotFoundError: No module named 'importlib_metadata'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\metni\anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
    from notebook.notebookapp import main
  File "C:\Users\metni\anaconda3\lib\site-packages\notebook\notebookapp.py", line 80, in <module>
    from .services.contents.manager import ContentsManager
  File "C:\Users\metni\anaconda3\lib\site-packages\notebook\services\contents\manager.py", line 17, in <module>
    from nbformat import sign, validate as validate_nb, ValidationError
  File "C:\Users\metni\anaconda3\lib\site-packages\nbformat\__init__.py", line 32, in <module>
    from .validator import validate, ValidationError
  File "C:\Users\metni\anaconda3\lib\site-packages\nbformat\validator.py", line 23, in <module>
    raise ImportError(str(e) + verbose_msg)
ImportError: No module named 'importlib_metadata'

    Jupyter notebook format depends on the jsonschema package:

        https://pypi.python.org/pypi/jsonschema

    Please install it first.

2 - Launching from the command line with the same command 2 - 使用相同的命令从命令行启动

I get the following:我得到以下信息:

C:\Users\metni>jupyter notebook
Traceback (most recent call last):
  File "C:\Users\metni\anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
    from notebook.notebookapp import main
  File "C:\Users\metni\anaconda3\lib\site-packages\notebook\notebookapp.py", line 64, in <module>
    from tornado import httpserver
  File "C:\Users\metni\anaconda3\lib\site-packages\tornado\httpserver.py", line 29, in <module>
    import ssl
  File "C:\Users\metni\anaconda3\lib\ssl.py", line 98, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: DLL load failed: The specified module could not be found.

It seems like this is referring to a package called jsonschema which is not installed apparently, but running a pip install jsonschema does not solve the problem for me...似乎这是指一个名为jsonschema的 package 显然没有安装,但是运行pip install jsonschema并不能解决我的问题......

Based on this answer from a similar question, I managed to solve the problem by running these two commands:基于来自类似问题的这个答案,我设法通过运行以下两个命令来解决问题:

conda update -n root conda

conda update --all

I thus updated all packages, and the notebook is now launching.因此,我更新了所有软件包,笔记本现在正在启动。

In the answer above I also have two two commands but they are a bit different在上面的答案中,我也有两个两个命令,但它们有点不同

source /opt/anaconda/bin/activate root

and then接着

jupyter notebook

It seems like you have to go into your anaconda directory then bin, then you can "activate root"看来您必须将 go 放入您的 anaconda 目录然后 bin,然后您可以“激活 root”

It also looks like you need to install some other dependencies for jupyter to run.看起来您还需要安装一些其他依赖项才能运行 jupyter。 Where is says在哪里说

Jupyter notebook format depends on the jsonschema package:

    https://pypi.python.org/pypi/jsonschema

Please install it first.

So if the above doesn't work try installing the other dependency and try again因此,如果上述方法不起作用,请尝试安装其他依赖项并重试

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM