close

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

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to use requirements.txt to install all dependencies in a python project in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

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

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

    pip install -r requirements.txt for python 2.x
    pip3 install -r requirements.txt for python 3.x (in case multiple versions are installed)

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

    pip install -r requirements.txt for python 2.x
    pip3 install -r requirements.txt for python 3.x (in case multiple versions are installed)

Method 1

If you are using Linux OS:

  1. Remove matplotlib==1.3.1 from requirements.txt
  2. Try to install 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 OS:

  1. python -m pip install -U pip setuptools
  2. python -m pip install matplotlib

Method 2

pip install -r requirements.txt for python 2.x

pip3 install -r requirements.txt for python 3.x (in case multiple versions are installed)

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read