Search code examples
pythonanacondaenvironment

Installing packages with pip


I have been advised using pip in a Anaconda virtual environment is bad. But some packages are not on conda or on conda forge.

When I run

conda activate virtualenv
where pip

I get two paths, one which is outside the environment

C:\Anaconda\virtualenv\Scripts\pip.exe
C:\Anaconda\Scripts\pip.exe

How do I fix it, so that when I do pip install package it only installs in the virtual environment?


Solution

  • The command line should use the first pip it finds, which in your case is the one in the virtual environment. This pip will only install packages in your environment. You can check which one is running with pip --version.