Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
22 views
in Python by (47.6k points)

I am new to python. Recently I got a project written by python and it requires some installation. I run 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

Is there an easy way to install all the required dependencies in this python project?

4 Answers

0 votes
by (106k points)
edited by

If you are using Linux as your OS then you can follow the below-mentioned steps:-

  1. Firstly, remove matplotlib==1.3.1 from requirements.txt

  2. After that try to install it with sudo apt-get install python-matplotlib

  3. Run pip install -r requirements.txt (Python 2), or pip3 install -r requirements.txt (Python 3)

  4. pip freeze > requirements.txt

If you are using Windows as your OS then use the following steps:-

  1. python -m pip install -U pip setuptools

  2. python -m pip install matplotlib

To know more about this you can have a look at the following video tutorial:-

To Learn what is python then visit this Data Science with Python Course.

Wanna become an Expert in python? Come & join our Python Certification course

0 votes
by (37.3k points)

The below code will help you to install all dependencies in a Python project:

$ pip install -r requirements.txt --no-index --find-links file:///tmp/packages

0 votes
by (2.7k points)

This should look like you are attempting to install packages in requirements.txt but you write down the command. What you instead do is pip install -r requirements.txt 

Explanation:

-r Option: The -r flag instructs pip that you're providing a requirements file. So it will figure out that it needs to step into a directory and check for contents of requirements.txt. 

Path: Run that command in the same directory of where the requirements.txt has been dropped, or fully qualified Open terminal or command prompt. Navigate to the directory which you have your file, either open the directory where that is located OR use its path Paste this, 

pip install -r requirements.txt

0 votes
by (1.9k points)

If you want to create a requirements.txt file to install all the required libraries or dependencies of a project use this .txt file. First, you need to create a new text file and rename it as requirements.txt.

Now add the list of Python packages and their versions required for the project as below.

numpy==1.21.2

pandas==1.3.3

requests==2.26.0

After the successful creation of the requirements.txt file. You can install all the packages mentioned in the file by using the command “pip install -r requirements.txt” in your terminal.

Command: pip install -r requirements.txt

With this step completed, we will install the packages and their versions.

Related questions

0 votes
2 answers
0 votes
2 answers
0 votes
1 answer
asked Oct 11, 2019 in Python by Sammy (47.6k points)
0 votes
4 answers
+2 votes
4 answers

1.4k questions

32.9k answers

507 comments

693 users

...