Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The git+file requirement format doesn't seem to work the way documentation says it does #12124

Closed
1 task done
jparta opened this issue Jul 3, 2023 · 8 comments
Closed
1 task done
Labels
resolution: duplicate Duplicate of an existing issue/PR

Comments

@jparta
Copy link
Contributor

jparta commented Jul 3, 2023

Description

I'm trying to include a dependency in my requirements.txt file which would get my local git repository. I'm using the package @ git+file:// format, as shown here:
https://pip.pypa.io/en/stable/topics/vcs-support/
The git documentation shows the same file:// format: https://git-scm.com/docs/git-clone#_git_urls

But when I use the format

my_package @ git+file:///home/path_to_package/my_package/

I get the following error:

ERROR: Invalid requirement: 'my_package @ git+file:///home/path_to_package/my_package/' (from line 1 of requirements.txt)
Hint: It looks like a path. File 'my_package @ git+file:///home/path_to_package/my_package/' does not exist.

I can get it to install if I use the following format:

my_package @ git+file://dummy_host/home/path_to_package/my_package/
It seems that the host element of the file URI scheme is required, which is not what the documentation says.

Expected behavior

That the git+file URI scheme works as explained in these documents:
https://pip.pypa.io/en/stable/topics/vcs-support/
https://git-scm.com/docs/git-clone#_git_urls

I.e. my_package @ git+file:///home/path_to_package/my_package/

in requirements.txt and running pip install -r requirements.txt installs my_package without errors.

pip version

pip 23.1.2

Python version

Python 3.11.3

OS

Ubuntu 20.04.6 LTS

How to Reproduce

  1. Have a local python package as a git repo in /home/path_to_package/my_package/
  2. Make a pip-based virtual environment and activate it
  3. echo "my_package @ git+file:///home/path_to_package/my_package/" > requirements.txt
  4. pip install -r requirements.txt

Output

11:05 $ pip install -r requirements.txt 
    ERROR: Invalid requirement: 'my_package @ git+file:///home/path_to_package/my_package/' (from line 2 of requirements.txt)
    Hint: It looks like a path. File 'my_package @ git+file:///home/path_to_package/my_package/' does not exist.

Code of Conduct

@jparta jparta added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Jul 3, 2023
@uranusjr
Copy link
Member

uranusjr commented Jul 3, 2023

Can you also check if pip install "my_package @ git+file:///home/path_to_package/my_package/" work?

@uranusjr
Copy link
Member

uranusjr commented Jul 3, 2023

Oh it probably will not, this is basically #10098, unfortunately not fixable until we finish a bunch of deprecations.

@uranusjr
Copy link
Member

uranusjr commented Jul 3, 2023

Duplicate of #10098

@uranusjr uranusjr marked this as a duplicate of #10098 Jul 3, 2023
@uranusjr uranusjr closed this as not planned Won't fix, can't repro, duplicate, stale Jul 3, 2023
@uranusjr uranusjr added resolution: duplicate Duplicate of an existing issue/PR and removed type: bug A confirmed bug or unintended behavior S: needs triage Issues/PRs that need to be triaged labels Jul 3, 2023
@jparta
Copy link
Contributor Author

jparta commented Jul 3, 2023

Thanks. Good to know it's a known issue. I would appreciate if it's not given as an example in the documentation: https://pip.pypa.io/en/stable/topics/vcs-support/#git

MyProject @ git+file:///home/user/projects/MyProject

@uranusjr
Copy link
Member

uranusjr commented Jul 3, 2023

A pull request to temporarily remove the example would be appreciated. (Note the temporary part, we need to make sure to add it back when the issue is resolved)

@pfmoore
Copy link
Member

pfmoore commented Jul 3, 2023

In fact, rather than removing it (it's hard to see how to do that in a way that will prompt us to restore it when the underlying issue is fixed...) maybe just add a warning that this example is currently incorrect due to a bug - with a link to the discussion here?

@jparta
Copy link
Contributor Author

jparta commented Jul 3, 2023

I'm cooking up a PR

@jparta
Copy link
Contributor Author

jparta commented Jul 3, 2023

Pull request here: #12125

jparta added a commit to jparta/pip that referenced this issue Jul 4, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
resolution: duplicate Duplicate of an existing issue/PR
Projects
None yet
Development

No branches or pull requests

3 participants