Skip to main content

Questions tagged [requirements.txt]

`requirements.txt` is the conventional 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
Filter by
Sorted by
Tagged with
1347 votes
28 answers
2.1m views

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 ...
Igor Barinov's user avatar
  • 24.1k
799 votes
11 answers
457k views

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 ...
Alfe's user avatar
  • 58.5k
448 votes
20 answers
247k views

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 ...
Louis Thibault's user avatar
387 votes
6 answers
175k views

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's user avatar
  • 6,687
338 votes
16 answers
2.5m views

Could not find a version that satisfies the requirement <package>

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,&...
Gabriel's user avatar
  • 42.1k
265 votes
17 answers
297k views

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 ...
abhiomkar's user avatar
  • 4,808
250 votes
5 answers
120k views

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 ...
lucy's user avatar
  • 4,366
202 votes
6 answers
132k views

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 ...
tbicr's user avatar
  • 25.6k
197 votes
4 answers
93k views

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 ...
Charles R's user avatar
  • 18.8k
168 votes
11 answers
165k views

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's user avatar
167 votes
1 answer
67k views

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 ...
Naeem Khoshnevis's user avatar
131 votes
6 answers
372k views

How to fix error with freetype while installing all packages from a requirements.txt file?

I ran the following command to install dependencies for a Python project? # pip install requirements.txt Collecting requirements.txt Could not find a version that satisfies the requirement ...
Joey Yi Zhao's user avatar
  • 41.1k
111 votes
2 answers
167k views

Unable to install using pip install requirements.txt [closed]

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....
Avdhesh Parashar's user avatar
100 votes
5 answers
99k views

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 ...
myildirim's user avatar
  • 2,378
89 votes
3 answers
144k views

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, ...
Intrastellar Explorer's user avatar
88 votes
1 answer
56k views

What does pip-compile do? What is its use? (how do I maintain the contents of my requirements.txt file?)

I read pip-compiles definition in pip-tools documentation but I don't understand how it works. Q1: What is pip-compile's use? Q2: What does compiling requirements.in to produce requirements.txt mean? ...
nilinswap's user avatar
  • 1,444
84 votes
4 answers
26k views

Check if requirements are up to date

I'm using pip requirements files for keeping my dependency list. I also try to follow best practices for managing dependencies and provide precise package versions inside the requirements file. For ...
alecxe's user avatar
  • 470k
84 votes
10 answers
44k views

How to specify install order for python pip?

I'm working with fabric(0.9.4)+pip(0.8.2) and I need to install some python modules for multiple servers. All servers have old version of setuptools (0.6c8) which needs to be upgraded for pymongo ...
Seppo Erviälä's user avatar
81 votes
1 answer
52k views

Requirements.txt greater than equal to and then less than?

I have this line in my requirements file django>=1.10,<1.11 Does that mean I need to have Django version >= 1.10 and then less than 1.11?
Chris's user avatar
  • 4,963
77 votes
6 answers
253k views

tell pip to install the dependencies of packages listed in a requirement file

Developing a Django web app, I have a list of packages I need to install in a virtualenv. Say: Django==1.3.1 --extra-index-url=http://dist.pinaxproject.com/dev/ Pinax==0.9b1.dev10 git+git://github....
Maxime R.'s user avatar
  • 9,891
73 votes
4 answers
40k views

pip freeze without dependencies of installed packages

When I do pip freeze I get the packages I've explicitly installed plus those packages that are dependencies of those packages. For example: $ pip install fabric ... $ pip freeze Fabric==1.0.1 ...
Tom Viner's user avatar
  • 6,705
62 votes
5 answers
59k views

What does " -r " do in pip install -r requirements.txt

I looked up how to install multiple packages from a requirements document using pip. The answers were mostly: pip install -r requirements.txt What does the -r do though? I can't find an answer for ...
SuperCow's user avatar
  • 1,573
60 votes
5 answers
23k views

Is requirements.txt still needed when using pyproject.toml?

Since mid 2022 it is now possible to get rid of setup.py, setup.cfg in favor of pyproject.toml. Editable installs work with recent versions of setuptools and pip and even the official packaging ...
Bastian Venthur's user avatar
53 votes
3 answers
101k views

How to create a requirements.txt? [duplicate]

I'm wondering how I can create a suitable requirements.txt for my Python 3 application?
Daniel Santos's user avatar
53 votes
9 answers
64k views

Check if my Python has all required packages

I have a requirements.txt file with a list of packages that are required for my virtual environment. Is it possible to find out whether all the packages mentioned in the file are present. If some ...
Alagappan Ramu's user avatar
53 votes
1 answer
17k views

Is there something like requirements.txt for R? [closed]

In Python, you can have a file requirements.txt where you can store a list of packages used into a file, and whenever other people want to run your programs and need to install the dependencies, they ...
hans-t's user avatar
  • 3,193
47 votes
3 answers
18k views

Equivalent of `package.json' and `package-lock.json` for `pip`

Package managers for JavaScript like npm and yarn use a package.json to specify 'top-level' dependencies, and create a lock-file to keep track of the specific versions of all packages (i.e. top-level ...
djvg's user avatar
  • 13.5k
41 votes
5 answers
48k views

Install PyTorch from requirements.txt

Torch documentation says use pip install torch==1.4.0+cpu torchvision==0.5.0+cpu -f https://download.pytorch.org/whl/torch_stable.html to install the latest version of PyTorch. This works when I do ...
Siddharth Prajosh's user avatar
40 votes
2 answers
47k views

Quiet output from pip via requirements file?

pip has a -q/--quiet flag that works ideally from the command line. I'm using an automated deployment process (Amazon Elastic Beanstalk), and the tools use pip to install from a requirements file. ...
kungphu's user avatar
  • 4,804
39 votes
3 answers
54k views

Install local wheel file with requirements.txt

Have a local package ABC-0.0.2-py3-none-any.whl. I want to install it in the different project through requrements.txt. e.g. requirements.txt ABC==0.0.2 Flask==1.1.2 flask-restplus==0.13.0 gunicorn==...
Rajan Sharma's user avatar
38 votes
2 answers
34k views

How to install python module extras with pip requirements.txt file

The pip requirements.txt documentation says that extras may be installed using a line like MyPackage==3.0 [PDF] So in my requirements.txt file I have a line that reads: requests==2.9.1 [security] ...
Michael Lang's user avatar
  • 2,217
37 votes
3 answers
104k views

How to install from requirements.txt [duplicate]

I have to install python packages from requirements files that's provided to me. However, when I use pip install -r requirements.txt command I get an error saying ERROR: Invalid requirement (from ...
harry r's user avatar
  • 906
36 votes
3 answers
52k views

Installing Python Dependencies locally in project

I am coming from NodeJS and learning Python and was wondering how to properly install the packages in requirements.txt file locally in the project. For node, this is done by managing and installing ...
henhen's user avatar
  • 1,143
35 votes
3 answers
37k views

pip's requirements.txt best practice

I am trying to generate requirements.txt for someone to replicate my environment. As you may know, the standard way is pip freeze > requirements.txt I noticed that this will list all the ...
Darren Christopher's user avatar
33 votes
2 answers
5k views

Travis special requirements for each python version

I need unittest2 and importlib for python 2.6 that is not required for other python versions that travis tests against. Is there a way to tell Travis-CI to have different requirements.txt files for ...
fakedrake's user avatar
  • 6,776
31 votes
1 answer
15k views

What does `-e .` in requirements.txt do? [duplicate]

From: https://github.com/brandon-rhodes/luca/blob/master/requirements.txt ansi2html pytest sphinx tox -e . What does the last line, -e ., do?
user avatar
28 votes
1 answer
26k views

setup.py & pip: override one of the dependency's sub-dependency from requirements.txt

I'm currently working on a package and in my requirements.txt, I have a dependency: wikipedia. Now, wikipedia 1.3 uses requests-2.2.1 while my package uses version 2.3.0. Also, as one would expect, ...
arcolife's user avatar
  • 416
25 votes
5 answers
14k views

Building docs fails due to missing pandoc

The problem I am having trouble getting my docs to build successfully when clicking "Build" on the readthedocs.io web interface, but it builds just fine on my local machine. To test that it is an ...
keirasan's user avatar
  • 415
19 votes
4 answers
57k views

Managing contents of requirements.txt for a Python virtual environment

So I am creating a brand new Flask app from scratch. As all good developers do, my first step was to create a virtual environment. The first thing I install in the virtual environment is Flask==0.11....
Amistad's user avatar
  • 7,300
19 votes
3 answers
37k views

Creating requirements.txt in pip compatible format in a conda virtual environment

I have created a conda virtual environment on a Windows 10 PC to work on a project. To install the required packages and dependencies, I am using conda install <package> instead of pip install &...
user avatar
19 votes
1 answer
8k views

Check requirements for python 3 support

I have several python projects with different set of dependencies listed in pip requirements files. I've started to think about porting the code to python 3, but I need to know if my dependencies are ...
alecxe's user avatar
  • 470k
19 votes
1 answer
13k views

Include .whl installation in requirements.txt

How do I include this in the requirements.txt file? For Linux: pip install http://download.pytorch.org/whl/cu75/torch-0.1.12.post2-cp27-none-linux_x86_64.whl pip install torchvision FOR MacOS: pip ...
Abhishek Bhatia's user avatar
18 votes
2 answers
17k views

How to format requirements.txt when package source is from specific websites?

I am trying to convert the following installation commands using pip that downloads from another website, into a requirements.txt format, but just can't figure out how. Can anyone assist? pip install ...
Jake's user avatar
  • 2,772
17 votes
3 answers
4k views

How to cache requirements for a Django project on Travis-CI?

As Travis-CI is evolving and extending its feature set it naturally becomes nicer and nicer to use. I recently read this article about "Speeding up the build". A build for the Django project I am ...
mamachanko's user avatar
17 votes
8 answers
6k views

Robust way to ensure other people can run my python program

I wish to place a python program on GitHub and have other people download and run it on their computers with assorted operating systems. I am relatively new to python but have used it enough to have ...
Mick's user avatar
  • 7,875
16 votes
5 answers
19k views

pip installing environment.yml as if it's a requirements.txt

I have an environment.yml file, but don't want to use Conda: name: foo channels: - defaults dependencies: - matplotlib=2.2.2 Is it possible to have pip install the dependencies inside an ...
Intrastellar Explorer's user avatar
16 votes
2 answers
16k views

pip requirement.txt conditionals or environment markers based on env variables

Is there a way to specify conditional installs in a pip requirements.txt file that are based on the value of an environment variable? I've been able to control most of what I need with environment ...
ghoff's user avatar
  • 331
15 votes
2 answers
9k views

Docker-compose does not reflect changes in requirements.txt

Changes in my requirements.txt are not being reflected when I run: docker-compose -f docker-compose-dev.yml up -d docker-compose-dev.yml version: '3.6' services: web: build: context:...
8-Bit Borges's user avatar
  • 9,925
15 votes
1 answer
4k views

Caching pipenv / Pipfile dependencies on TravisCI

The Travis documentation on caching does not specifically mention how to cache python dependencies installed from pipenv's Pipfile, rather than from pip's usual requirements.txt. I tried setting up ...
shacker's user avatar
  • 15.2k
14 votes
3 answers
15k views

Add pip requirements to docker image in runtime

I want to be able to add some extra requirements to an own create docker image. My strategy is build the image from a dockerfile with a CMD command that will execute a "pip install -r" command using a ...
ralvarez's user avatar
  • 421

1
2 3 4 5
14