garyrob
garyrob

Reputation: 564

ipython uses wrong python version with anaconda

After activating my anaconda Python 3.6 environment with

source activate py36

if I type

python

I go into python 3.6, as expected. But if I type

ipython

I go into an ipython environment based python 3.5.5, which is the same python version I get using

source activate base

and then

python

How can I get into an ipython environment using my anaconda-supplied python 3.6 interpreter? I have updated my anaconda environment with

conda update anaconda

and

conda update conda

Doing so does not help.

EDIT:

I hadn't realized that I had to install ipython separately for the python 3.6 environment; I'd thought it was a default part of anaconda. So

conda install ipython

after

source activate py36

did the trick. It doesn't seem optimal that after activating a particular environment, ipython may bring up a completely different anaconda-based environment. I'd prefer it to simply cause a "command not found" error. Bringing up the wrong environment without making it very obvious that that is happening could lead to confusion or problems.

Upvotes: 4

Views: 3360

Answers (2)

garyrob
garyrob

Reputation: 564

I hadn't realized that I had to install ipython separately for the python 3.6 environment; I'd thought it was a default part of anaconda. So

conda install ipython

after

source activate py36

did the trick.

Upvotes: 5

Druta Ruslan
Druta Ruslan

Reputation: 7402

Have you done hash -r since entering the conda environment? Bash can cache paths to executables, so sometimes it doesn't use the one reported by which. Running hash -r resets the cache

Maybe you need also to update ipython conda update ipython

Upvotes: 2

Related Questions