Questions tagged [requirements.txt]

requirements.txt is the standard name for a requirements file for Python package installation program `pip`. It's used in the command like `pip install -r requirements.txt`.

requirements.txt is the standard name for a requirements file for Python package installation program pip. The file is list of items to be installed like so:

pip install -r requirements.txt

The items in the file can be package names (will be installed from Python Package Index or any other index configured in ~/.pypirc), package files or URLs to VCS.

For more information on requirements files see pip user guide.

635 questions
1168
votes
26 answers

Automatically create file 'requirements.txt'

Sometimes I download the Python source code from GitHub and don't know how to install all the dependencies. If there isn't any requirements.txt file I have to create it by hand. Given the Python source code directory, is it possible to create…
Igor Barinov
  • 21,820
  • 10
  • 28
  • 33
749
votes
10 answers

How to state in requirements.txt a direct github source

I've installed a library using the command pip install git+git://github.com/mozilla/elasticutils.git which installs it directly from a Github repository. This works fine and I want to have that dependency in my requirements.txt. I've looked at…
Alfe
  • 56,346
  • 20
  • 107
  • 159
438
votes
19 answers

Reference requirements.txt for the install_requires kwarg in setuptools setup.py file

I have a requirements.txt file that I'm using with Travis-CI. It seems silly to duplicate the requirements in both requirements.txt and setup.py, so I was hoping to pass a file handle to the install_requires kwarg in setuptools.setup. Is this…
Louis Thibault
  • 20,240
  • 25
  • 83
  • 152
343
votes
6 answers

In requirements.txt, what does tilde equals (~=) mean?

In the requirements.txt for a Python library I am using, one of the requirements is specified like: mock-django~=0.6.10 What does ~= mean?
James Hiew
  • 6,040
  • 5
  • 27
  • 41
316
votes
18 answers

Could not find a version that satisfies the requirement

I'm installing several Python packages in Ubuntu 12.04 using the following requirements.txt file: numpy>=1.8.2,<2.0.0 matplotlib>=1.3.1,<2.0.0 scipy>=0.14.0,<1.0.0 astroML>=0.2,<1.0 scikit-learn>=0.14.1,<1.0.0 rpy2>=2.4.3,<3.0.0 and these two…
Gabriel
  • 40,504
  • 73
  • 230
  • 404
241
votes
17 answers

Upgrade python packages from requirements.txt using pip command

How do I upgrade all my python packages from requirements.txt file using pip command? tried with below command $ pip install --upgrade -r requirements.txt Since, the python packages are suffixed with the version number (Django==1.5.1) they don't…
abhiomkar
  • 4,548
  • 7
  • 29
  • 24
236
votes
4 answers

requirements.txt vs setup.py

I started working with Python. I've added requirements.txt and setup.py to my project. But, I am still confused about the purpose of both files. I have read that setup.py is designed for redistributable things and that requirements.txt is designed…
lucy
  • 4,136
  • 5
  • 30
  • 47
179
votes
3 answers

How to customize a requirements.txt for multiple environments?

I have two branches, Development and Production. Each has dependencies, some of which are different. Development points to dependencies that are themselves in development. Likewise for Production. I need to deploy to Heroku which expects each…
Charles R
  • 17,989
  • 6
  • 20
  • 18
177
votes
4 answers

Is there any way to show the dependency trees for pip packages?

I have a project with multiple package dependencies, the main requirements being listed in requirements.txt. When I call pip freeze it prints the currently installed packages as plain list. I would prefer to also get their dependency relationships,…
tbicr
  • 24,790
  • 12
  • 81
  • 106
157
votes
11 answers

Is there a way to list pip dependencies/requirements?

Without going through with the installation, I want to quickly see all the packages that pip install would install.
lastoneisbearfood
  • 3,955
  • 5
  • 26
  • 25
137
votes
1 answer

pip freeze creates some weird path instead of the package version

I am working on developing a python package. I use pip freeze > requirements.txt to add the required package into the requirement.txt file. However, I realized that some of the packages, instead of the package version, have some path in front of…
Naeem Khoshnevis
  • 2,001
  • 4
  • 18
  • 30
129
votes
7 answers

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

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…
Joey Yi Zhao
  • 37,514
  • 71
  • 268
  • 523
110
votes
2 answers

Unable to install using pip install requirements.txt

I'm trying to install BitTornado for Python 2.7 using requirements.txt, I get the following error: Collecting requirements.txt Could not find a version that satisfies the requirement requirements.txt (from versions: ) No matching distribution…
Avdhesh Parashar
  • 1,167
  • 2
  • 8
  • 10
90
votes
5 answers

Delete unused packages from requirements file

Is there any easy way to delete no-more-using packages from requirements file? I wrote a bash script for this task but, it doesn't work as I expected. Because, some packages are not used following their PyPI project names. For…
myildirim
  • 2,248
  • 2
  • 19
  • 25
81
votes
3 answers

Does Python requirements file have to specify version?

I have a requirements.txt file for a Python code base. The file has everything specified: pytz==2017.2 requests==2.18.4 six==1.11.0 I am adding a new package. Should I list its version? If yes, how do I pick a version to specify?
Intrastellar Explorer
  • 3,005
  • 9
  • 52
  • 119
1
2 3
42 43