Install requirements.txt in a specific python env path?

Question:

How can I do a pip install requirements.txt to a specific python installation?

This is the location of the python installation:

/opt/conda/envs/prod/bin/python

And my requirements.txt is here:

/home/jupyter/services/requirements.txt

Can I just do something like /opt/conda/envs/prod/bin/python pip install -r /home/jupyter/ml_gcp_services/requirements.txt??

Asked By: renaudb3

||

Answers:

It looks like you are using conda to manage your Python environments. You first have to activate your environment, check out the conda docs for how to do it and what it actually does. It looks like your environment is called prod, so you would activate it using:

conda activate prod

Once activated you can simply install your requirements.txt as you would usually do:

pip install -r <path/to/requirements.txt>

The packages will then be installed into your environment.

Answered By: abrin
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.