I have an Anaconda virtual environment in which I have a lot of Python packages installed multiple times, often in different versions, for example:
$ conda list
...
singledispatch 3.4.0.3 py35_0
sip 4.18 py35_0
six 1.10.0 <pip>
six 1.11.0 <pip>
six 1.10.0 py35_0
snowballstemmer 1.2.1 py35_0
sockjs-tornado 1.0.3 py35_0
sphinx 1.5.4 py35_0
spyder 3.1.3 py35_0
sqlalchemy 1.1.9 py35_0
sqlite 3.13.0 0
statsmodels 0.8.0 np111py35_0
sympy 1.0 py35_0
tensorflow-gpu 1.3.0 <pip>
tensorflow-gpu 1.0.1 <pip>
tensorflow-tensorboard 0.1.6 <pip>
terminado 0.6 py35_0
testpath 0.3 py35_0
Theano 0.9.0 <pip>
tk 8.5.18 0
toolz 0.8.2 py35_0
tornado 4.4.2 py35_0
tqdm 4.11.2 <pip>
tqdm 4.15.0 py35_0
traitlets 4.3.2 py35_0
unicodecsv 0.14.1 py35_0
wcwidth 0.1.7 py35_0
werkzeug 0.12.1 py35_0
Werkzeug 0.12.2 <pip>
wheel 0.29.0 <pip>
wheel 0.30.0 <pip>
wheel 0.29.0 py35_0
...
I don't know how I got to this state, but how can I safely get rid of the duplicate packages?
Also, if a program imports the six
package, how does Python determine which version to import?
EDIT:
I know now where the problem came from. I probably installed some packages using pip
's --ignore-installed
option. Am I fine with all the duplicates being installed like this or should I get rid of them?
If you don't need specific version of any one of those, then I would try conda update conda
which should remove all the old packages, install the newest versions, and set the newest versions as default. Otherwise, you can always use conda remove <pkg-name>
to remove all the copies and conda install <pkg-name>
to install the latest version and replace the old ones. You can also use pip install <pkg-name>==<version>
to install a specific version (for example, pip install keras==1.2
). This link is also helpful.
For begginers, this tutorial might be useful
conda clean --all
https://youtu.be/GNd_em2IzW4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With