Question

How to install packages from Requirement.txt in python using anaconda?

I am confused on how to install all the packages from requirements.txt shared by another person for a python project strictly using Anaconda only in Windows os.

  1. I have installed Anaconda navigator. Should I do it in navigator or in conda prompt ?
  2. Do I need to create an environment first and then activate it and then run command pip install requirements.txt in that environment ?

Please, could you suggest a better way to install the packages from anaconda using requirements.txt and run the python project?

 46  97983  46
1 Jan 1970

Solution

 54

While installing packages in requirements.txt using Conda through the following command

conda install --yes --file requirements.txt
2021-06-28

Solution

 33

conda uses an environment.yaml file instead of requirements.txt, but you can include one in the other:

# environment.yaml

name: test-env
channels:
  - conda-forge
dependencies:
  - python>=3.5
  - anaconda
  - pip
  - pip:
    - -r file:requirements.txt

Then use conda to create the environment via

conda env create -f environment.yaml
2021-06-28