The Anaconda docs make it clear that if you use conda
as your virtual environment manager, you should stick to conda install
to install new packages as far as possible:
Unfortunately, issues can arise when conda and pip are used together
to create an environment, especially when the tools are used
back-to-back multiple times, establishing a state that can be hard to
reproduce. … Running conda after pip has the potential to
overwrite and potentially break packages installed via pip. Similarly,
pip may upgrade or remove a package which a conda-installed package
requires.
If you can't get all the packages you need from a conda channel, they say this, which is good advice even if you don't use pip:
If there is an expectation to install software using pip along-side
conda packages it is a good practice to do this installation into a
purpose-built conda environment to protect other environments from any
modifications that pip might make.
Finally the same document notes:
Use conda environments for isolation
- create a conda environment to isolate any changes pip makes
- environments take up little space thanks to hard links
- care should be taken to avoid running pip in the “root” environment
Provided you activate
the correct conda environment first, the pip install
command(s) should use that environment's pip
and install only into that environment.