I'm using anaconda
(myenv3) foo@foo:~$ which conda
/home/foo/anaconda3/bin/conda
where in "myenv3" I have dill=2.8.2
installed:
(myenv3) foo@foo:~$ conda list -n myenv3 dill
# packages in environment at /home/foo/anaconda3/envs/myenv3:
#
# Name Version Build Channel
dill 0.2.8.2 py36_0 conda-forge
If I run python
, I'll get exactly that environment:
(myenv3) foo@foo:~$ which python
/home/foo/anaconda3/envs/myenv3/bin/python
But if I do, dill
appears to have an older version:
(myenv3) foo@foo:~$ python
Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dill
>>> dill.__version__
'0.2.7.1'
Apparently, the file comes from elsewhere:
>>> dill.__file__
'/home/foo/.local/lib/python3.6/site-packages/dill/__init__.py'
It appears that in my include path, .local
dominates the conda-specific folder:
>>> import sys
>>> sys.path
['', '/home/foo/anaconda3/envs/myenv3/lib/python36.zip', '/home/foo/anaconda3/envs/myenv3/lib/python3.6', '/home/foo/anaconda3/envs/myenv3/lib/python3.6/lib-dynload', '/home/foo/.local/lib/python3.6/site-packages', '/home/foo/anaconda3/envs/myenv3/lib/python3.6/site-packages']
Why -- and how can I fix that?
Context: I'm sharing dill
-ed files between different computers. I started getting a ModuleNotFoundError: No module named 'dill._dill'
error when reading the files on my local computer. I suspect this is because these files are dilled with the newer version, and my local computer is trying to read them with the older one. To test that, I'd like to upgrade dill
on my local computer (or make the environment run the version it actually claims it is).
Thanks for @Sraw's comment for the pointer. To check which file is actually being read, do
The reason for that can be found in the include path:
This particular path corresponds to
pip
. It's supposed to not install packages that are already installed withconda
, but apparently it made a mistake here. Also it is unclear to me why thepip
folder dominates theconda
folder in the ordering, but it is what it is.verified that it has the older version installed, and
removed that old version.