Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conda version pip install -r requirements.txt --target ./lib

What is the conda version of this?

pip install -r requirements.txt --target ./lib 

I've found these commands:

while read requirement; do conda install --yes $requirement; done < requirements.txt 

But it doesn't tell how to specify --target ./lib

like image 854
vineeth kanaparthi Avatar asked Jun 26 '18 12:06

vineeth kanaparthi


People also ask

Can I install requirements txt with conda?

Alternatively, you can use conda to install all the packages in a requirements. txt file. You can save a requirements. txt file from an existing environment, or manually create a new requirements.

Can I pip install inside conda?

Built into Anaconda, conda is a powerful package manager and environment manager that you use with command-line in the Anaconda Prompt for Windows, or in a terminal window for macOS or Linux. pip is the standard package manager for python, meaning you can use it both inside and outside of Anaconda.


2 Answers

You can run conda install --file requirements.txt instead of the loop, but there is no target directory in conda install. conda install installs a list of packages into a specified conda environment.

like image 54
phd Avatar answered Oct 06 '22 02:10

phd


To create an environment named py37 with python 3.7, using the channel conda-forge and a list of packages:

conda create -y --name py37 python=3.7 conda install --force-reinstall -y -q --name py37 -c conda-forge --file requirements.txt conda activate py37 ... conda deactivate 

Flags explained:

  • -y: Yes, do not ask for confirmation.
  • --force-reinstall: Install the package even if it already exists.
  • -q: Quiet, do not display progress bar.
  • -c: Channels, additional channels to search for packages. These are URLs searched in the order

Alternatively you can create an environment.yml file instead of requirements.txt:

name: py37 channels:   - conda-forge dependencies:   - python=3.7   - numpy=1.9.*   - pandas 

Use these commands to create and activate the conda environment based on the specifications in the Yaml file:

conda env create --file environment.yml conda activate py37 

Use this command to list the environments you have:

conda info --envs 

Use this command to remove the environment:

conda env remove --name py37 

New! The ansible-role dockpack.base_conda can manage conda environments on Linux, Mac and Windows, and can be used to create a docker image with custom conda environments.

like image 37
bbaassssiiee Avatar answered Oct 06 '22 00:10

bbaassssiiee