Carlos Mougan
Carlos Mougan

Reputation: 811

when calling jupyter notebook from command line open it in conda

I installed conda and when I open the jupyter notebook it opens here:

 >>> import sys
 >>> print(sys.executable)
 >>> print(sys.version)
 >>> print(sys.version_info)
/Users/cmougan/opt/anaconda3/bin/python
3.7.4 (default, Aug 13 2019, 15:17:50) 
[Clang 4.0.1 (tags/RELEASE_401/final)]
sys.version_info(major=3, minor=7, micro=4, releaselevel='final', serial=0)

But when I open the jupyter notebook from the command line it appears here:

 >>> import sys
 >>> print(sys.executable)
 >>> print(sys.version)
 >>> print(sys.version_info)
/usr/local/opt/python/bin/python3.7
3.7.5 (default, Nov  1 2019, 02:16:23) 
[Clang 11.0.0 (clang-1100.0.33.8)]
sys.version_info(major=3, minor=7, micro=5, releaselevel='final', serial=0)

Seems like I have the same error when pip install packages.

My question is:

How can I open (and use pip install) the conda jupyter notebook from terminal?

Upvotes: 0

Views: 767

Answers (2)

maitreyak
maitreyak

Reputation: 269

You have multiple installations of python3

/Users/cmougan/opt/anaconda3/bin/python and /usr/local/opt/python/bin/python3.7

As a quick fix, use the alias command before you invoke jupyter from the terminal.

alias python=/Users/cmougan/opt/anaconda3/bin/python

Upvotes: 1

velociraptor11
velociraptor11

Reputation: 604

Before you open jupyter notebook from the command line , make sure to have run source activate to switch to the proper environment beforehand.

Assuming you have an anaconda environment called "py36":

source activate py36
jupyter notebook

If you have not setup an anaconda environment, then please consider doing so. Here is a helpful link: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html

Upvotes: 1

Related Questions