20

I have python versions 3.6.5_1 and 3.7.0installed via Homebrew.
jupyter needs python3.6 for launching. It wouldn't start if I switch to python3.7.

After launching, it fails to start the kernel with this error:

File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 1344, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/opt/python/bin/python3.7': '/usr/local/opt/python/bin/python3.7' 

From what I understand, the kernel is looking for python3.7. My kernel list has just python3

$jupyter kernelspec list Available kernels: python3 /usr/local/etc/jupyter/kernels/python3 

I looked at this link on github, but it wasn't helpful. How do I make jupyter and the kernel running on the same python version?

6
  • to install a kernel on jupyter python3.7 -m ipykernel install. Are you sure that all your python3 are install with homebrew ? Commented Aug 20, 2018 at 16:08
  • @Erwan, yes all my python3 is installed via Homebrew Commented Aug 20, 2018 at 16:10
  • 1
    Check is jupyter installed for python 3.7 via help("modules") in python 3.7 console Commented Aug 20, 2018 at 16:24
  • @Alex, I do not see jupyter in the list of modules. Commented Aug 20, 2018 at 17:48
  • 1
    @nac001 Use pip3 install jupyter to install it. (You need to use pip of python 3.7) Commented Aug 20, 2018 at 18:29

6 Answers 6

27

Check the kernel specifications:

$jupyter kernelspec list 

This will show you the available kernels. In this case:

python3 /usr/local/etc/jupyter/kernels/python3 

Open the kernel.json file in this directory and specify the path of python you want the kernel to use in the argv key.

Sign up to request clarification or add additional context in comments.

4 Comments

I am facing the same error , I have run the following command you mentioned in the question and that return me python3 C:\Users\AHMED\anaconda3\envs\iris_1\share\jupyter\kernels\python3 . Now next i am not understand how can i specify the path of python..
@AhmedYasin, there's a kernel.json file in the path you mentioned. You have to change the kernel path there.
Thanks for this. My kernel.json had a path to the python executable in an env, and not the system wide one. This solved it.
I ran "which python3" and updated argv with the same path and that fixed my issue. Thank you !
12

Updating the jupyter notebook resolved the issue for me. But remember, update it using command line. Not Anaconda Navigator

pip install -U jupyter 

Comments

2

In case anyone anyone reading this who runs Jupyter Notebook from within Anaconda and gets the same error:

I found a workaround by installing Jupyter using pip in the command prompt (not anaconda prompt):

$pip install jupyter 

and then start Jupyter using the known way

$cd 'DirectoryofyourNotebook' $jupyter notebook 

Comments

1

step 2 command:

conda activate <location of your env folder> 

step 3 command:

python -m ipykernel install --user 

works!

2 Comments

Please provide a full process as it doesn't include step 1. An explanation as to how this works will further help the OP as well.
I am sorry for the inconvenience.. step 1 would be starting the terminal... Actually I found this solution from "discourse.jupyter.org/t/…" by Claudio_pena and thought it would be helpful for others..Thanks
0

I had same issue - tried all the above without success.

Context: using Windows on that machine, for a few years. I have used this machine as a "code on the go when I need to" laptop and have not been very careful nor consistent when installing/upgrading python versions or libraries or environments.

The fix for me - somehow a folder that contained f2py.exe (Numpy - on top of which Pandas is built) was not in the path and was in a hidden folder that ended with "\Scripts". Python itself was fine in the environment variables. They were in very different folders - while normally they should be in close branches in the folder tree. Adding the full path of the folder ending with "\Scripts" that have f2py.exe in the environment variables solved the kernel issue for me.

1 Comment

I assume readers are comfortable with path and env variables. If not check the official doc or the link here stackoverflow.com/questions/3701646/…
0
netsh winsock reset 

In cmd with administrator, Please implement above order

2 Comments

netsh winsock reset
Why does this help: :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.