Run pip to Install a Package to Anaconda Environment¶
Context¶
User created a conda environment named myenv
and tried to install a package named <some_special_package>
. The package is not available in conda, and user has to install the package using pip install <some_special_package>
. However, the package is then installed in the base
environment in conda instead of the myenv
environment.
Problem¶
How to install the package in myenv
environment using pip
?
Solution¶
Do the followings:
-
Install
pip
undermyenv
environment if it is not already availablecondat install -n myenv pip
-
Find the location of the
pip
in themyenv
environment.- If the root of Anaconda is
/path/to/anaconda
, thepip
formyenv
environment should be found at/path/to/anaconda/envs/myenv/Scripts/pip
- If the root of Anaconda is
-
Use the
pip
in themyenv
environment to install the package/path/to/anaconda/envs/myenv/Scripts/pip install <some_special_package>