question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pip 19.1 pip install --no-use-pep517 not working with nested requirements files

See original GitHub issue

Relevent issues:

https://github.com/pypa/pip/issues/6375 https://github.com/pypa/pip/issues/6314 https://github.com/pypa/pip/pull/6370

Environment

  • pip version: 19.1
  • Python version: 3.6
  • OS: Linux

Description

pip install fails with a requirements file that references a setup.py file, in a project that has a pyproject.toml file that has no build tooling section.

My project setup:

setup.py  # Contains the actual project/package requirements
pyproject.toml  # Contains only 2 lines of black configuration
requirements/base.txt  # Contains only `-e .`
requirements/testing.txt  # Contains `-r base.txt` and then other stuff like pytest etc.
src/mypackage/...  # Actual project/package code

This setup allows us to:

  • Specify the project requirements exactly once (in the setup.py)
  • Use a command like pip install -r requirements/testing.txt to install both the project requirements along with other stuff needed to run the tests.
  • Build the package with python setup.py sdist

The suggested workaround in https://github.com/pypa/pip/pull/6370#issuecomment-486153504 doesn’t seem to work for me:

pip install --no-use-pep517 -q --upgrade --requirement /..../src/requirements/development.txt
ERROR: Error installing 'file:///.... (from -r /..../src/requirements/_base.txt (line 1))': editable mode is not supported for pyproject.toml-style projects. pip is processing this project as pyproject.toml-style because it has a pyproject.toml file. Since the project has a setup.py and the pyproject.toml has no "build-backend" key for the "build_system" value, you may pass --no-use-pep517 to opt out of pyproject.toml-style processing. See PEP 517 for details on pyproject.toml-style projects.

pip install -r requirements/testing.txt fails

Expected behavior

Historically (in <= 19.0.3) pip would install the project and testing/dev requirements (into the current virtualenv).

How to Reproduce

Set up a project as per above, try to install the dev/testing requirements with pip install -r foo.txt.

Output

As per description.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:28 (8 by maintainers)

github_iconTop GitHub Comments

15reactions
pitroucommented, Apr 24, 2019

Asking people to type the obscure --no-use-pep517 (should people even have to know what PEP 517 is?) when the well-known pip install -e used to work is not a sane workaround. I’m astonished that the pip maintainers estimate it’s fine to break well-known practices just out of theoretical purity.

Of course, there’s still python setup.py develop

8reactions
gaborbernatcommented, Apr 24, 2019

So I get now pip is PEP compliant, but this now breaks peoples workflow without any sane workaround, I consider it as a PEP oversight. PEP-517/8 on purpose did not want to cover editable installs, considering something to be addressed down the line. As such I would argue PEP-517/PEP-518 no longer applies when editable install mode is enabled. It’s the build frontend dependent on how this case is handled for now. In such a case, pip should fallback to the old system, until we define editable installs inside a PEP. @pfmoore want to weigh in? If we want people to explicitly require the old behaviour that’s okay, but then --no-use-pep517 should work independently if the pyproject.toml is there or what it contains.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Split requirements files in pip - python - Stack Overflow
So running pip install -r req-1-and-2.txt when req-1-and-2.txt contains ... Now, you can just install the requirements file embedding your ...
Read more >
Nested requirements.txt in python - Waylon Walker
Lets create two requirements files in a new directory to play with. mkdir requirements-nest cd requirements-nest touch requirements.txt ...
Read more >
Errors while running pip install -r requirements.txt - MongoDB
Hi,. I have same problem when I run the command in virtualenv in Window Command Prompt. (mflix_venv) C:\Program Files\MongoDB\M220P\mflix-python ...
Read more >
Managing Python Dependencies with Requirements.txt
When installing a Python package using pip install, pip will attempt to automatically work out the dependencies of the requested packages.
Read more >
requirements.txt in your requirements.txt - DEV Community ‍ ‍
Multiple -r Flags when Installing. You can actually use multiple files when running the pip install command. First, let's edit the files.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found