Conda: pip can silently downgrade conda installed packages

Created on 25 Feb 2018  路  3Comments  路  Source: conda/conda

https://github.com/Maluuba/nlg-eval has a requirements .txt with outdated versions of numpy, scipy scikit-learn, theano, gensim, nltk & click.
Pip will downgrade these packages, breaking most of the conda installation.
Conda is then unable to detect the downgrade:

  • conda env export still list the conda installed version
  • conda update does not do anything

to fix the problem requires conda install -f numpy scipy scikit-learn theano gensim nltk click

dm@daniel-t470:~$ pip install git+https://github.com/Maluuba/nlg-eval
Collecting git+https://github.com/Maluuba/nlg-eval
  Cloning https://github.com/Maluuba/nlg-eval to /tmp/pip-ggdpbo1b-build
Collecting click==6.3 (from nlg-eval==1.0)
  Using cached click-6.3-py2.py3-none-any.whl
Collecting nltk==3.1 (from nlg-eval==1.0)
Collecting numpy==1.11.0 (from nlg-eval==1.0)
Collecting scipy==0.17.0 (from nlg-eval==1.0)
Collecting scikit-learn==0.17 (from nlg-eval==1.0)
Collecting gensim==0.12.4 (from nlg-eval==1.0)
Collecting Theano==0.8.1 (from nlg-eval==1.0)
Requirement already satisfied: six>=1.5.0 in ./anaconda3-5.0.1/lib/python3.6/site-packages (from gensim==0.12.4->nlg-eval==1.0)
Requirement already satisfied: smart-open>=1.2.1 in ./anaconda3-5.0.1/lib/python3.6/site-packages (from gensim==0.12.4->nlg-eval==1.0)
Requirement already satisfied: boto>=2.32 in ./anaconda3-5.0.1/lib/python3.6/site-packages (from smart-open>=1.2.1->gensim==0.12.4->nlg-eval==1.0)
Requirement already satisfied: bz2file in ./anaconda3-5.0.1/lib/python3.6/site-packages (from smart-open>=1.2.1->gensim==0.12.4->nlg-eval==1.0)
Requirement already satisfied: requests in ./anaconda3-5.0.1/lib/python3.6/site-packages (from smart-open>=1.2.1->gensim==0.12.4->nlg-eval==1.0)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./anaconda3-5.0.1/lib/python3.6/site-packages (from requests->smart-open>=1.2.1->gensim==0.12.4->nlg-eval==1.0)
Requirement already satisfied: idna<2.7,>=2.5 in ./anaconda3-5.0.1/lib/python3.6/site-packages (from requests->smart-open>=1.2.1->gensim==0.12.4->nlg-eval==1.0)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in ./anaconda3-5.0.1/lib/python3.6/site-packages (from requests->smart-open>=1.2.1->gensim==0.12.4->nlg-eval==1.0)
Requirement already satisfied: certifi>=2017.4.17 in ./anaconda3-5.0.1/lib/python3.6/site-packages (from requests->smart-open>=1.2.1->gensim==0.12.4->nlg-eval==1.0)
Installing collected packages: click, nltk, numpy, scipy, scikit-learn, gensim, Theano, nlg-eval
  Found existing installation: click 6.7
    Uninstalling click-6.7:
      Successfully uninstalled click-6.7
  Found existing installation: nltk 3.2.5
    Uninstalling nltk-3.2.5:
      Successfully uninstalled nltk-3.2.5
  Found existing installation: numpy 1.12.1
    Uninstalling numpy-1.12.1:
      Successfully uninstalled numpy-1.12.1
  Found existing installation: scipy 1.0.0
    Uninstalling scipy-1.0.0:
      Successfully uninstalled scipy-1.0.0
  Found existing installation: scikit-learn 0.19.1
    Uninstalling scikit-learn-0.19.1:
      Successfully uninstalled scikit-learn-0.19.1
  Found existing installation: gensim 3.3.0
    Uninstalling gensim-3.3.0:
      Successfully uninstalled gensim-3.3.0
  Found existing installation: Theano 1.0.1+2.gcd195ed28
    Uninstalling Theano-1.0.1+2.gcd195ed28:
      Successfully uninstalled Theano-1.0.1+2.gcd195ed28
  Running setup.py install for nlg-eval ... done
Successfully installed Theano-0.8.1 click-6.3 gensim-0.12.4 nlg-eval-1.0 nltk-3.1 numpy-1.11.0 scikit-learn-0.17 scipy-0.17.0
dm@daniel-t470:~$ conda update numpy
Solving environment: done

# All requested packages already installed.

dm@daniel-t470:~$ conda env export -n base | grep numpy
  - msgpack-numpy=0.4.1=py36hfef8c07_0
  - numpy=1.12.1=py36he24570b_1
  - numpydoc=0.7.0=py36h18f165f_0

dm@daniel-t470:~$ conda env export -n base | grep scipy
  - scipy=1.0.0=py36hbf646e7_0
source-community tag-pip_interop type-feature

Most helpful comment

Regarding the type:feature tag:
This is a serious bug bug (though possibly pip's).
If you are not payng sufficient attention during a pip install,
the silent version change can break your entire conda environment
and it is very hard to figure out why after the fact.
Everything that depends on numpy is broken after the nlg-eval install above
since import numpy throws an error.
It seems like conda should sandbox pip somehow to stop it causing this kind of damage

conda doctor sound like a great idea though.

All 3 comments

@goanpeca You might be tackling something along these lines with shadow packages after we get #6861 wrapped up. But... #6861 first!

Regarding the type:feature tag:
This is a serious bug bug (though possibly pip's).
If you are not payng sufficient attention during a pip install,
the silent version change can break your entire conda environment
and it is very hard to figure out why after the fact.
Everything that depends on numpy is broken after the nlg-eval install above
since import numpy throws an error.
It seems like conda should sandbox pip somehow to stop it causing this kind of damage

conda doctor sound like a great idea though.

Was this page helpful?
0 / 5 - 0 ratings