ImportError: No module named IPython.paths when running jupyter notebook?

亡梦爱人 提交于 2019-12-22 08:42:20

问题


I installed jupyter via: /usr/local/opt/python/bin/python2.7 -m pip install jupyter

this install ipython version 4.1.2. However, when I run jupyter notebook, I get:

Traceback (most recent call last):
  File "/usr/local/bin/jupyter-notebook", line 7, in <module>
    from notebook.notebookapp import main
  File "/Library/Python/2.7/site-packages/notebook/notebookapp.py", line 83, in <module>
    from IPython.paths import get_ipython_dir
ImportError: No module named IPython.paths

yet, when I run from IPython.paths import get_ipython_dir in the ipython shell directly it works fine. Also when I run /usr/local/opt/python/bin/python2.7 and then the same thing, it runs successfully. Additionally, when I check the sys.executable path in python I get /usr/local/opt/python/bin/python2.7

This doesn't make sense to me. How can Ipython and my normal python (both using /usr/local/opt/python/bin/python2.7) both run this successfully, but my jupyter, installed with that specific python, cannot run the command. Any suggestions?


回答1:


I had the same problem. Just now this helped me. Someone might find this useful.

    from IPython.paths import get_ipython_dir
ImportError: No module named IPython.paths

So I was running Python 3 on Linux mint 17. I first uninstalled jupyter from my system using the command.

sudo -H pip3 uninstall jupyter

After successfully uninstalling I installed jupyter again with the following command.

sudo -H pip3 install jupyter

And when I launched jupyter again using

jupyter notebook

The kernel didn't die or didn't restart. Everything works fine now. I hope atleast one person finds this useful.




回答2:


Upgrade ipython:

pip install ipython==5.3.0

If you cannot uninstall ipython, try this:

sudo -H pip install --ignore-installed -U ipython==5.3.0


来源:https://stackoverflow.com/questions/36166556/importerror-no-module-named-ipython-paths-when-running-jupyter-notebook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!