Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 916
garyrob Avatar asked Mar 07 '23 01:03

garyrob


2 Answers

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.

like image 158
garyrob Avatar answered Mar 14 '23 16:03

garyrob


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

like image 42
Druta Ruslan Avatar answered Mar 14 '23 15:03

Druta Ruslan