Notebook: Cannot open Jupyter notebook

Created on 23 Mar 2018  ·  11Comments  ·  Source: jupyter/notebook

$ jupyter notebook
Traceback (most recent call last):
  File "/usr/local/bin/jupyter", line 7, in <module>
    from jupyter_core.command import main
ModuleNotFoundError: No module named 'jupyter_core'

I have tried commands like these:

pip3 install --upgrade notebook
pip3 install lesscpy
pip3 uninstall notebook
pip install --upgrade pip
pip install lesscpy
pip install jupyter
pip3 install jupyter
sudo pip install --upgrade jupyter

At the end, still give me error. Any suggestions?

Thank you!!!!

Most helpful comment

Deactivate and activate virtualenv environment to fix the issue.

All 11 comments

It sounds like you're trying an import in two different installations of Python, or two different environments. Check sys.executable to see which Python and environment you're running in, and sys.path to see where it looks to import modules.

Python packages must be installed separately for each copy of Python you use, and if you are using virtualenvs or conda envs, packages must be installed into each environment where you need them. Either the package is not installed in one, or a different version of the package is installed.

To install packages to a particular Python installation or environment using pip, you can run it like this:

path/to/python -m pip install ...
# Replace path/to/python with the path of the Python executable (sys.executable)

If you are using conda environments, you can install packages from conda like this:

source activate myenv  # On Windows, just 'activate myenv' (no 'source')
conda install ...

For more detail, see this blog post.

[ This is a saved reply because I answer similar questions often - sorry if it doesn't exactly fit your case ]

Thank you!

I have fixed my problem...without even doing anything. XD

Great, closing this then.

Deactivate and activate virtualenv environment to fix the issue.

This partly solved the issue. However, now whenever I connect to the server, I have to deactivate and activate the base conda environment in oder to get it to work. How can I permanently solve the issue?

I already tried uninstalling and reinstalling Anaconda but still no change. Any suggestions?

I had the same issue, fixed by simply using pip install jupyter in ubuntu

Usually, systems can have problems with packages from multiple sources like pip and from apt. Use any one for Python packages and stick to it for conflict avoidance.

Deactivate and activate virtualenv environment to fix the issue.

this works for me!THX!

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

sudo deluser my_user sudo

Can confirm

pip3 install --upgrade notebook
pip3 install lesscpy
pip3 uninstall notebook
pip install --upgrade pip
pip install lesscpy
pip install jupyter
pip3 install jupyter
sudo pip install --upgrade jupyter

worked.

this solution worked for me
Deactivate and activate virtualenv environment to fix the issue.

Was this page helpful?
0 / 5 - 0 ratings