notebook: ImportError: No module named paths while running the jupyter notebook

I upgraded jupyter via pip install --upgrade jupyter, but I when I try to launch a new notebook using jupyter notebook, I am getting an error: ImportError: No module named paths.

Here’s the full traceback:

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

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 2
  • Comments: 38 (9 by maintainers)

Most upvoted comments

Yup, it’s exactly as I suspected - /usr/lib/python2.7/dist-packages should not be in /usr/local/lib/python2.7/dist-packages/*.pth. If you remove that, In fact, probably none of the

I see lots of eggs in there, which suggest that you have used easy_install. If you have time, I would recommend removing anything you’ve installed with easy_install, removing all your .pth files, and installing again with only pip. easy_install is a bit of a nightmare, and all the lines of code that start with import in there are a source of frequent and major problems.

@minrk Problem solved by ‘apt-get remove ipython’.

Cheers!

what is to be inferred from this…??

This means that the IPython being imported is the very-old one installed by apt-get. If you have done pip install --upgrade ipython, that should install a newer IPython in /usr/local/lib/python2.7/dist-packages. /usr/lib/python2.7/dist-packages being on the front of sys.path means that there is an easy-install.pth file with this path, which should be removed. It is caused by a bug in setuptools. The most likely location for this file is:

/usr/local/lib/python2.7/dist-packages/easy-install.pth

You can check for this setuptools bug with:

grep dist-packages /usr/local/lib/python2.7/dist-packages/*.pth

If the file is where I expect it is, the fix should be to remove the file:

/usr/local/lib/python2.7/dist-packages/easy-install.pth

While you are at it, make sure your pip/setuptools are up to date:

pip install --upgrade setuptools pip

@whophil the issue is the same. There is probably a file called easy-install.pth on your system, which inappropriate information in it. You can fix this by removing the offending line from easy-install.pth. It may not be /usr/lib/, it may be /usr/local/lib. There should be no directories called dist-packages or site-packages listed in any .pth file. If there is, it was caused by a bug in setuptools, and should be removed.

I’ve just solved this problem, i updated my ipython with pip3 install -U ipython, but i think this problem was solved because pip3 installed path.py as additional dependency while updating.

I was facing the same issue. It got resolved by doing the following: pip3 install --upgrade pip pip3 install jupyter

Have you tried apt-get remove ipython - or the equivalent for your platform?

That error message means that it is finding an older version of IPython for whatever reason. So try removing every copy of IPython you can track down, and then installing it again.

pip install path.py fixed this issue for me. Found the solution in this issue

What do you get from pip list and python -m IPython --version?

Yeah. Just moving easy-install.pth out of /usr/local/lib/python2.7/dist-packages/ helped.

Hello,

I am also using the Canopy distribution and have the same issue with jupyter notebook: Traceback (most recent call last): File “/Users/renaudperson/Library/Enthought/Canopy_64bit/User/bin/jupyter-notebook”, line 8, in <module> from notebook.notebookapp import main File “/Users/renaudperson/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/notebook/notebookapp.py”, line 83, in <module> from IPython.paths import get_ipython_dir ImportError: No module named paths

with ipython (4.0.0) python -m IPython --version 1.2.1

there is no *.pth in the directory /Users/renaudperson/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/

and there is no dist or site-packages directory in /usr/local/lib/

regards