Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip3 install of Jupyter and Notebook problem when running

I have tried all of the things here on stack and on other sites with no joy...

I'd appreciate any suggestions please.

I have installed Jupyter and Notebook using pip3 - please note that I have updated pip3 before doing so.

However when trying to check the version of both jupyter --version and notebook --version my terminal is returning no command found. I have also tried to run jupyter, notebook and jupyter notebook and I am still getting the same message.

I have spent nearly two days now trying to sort this out... I'm on the verge of giving up.

I have a feeling it has something to do with my PATH variable maybe not pointing to where the jupyter executable is stored but I don't know how to find out where notebook and jupyter are stored on my system.

many thanks in advance

Bobby

like image 270
Bobby Iveson Avatar asked Dec 11 '22 00:12

Bobby Iveson


2 Answers

You should be able to run jupyter with python -m even if the PATH variable is not set up correctly.

python -m jupyter notebook

you can check the PATH variables on Windows if you search in with the windows search function for env and then click on Edit the system environment variables > Environment Variables.... The path variable is a list of paths that the terminal checks for commands.

I didn`t work on Mac for a long time, so not sure how similar linux and mac command line still are, but on debian you control your path variable like this. View paths:

echo $PATH
/usr/local/bin:/usr/bin:/bin

Add a path:

export PATH=$PATH:/mynewpath

For constant export add to ~/.bashrc

To view the path of the pip package, you can use

pip3 show jupyter

When jupyter-notebook works and jupyter notebook does not. It looks to me like a symlink thing. Or a Mac-specific problem.

like image 162
HackLab Avatar answered Dec 31 '22 14:12

HackLab


So to summarise this is what I have found on this issue (in my experience):

to run the jupyter app you can use the jupyter-notebook command and this works, but why? This is because, the jupyter-notebook is stored in usr/local/bin which is normally always stored in the PATH variable.

I then discovered that the jupyter notebook or jupyter --version command will now work if I did the following:

  1. open my ./bash_profile file
  2. add the following to the bottom of the file: export PATH=$PATH:/Users/your-home-directory/Library/Python/3.7/bin

this should add the location of where jupyter is located to your path variable.

Alternatively, as suggested by @HackLab we can also do the following:

  • python3 -m jupyter notebook

Hopefully, this will give anyone else having the same issues I had an easier time resolving this issue.

like image 42
Bobby Iveson Avatar answered Dec 31 '22 13:12

Bobby Iveson