I am trying to use condas to install an environment that uses python 2.7 and numpy version 1.10
I try to create such an environment
conda create -n test2 python=2.7 numpy=1.10
It contends it is going to install the software I specified
The following NEW packages will be INSTALLED:
mkl: 11.3.3-0 numpy: 1.10.4-py27_2 openssl: 1.0.2l-0 pip: 9.0.1-py27_1 python: 2.7.13-0 readline: 6.2-2 setuptools: 27.2.0-py27_0 sqlite: 3.13.0-0 tk: 8.5.18-0 wheel: 0.29.0-py27_0 zlib: 1.2.8-3
and then activate it and run python
source activate test2
python
it informs me I am using python version 2.7.13 and then I try check the numpy version number
import numpy
numpy.version.version
It tells me I have version
'1.13.0'
which is not the version I specified. On the other hand, If I skip specifying the python version, it installs python 3, but the correct version of numpy (1.10.4)
Any ideas about what is going on here? Furthermore, how do I fix this? Thanks!
Edit: as per Uvar's comment
conda create -n test4 python=2.7 numpy=1.10 --no-deps
Tells me
The following NEW packages will be INSTALLED:
numpy: 1.10.4-py27_2 python: 2.7.13-0
but then if I source activate test4 and check the numpy version number, it tells me I am running 1.13.0 again.
Edit 2 (Again in response to a query by Uvar):
conda list -n test2
returns
# packages in environment at /home/ohnoplus/anaconda3/envs/test2:
#
mkl 11.3.3 0 numpy 1.10.4 py27_2 openssl 1.0.2l 0 pip 9.0.1 py27_1 python 2.7.13 0 readline 6.2 2 setuptools 27.2.0 py27_0 sqlite 3.13.0 0 tk 8.5.18 0 wheel 0.29.0 py27_0 zlib 1.2.8 3
Edit 3:
If I source activate test2 and then inside of python import numpy and numpy.__file__ I get the following
'/home/ohnoplus/.local/lib/python2.7/site-packages/numpy/__init__.pyc'
meanwhile if outside of python, but inside of test2, I echo $PATH
I get
/home/ohnoplus/anaconda3/envs/test2/bin:/home/ohnoplus/anaconda3/bin:/home/ohnoplus/bin:/home/ohnoplus/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
Edit 4: @Uvar and @MSeifert point out that I should get my path variables pointing in the right place. I'll experiment with getting this right but I have a couple of questions:
I notice that the python sys.path in test2 appears to be looking in the right place for numpy if I look at sys.paths
import sys
print (sys.path)
['', '/home/ohnoplus/anaconda3/envs/test2/lib/python27.zip', '/home/ohnoplus/anaconda3/envs/test2/lib/python2.7', '/home/ohnoplus/anaconda3/envs/test2/lib/python2.7/plat-linux2', '/home/ohnoplus/anaconda3/envs/test2/lib/python2.7/lib-tk', '/home/ohnoplus/anaconda3/envs/test2/lib/python2.7/lib-old', '/home/ohnoplus/anaconda3/envs/test2/lib/python2.7/lib-dynload', '/home/ohnoplus/.local/lib/python2.7/site-packages', '/home/ohnoplus/anaconda3/envs/test2/lib/python2.7/site-packages', '/home/ohnoplus/anaconda3/envs/test2/lib/python2.7/site-packages/setuptools-27.2.0-py2.7.egg']
Should I be updating $PATH in as referenced in the command line, this sys.path variable, or something else?
source activateorsource activate test2? If you are running the former, you're switching to therootenv and not the one you just created.source activate test2on my system to get the behavior described.numpy.__file__and compare it to the path for yourtest?environment.condaenvironment (except the root one) has anenvsfolder somewhere in the filepath. From what I see you don't use the Python/NumPy from your conda installation. The good news is: The solution is simple. The bad news is: You have to restructure your PATH. :)pythonandpython2.. it IS working in a python 3 install, since thenpythonin your activated environment silently points topython3.. Srry to be of little help :(