How to use requirements.txt to install all dependencies in a python project

621    Asked by ranjan_6399 in Python , Asked on Apr 16, 2021

 I am new to python. Recently I got a project written by python and it requires some installation. I run the below command to install but got an error.


# pip install requirements.txt 
Collecting requirements.txt 
Could not find a version that satisfies the requirement requirements.txt (from versions: ) 
No matching distribution found for requirements.txt
Below is my requirements.txt file:
# cat requirements.txt 
ordereddict==1.1 
argparse==1.2.1 
python-dateutil==2.2 
matplotlib==1.3.1 
nose==1.3.0 
numpy==1.8.0 
pymongo==3.3.0 
psutil>=2.0
Answered by Ranjana Admin

If you are using Linux as your OS and need pip install requirements then you can follow the below-mentioned steps:-

Firstly, remove matplotlib==1.3.1 from requirements.txt
After that try to install it with sudo apt-get install python-matplotlib
Run pip install -r requirements.txt (Python 2), or pip3 install -r requirements.txt (Python 3)
pip freeze > requirements.txt
If you are using Windows as your OS then use the following steps:-
python -m pip install -U pip setuptools
python -m pip install matplotlib

Your Answer

Interviews

Parent Categories