-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
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
- Have a local python package as a git repo in
/home/path_to_package/my_package/ - Make a pip-based virtual environment and activate it
echo "my_package @ git+file:///home/path_to_package/my_package/" > requirements.txtpip 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
- I agree to follow the PSF Code of Conduct.