Jupyter error: "No module named jupyter_core.paths"

Question:

Trying to open Jupyter Notebook (OSX 10.11.4) I get the following error:

$ jupyter-notebook
Traceback (most recent call last):
  File "/usr/local/bin/jupyter-notebook", line 7, in <module>
    from notebook.notebookapp import main
  File "/Users/geotheory/Library/Python/2.7/lib/python/site-packages/notebook/__init__.py", line 25, in <module>
    from .nbextensions import install_nbextension
  File "/Users/geotheory/Library/Python/2.7/lib/python/site-packages/notebook/nbextensions.py", line 23, in <module>
    from jupyter_core.paths import jupyter_data_dir, jupyter_path, SYSTEM_JUPYTER_PATH
ImportError: No module named jupyter_core.paths

This used to work. Any idea how to diagnose?

Asked By: geotheory

||

Answers:

I have encountered similar issue. Basically, I solved it by uninstall python2.7 and re-install newer python & IPython versions.

Details on how to effectively uninstall python2.7 via Mac OS command line is here: How to uninstall Python 2.7 on a Mac OS X 10.6.4?

Re-install desired version of IPython via command line. In my case, I also needed to re-install Jupyter via:

$ pip install jupyter

Good luck.

Answered By: David C.

I met with the similar problem this morning. As I changed the $PYTHONPATH directory in bash_profile. Then I solved by re-specify the python path back to /usr/lib/python2.*. I hope it will help.

Answered By: American curl

I had the same issue, fixed by simply using pip install jupyter in the macOS terminal.

Answered By: Spencer Goff

In my case this was because pip, run with sudo, did not set read and execute rights on the files and directories it created under /usr/local/lib/python2.7/dist-packages.

So I used find and chmod to set them, as described there :

cd /usr/local/lib/python2.7/dist-packages
sudo find ./ -type d -exec chmod a+rx {} ;
sudo find ./ -type f -exec chmod a+r {} ;

In fact, this behaviour of sudo probably arises from the fact that my standard user umask is 0007 (creating private files by default). This seems to transfer to sudo. To avoid this, one can edit the sudo configuration by running sudo visudo and adding the following lines, as per this answer :

Defaults umask_override
Defaults umask=0022
Answered By: ysalmon

(although quite late to the party but) You mentioned that 'it used to work' and from your prompt it looks like you’re not in your ‘virtual environment’. Simply activate your proper virtual environment to have it work like before.

Answered By: adhg

I faced the same issue, and was able resolve with the following steps.

conda create -n py36 python=3.6
conda activate py36
conda install notebook ipykernel jupyterlab

Answered By: Naga Budigam

It happens when you have multiple versions of Python in your system. Try to find the correct version by looking in the ‘pip’ directory:

which pip

For me, it was located in:

~/bulk/Python/python-3.7.4/bin/

There, you should be able to find the jupyter executable:

$ ls jupyter
jupyter

Try to run it directly by:

./jupyter

Hope this helps.

Answered By: Amin.A

Got similar issue & Fixed after removing the user from the sudo group in ubuntu.

sudo deluser my_user sudo

If you are using Anaconda, I recommend installing Jupyter to your conda environment using the following:

conda install -c anaconda jupyter

You can then launch Jupyter from the terminal with the following command:

jupyter notebook .
Answered By: Colonel_Old

just using pip install jupyter while my environment was active worked for me

Answered By: Omar Hatem

I solved this issue in my environment by uninstalling and then reinstalling jupyter notebook. After that, worked like a charm.
While your environment is active, run:

pip uninstall jupyter notebook

pip install jupyter notebook
Answered By: rob

Spoiler: not the cleanest solution but just a workaround.

I had the same issue on Linux (Fedora) caused by the launcher in ~/.local/bin/jupyter due to different versions installed globally and from conda. So I jusst used this workaround (from terminal with conda env) wich worked fine in my case:

python3 -m jupyter notebook
Answered By: Innuendo

https://github.com/dunovank/jupyter-themes/issues/153#issuecomment-1446026919

This post (using conda-forge, as https://jupyter.org/install recommends without showing how)

https://towardsdatascience.com/how-to-set-up-anaconda-and-jupyter-notebook-the-right-way-de3b7623ea4a

Basically it’s:

conda create -n jupyter
conda activate jupyter

conda config --add channels conda-forge
conda config --set channel_priority strict
The following is the key (-c conda-forge)

conda install -c conda-forge notebook
conda install -c conda-forge nb_conda_kernels

conda install -c conda-forge jupyterlab
conda install -c conda-forge nb_conda_kernels
Answered By: james
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.