help icon indicating copy to clipboard operation
help copied to clipboard

Cannot Launch Jupyter Notebook from Terminal (Mac OS X)

Open nickforino opened this issue 8 years ago • 9 comments

Hello,

I installed Jupyter and Jupyter Notebook with Anaconda.

Typing jupyter notebook into terminal returns jupyter: Command not found.

Typing echo $PATH returns /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin, /Users/Nick/PROGRAMS/CMfinder_0.2/bin

(note, CMfinder is a program I used for a research project a while ago)

I've done some digging around the internet for solutions, and many people have suggested modifying my PATH. In my ignorance I followed some advice I shouldn't have, and unfortunately deleted the contents of my bash_profile. folder (which, as I understand, is where I can set the PATH variable).

I'm very new to coding, so I'd greatly appreciate a layman's explanation of what I can do to enable launching jupyter notebook from my terminal.

Thanks in advance for the help!

nickforino avatar Feb 08 '17 17:02 nickforino

You do need to modify your PATH, as Anaconda isn't there. It's a list separated by colons, and to find jupyter, you'll need one of the entries to be something like /Users/Nick/anaconda/bin (you'll have to adjust that to where your Anaconda installation is).

.bash_profile is just a single text file that lives in your home directory (/Users/Nick). To add a directory at the start of PATH, you'd usually put a line there like this:

export PATH="$HOME/anaconda/bin:$PATH"

takluyver avatar Feb 08 '17 17:02 takluyver

@takluyver Thank you for your response.

I've tried adding the line export PATH="$HOME/anaconda/bin:$PATH" to my .bash_profile file and upon typing echo $PATH I get the same result as before, and I still cannot launch jupyter notebook from the terminal.

I looked around in my entries and indeed the path /Users/Nick/anaconda/bin exists as well. What else do you suggest I could try?

EDIT: I've fixed my issue using a guide found here: http://architectryan.com/2012/10/02/add-to-the-path-on-mac-os-x-mountain-lion/#.WJtwQxIrKHp

I'm still a little shaky on how this worked while the other suggestion didn't.

nickforino avatar Feb 08 '17 18:02 nickforino

I can see a couple of possibilities why the other method didn't work. First, had you opened a new terminal before running echo $PATH? Those files are only read when you start a new terminal.

If you did, then it might be that you needed to modify .bashrc instead. I always get confused about which one bash reads when.

takluyver avatar Feb 08 '17 20:02 takluyver

This doesn't work. Why are all the suggestions to add anaconda and python to the PATH? I thought we are adding jupyter. Does jupyter install to the Python folder?

ghost avatar Jun 09 '17 23:06 ghost

Does jupyter install to the Python folder?

Basically, yes. The location it installs to depends on the tool and the options you used to install it, but both pip and anaconda put the jupyter launch script into a general purpose directory which they call something like bin or Scripts, depending on the platform.

takluyver avatar Jun 12 '17 11:06 takluyver

Hi,

I installed jupyter with pip, but when I'm trying to launch a notebook from the terminal, it gives me the error message "jupyter:command not found"

I'd be grateful for any kind of help, Theresa

Theresa24 avatar Oct 16 '17 07:10 Theresa24

If you had installed it with Homebrew, add this to your ~/.bash_profile: export PATH="/usr/local/anaconda3/bin:$PATH" Then source ~/.bash_profile

zubaer-ahammed avatar Oct 21 '17 14:10 zubaer-ahammed

Another easy way to fix is to open the bash profile by typing $open ~/.bash_profile into terminal. Then edit the profile with alias jupyter='/Library/Frameworks/Python.framework/Versions/3.6/bin/jupyter-notebook ' or wherever jupyter-notebook has been installed. Save the profile and open a new terminal window now if you type $jupyter in the new terminal window it will launch the executable from where it is stored.

robinkeegan avatar Dec 10 '17 06:12 robinkeegan

I'd the same issue too, here's how I fixed it.

To add the PATH manually, create and open the file .bashrc or .bash_profile from your home directory (use any text editor). Add the line export PATH="/<path to anaconda>/bin:$PATH".

NOTE: Replace with the actual path of your installed anaconda file.

Steps:

  1. `nano .bash_profile'
  2. Added export PATH="/Users/sahil/anaconda3/bin:$PATH" to it.
  3. Saved the file ctrl + x and then y.

Save the file. If you have any terminal windows open, close them all then open a new one. You may need to restart your computer for the PATH change to take effect.

That's all. Hope this helps :)

sahil-tah avatar Mar 14 '19 13:03 sahil-tah