Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add package to conda environment without pip

Tags:

conda

anaconda

How can I add a package to an existing conda environment?

If it is a python package I can use pip install <package>, but what if pip does not work?

Is it sufficient to activate the environment and use conda install <package>?

like image 703
Soren Avatar asked Nov 12 '15 20:11

Soren


People also ask

Do I need pip if I have conda?

It's fully recommended to use pip inside of conda. It's better to install using conda, but for any packages that don't have a conda build, it's perfectly acceptable to use pip.


2 Answers

You've answered your own question. In fact you really want to do conda install ... instead of using pip if you can.

You can install a conda package also without activating the environment. Just use conda install -n <env_name> <package> or conda install -p <path/to/env> <package>.

like image 97
faph Avatar answered Oct 02 '22 23:10

faph


If you want to install a specific package inside a specific conda environment, you can use the following command.

First activate the conda environment and then do:

$ conda install --name <conda_env_name> -c <channel_name> <package_name> 

For a concrete example, let's assume that you want to install chainer from the channel anaconda to an already created conda environment named chainerenv, then you can do:

$ conda install --name chainerenv -c anaconda chainer 
like image 24
kmario23 Avatar answered Oct 02 '22 21:10

kmario23