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.

"Relative URLs" no longer work, due to in-tree-builds

See original GitHub issue

Description

Hi!

On 21.2.4 with --use-feature=in-tree-build or 21.3, trying to install a local relative package not using PEP517 under the new in-tree-build fails with

$ pip install file:./project#egg=project
Processing ./project
  WARNING: Generating metadata for package project produced metadata for project name unknown. Fix your #egg=project fragments.
WARNING: Discarding file:///./project#egg=project. Requested unknown from file:///./project#egg=project has inconsistent name: filename has 'project', but metadata has 'UNKNOWN'
ERROR: Could not find a version that satisfies the requirement project (unavailable) (from versions: none)
ERROR: No matching distribution found for project (unavailable)

Expected behavior

Should install like it use to before in-tree-build

$ pip install file:./project#egg=project
Processing ./project
Building wheels for collected packages: project
  Building wheel for project (setup.py) ... done
  Created wheel for project: filename=project-0.1-py3-none-any.whl size=955 sha256=4539ac72997f812b888e9de43846fed271f032af00d30a32d98147d99dbe04c0
  Stored in directory: /private/var/folders/h9/f9hh7k0x6qg1zd9d_jmmld_c0000gn/T/pip-ephem-wheel-cache-y09vyltl/wheels/0e/21/e3/ece7361445f12926380c44fda12b09629cde15cef20a014d92
Successfully built project
Installing collected packages: project
Successfully installed project-0.1

pip version

<21.3 with --use-feature=in-tree-build and 21.3 without the flag

Python version

3.8

OS

OSX

How to Reproduce

This creates a venv with the correct version of pip to show errors

#!/usr/bin/env bash -x

mkdir /tmp/pip-relative && cd /tmp/pip-relative

mkdir -p project

cat > project/setup.py <<EOF
#!/usr/bin/env python
from setuptools import setup
setup(
    name="project",
    version="0.1",
)
EOF

virtualenv venv

venv/bin/pip install -U "pip<21.3"

venv/bin/pip install "file:./project#egg=project" # Works

venv/bin/pip install --use-feature=in-tree-build "file:./project#egg=project"  # Fails

venv/bin/pip install --use-feature=in-tree-build "file:/tmp/pip-relative/project#egg=project"  # Works

venv/bin/pip install -U "pip==21.3"

venv/bin/pip install "file:./project#egg=project"  # Fails

venv/bin/pip install "file:/tmp/pip-relative/project#egg=project"  # Works

Output

pip<21.3 Works with relative, without in-tree-build

$ ./reproduce.sh
+ venv/bin/pip install -U 'pip<21.3'
+ venv/bin/pip install file:./project#egg=project
Processing ./project
Building wheels for collected packages: project
  Building wheel for project (setup.py) ... done
  Created wheel for project: filename=project-0.1-py3-none-any.whl size=955 sha256=4539ac72997f812b888e9de43846fed271f032af00d30a32d98147d99dbe04c0
  Stored in directory: /private/var/folders/h9/f9hh7k0x6qg1zd9d_jmmld_c0000gn/T/pip-ephem-wheel-cache-y09vyltl/wheels/0e/21/e3/ece7361445f12926380c44fda12b09629cde15cef20a014d92
Successfully built project
Installing collected packages: project
Successfully installed project-0.1

pip<21.3 Fails with relative && in-tree-build

+ venv/bin/pip install --use-feature=in-tree-build file:./project#egg=project
Processing ./project
  WARNING: Generating metadata for package project produced metadata for project name unknown. Fix your #egg=project fragments.
WARNING: Discarding file:///./project#egg=project. Requested unknown from file:///./project#egg=project has inconsistent name: filename has 'project', but metadata has 'UNKNOWN'
ERROR: Could not find a version that satisfies the requirement project (unavailable) (from versions: none)
ERROR: No matching distribution found for project (unavailable)

pip<21.3 Works with absolute && in-tree-build

+ venv/bin/pip install --use-feature=in-tree-build file:/tmp/pip-relative/project#egg=project
Processing /tmp/pip-relative/project
Building wheels for collected packages: project
  Building wheel for project (setup.py) ... done
  Created wheel for project: filename=project-0.1-py3-none-any.whl size=955 sha256=708d24dc0f953b01ccfd5ececcd149772cbe5a1e670ac8d13f202387db2dd894
  Stored in directory: /private/var/folders/h9/f9hh7k0x6qg1zd9d_jmmld_c0000gn/T/pip-ephem-wheel-cache-6w00m0tu/wheels/10/ef/60/738a1a10b40c407ce154438b36d838f890cc1ca8f675844fd5
Successfully built project
Installing collected packages: project
  Attempting uninstall: project
    Found existing installation: project 0.1
    Uninstalling project-0.1:
      Successfully uninstalled project-0.1
Successfully installed project-0.1

pip==21.3 Fails with relative

+ venv/bin/pip install -U pip==21.3
+ venv/bin/pip install file:./project#egg=project
Processing ./project
  Preparing metadata (setup.py) ... done
  WARNING: Generating metadata for package project produced metadata for project name unknown. Fix your #egg=project fragments.
WARNING: Discarding file:///./project#egg=project. Requested unknown from file:///./project#egg=project has inconsistent name: filename has 'project', but metadata has 'unknown'
ERROR: Could not find a version that satisfies the requirement project (unavailable) (from versions: none)
ERROR: No matching distribution found for project (unavailable)

pip==21.3 Works with absolute

+ venv/bin/pip install file:/tmp/pip-relative/project#egg=project
Processing /tmp/pip-relative/project
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: project
  Building wheel for project (setup.py) ... done
  Created wheel for project: filename=project-0.1-py3-none-any.whl size=955 sha256=5c77f5d04093c89b526ab2b5d427896e17b1d7f3e4e4312b3705da57d51ae9b2
  Stored in directory: /private/var/folders/h9/f9hh7k0x6qg1zd9d_jmmld_c0000gn/T/pip-ephem-wheel-cache-_1ezisoz/wheels/10/ef/60/738a1a10b40c407ce154438b36d838f890cc1ca8f675844fd5
Successfully built project
Installing collected packages: project
  Attempting uninstall: project
    Found existing installation: project 0.1
    Uninstalling project-0.1:
      Successfully uninstalled project-0.1
Successfully installed project-0.1

Code of Conduct

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
lindycodercommented, Oct 12, 2021

Bit of context: We’ve been using file:./relapth#egg=<project> for go around a limitation of pip compile (https://github.com/jazzband/pip-tools/issues/204) because it did not resolve to absolute path making the produced requirements.txt work without any hacking.

There seems to be an open PR to improve relative path handling, hopefully we’ll be able to move the ./relpath once this lands

Thank you for your time, I was not aware this was an undocumented feature

1reaction
pradyunsgcommented, Oct 12, 2021

I’m labelling this as “not a bug”, because that’s how I’m leaning; but I’ll let others weigh in on how they feel about this. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Preventing secure/insecure errors by using protocol relative ...
A relative URL without a scheme (http: or https:) is valid, per RTF 3986: Section 4.2. If a client chokes on it, then...
Read more >
Google: Doesn't Matter if You Use Absolute or Relative URLs ...
John Mueller says, for the most part, it doesn't matter whether you use absolute or relative URLs for internal links.
Read more >
How to create absolute hyperlinks and relative hyperlinks in ...
Describes how to create absolute and relative hyperlinks in Word 2003 ... these hyperlinks can be relative to the Word document that you...
Read more >
Why relative URLs should be forbidden for web developers
A relative url is a url that is not complete. Usually it's just the last part (the path) of a url, which means...
Read more >
HTML and URLs
Relative URLs may contain relative path components (". ... consult the definitions of these elements for more information about URL issues specific to...
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