Description
Environment
- pip version: 20.1.1
- Python version: 3.8.2
- OS: Linux
pip freeze
output:
attrs==19.3.0
certifi==2020.4.5.2
chardet==3.0.4
docutils==0.16
flit==2.3.0
flit-core==2.3.0
idna==2.9
punq==0.4.1
pytoml==0.1.21
requests==2.23.0
urllib3==1.25.9
Description
Installing a package using a PEP 517 backend with build isolation enabled results in an install_requirements
call using the return value of backend.get_requires_for_build_wheel()
, which generates and runs a pip install
command. Constraints files passed to the outermost pip install
command are not reflected in the generated command.
This means that, at least when using flit, a local install with build isolation will fail if it's relying on a constraints file to specify paths to dependencies that are only available locally.
(The other build backends I checked don't require the runtime requirements in the isolated environment. I brought this up in the flit repo first in pypa/flit#354)
Expected behavior
Given two projects, a dependency and a dependent, with the dependent using flit, and the dependency not present in an index, the command pip install -c path/to/constraints.txt path/to/dependent
, where the constraints file has a line like name-of-dependency @ file:///absolute/path/to/dependency
should succeed.
How to Reproduce
- Create a "dependency" project with a name not present in pypi
- Create a "dependent" project that depends on the dependency, using flit
- Create a
constraints.txt
file that at least contains a direct reference linking the name of the dependency to its absolute path
4 Runpip install -c constraints.txt ./dependent
, assuming the constraints file and the project directories are next to each other
Output
$ ls
constraints.txt dependency_bleh dependent
$ cat constraints.txt
dependency_bleh @ file:///absolute/path/of/pwd/dependency_bleh
dependent @ file:///absolute/path/of/pwd/dependent
$ pip install -c constraints.txt ./dependent
Processing ./dependent
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... error
ERROR: Command errored out with exit status 1:
command: <venv>/bin/python3.8 <venv>/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-67rnvdf5/normal --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- dependency_bleh
cwd: None
Complete output (2 lines):
ERROR: Could not find a version that satisfies the requirement dependency_bleh (from versions: none)
ERROR: No matching distribution found for dependency_bleh
----------------------------------------
ERROR: Command errored out with exit status 1: <venv>/bin/python3.8 <venv>/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-67rnvdf5/normal --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- dependency_bleh Check the logs for full command output.