geotheory
geotheory

Reputation: 23630

Jupyter error: "No module named jupyter_core.paths"

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?

Upvotes: 24

Views: 58206

Answers (12)

Spencer Goff
Spencer Goff

Reputation: 1192

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

Upvotes: 15

james
james

Reputation: 890

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

Upvotes: 2

Innuendo
Innuendo

Reputation: 671

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

Upvotes: 1

rob
rob

Reputation: 329

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

Upvotes: 2

Omar Hatem
Omar Hatem

Reputation: 24

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

Upvotes: 1

adhg
adhg

Reputation: 10853

(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.

Upvotes: 1

Colonel_Old
Colonel_Old

Reputation: 932

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 .

Upvotes: 2

ysalmon
ysalmon

Reputation: 142

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

Upvotes: 1

Amin.A
Amin.A

Reputation: 361

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.

Upvotes: 0

Naga Budigam
Naga Budigam

Reputation: 759

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

Upvotes: 10

David C.
David C.

Reputation: 1994

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.

Upvotes: 3

American curl
American curl

Reputation: 1339

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.

Upvotes: 1

Related Questions