Why do the python's versions called from Terminal and from Atom differ (Mac)

When calling python from the terminal, I get version 3.7.1

$ python
Python 3.7.1 | packaged by conda-forge | (default, Nov 13 2018, 09:50:42) 
[Clang 9.0.0 (clang-900.0.37)] :: Anaconda custom (64-bit) on darwin

(I get exactly the same if I type python3instead)

Now when looking at the python version from Atom with

import sys

I get:

3.6.5 | packaged by conda-forge | (default, Apr  6 2018, 13:44:09) 
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)]

how come? how can I make Atom get the same version as the version the Terminal is getting?

I also looked for the “language interpreter” in the “Command Palette” but couldn’t find it. Here are the screen shots:

  • Command Palette:

enter image description here

  • Looking for “language interpreter”

enter image description here

enter image description here

I also changed the atom-runner.coffee script by writing python3 instead of python but it didn’t solve the problem neither:

enter image description here

What am I missing?

Many thanks in advance!

What happens if you use a package to create a terminal inside Atom (such as termination, terminal-tab, or atom-ide-ui) and run echo $PATH? If you’re getting different Python versions, the PATH inside Atom should be different than the one you get when you open your system terminal. If so, then we can use that to figure out why.

You can find the folder for the 3.6.5 install, and that might also be informative. Did it come with your Mac and you installed 3.7.1 instead of updating the old one, but because the Python folder was somewhere different than the installer expects it didn’t notice that there was already a Python 3 setup?

Thanks you for your answer @DamnedScholar. In the meantime, I found the answer to the question and posted it on stackoverflow:

With the hints of the github page of jupyter I had actually to change the Path in the .json file of the jupyter kernel. First I checkt the list of jupyter kernel:

$ jupyter kernelspec list
julia-0.6    /Users/mymac/Library/Jupyter/kernels/julia-0.6
julia-1.0    /Users/mymac/Library/Jupyter/kernels/julia-1.0
python3      /Users/mymac/Library/Jupyter/kernels/python3

I then cd the above python path and, I found the file kernel.json inside and opened it:

 "argv": [
 "display_name": "Python 3",
 "language": "python"

In that file, I then changed the line /path/to/python by the python path I got when typing the following in Terminal:

$ which python

Relaunched Atom and it finally worked!

1 Like