-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
pipenv (patched pip) corrupts path for editable requirement on Windows #6068
Comments
Please try specifying the |
I also tried to specify path on command as |
Is it like this...
output
Same with an absolute path, but the exception text is |
Hmmm, I'll have to think on this more, just wondering though which shell, is it windows power shell? I want to be able to reproduce the issue. |
I used cmd.exe on Windows 10 initially. I just tried I don't know powershell stuff, printf debugging doesn't work well... That corrupting line is executed twice:
Also, even when I specify the absolute path on the same drive, it comes to this line as relative. If it's the same path and the relative is So the problem with Also, when I specify the absolute path on a different drive, I get this: command, output
It happens because here in pipenv the original absolute path I checked the cache dir which path is also corrupted: any recent files are related to my other work with pipenv where I don't use editable dependencies. |
example to reproduce:
this produces the error from the initial comment, with exception: |
@asrelo thanks for providing an example -- I am checking it out, but I do see that the local file install doesn't have a pyproject.toml, or setup.cfg or setup.py so technically I don't think its installable -- are you actually able to pip install that as a local package? |
There is Yes, cmd.exe session
upd: and it is actually editable |
git bash, cmd.exe and powershell are all working on mine:
🤔 Only change I made to your example was to allow python 3.11 so I wouldn't have to edit my PATH for the python3.10 version. |
I just tried with freshly installed Python 3.11.7 and pipenv 2023.11.17. The error was the same, only the traceback was fancier... I'll try to reproduce the example on a different machine soon (though |
Tried to reproduce with another person. The initial error with However,
Cache path gets corrupted too. We didn't try to specify a path on a different drive as in the comment, now I humbly assume there would be the same error as before. |
@asrelo I believe that is because the relative path is now the src directory which is missing the pyproject.toml (its in the parent). |
I mean, I have the fresh project dir at From within original project path, I run And absolute paths on different drives don't work as well. I expect that it should work because |
Hey all. I hit this same problem today and I see not much has happened with this ticket for a while. As a potential workaround for people, I found that instead of installing the local package using "pipenv install -e ../project" (which fails as per this issue ticket), you can add the following directly to your Pipfile: project_name_here = {editable = true, path = "../project"} Then run "pipenv install" |
Can you check out: #6276
|
I can't seem to replicate the original issue at the same versions 🗿 edit: nvm then |
Issue description
I try to install a package into pipenv's virtual environment as editable (either using relative path
pipenv install -e .
or absolute pathpipenv install -e D:\long\windows\path\project
). I get the error with a traceback with this exception:pipenv.patched.pip._internal.exceptions.InstallationError: D:longwindowspathproject is not a valid editable requirement. It should either be a path to a local project or a VCS URL...
. (Full traceback provided below.)With some adhoc debugging I found that the path is first resolved if it's relative, and then the absolute path gets corrupted (maybe not only) here (link):
While running
install -e ...
commands, this line executes twice:options_str == '-i https://pypi.org/simple C:\\Users\\user\\AppData\\Local\\pipenv\\pipenv\\Cache'
,options == ['-i', 'https://pypi.org/simple', 'C:UsersuserAppDataLocalpipenvpipenvCache']
options_str == '-e D:\\long\\windows\\path\\project'
options == ['-e', 'D:longwindowspathproject']
shlex.split
for some reason removes every backslash from a Windows path, I have tested it in IDLE. I have also tried to runpipenv install -e D:/long/windows/path/project
, no changes happened.When I tried to replicate it with just virtualenv and pip, this line in pip was never executed. (theories ahead) I suppose this is because pipenv creates a temporary
requirements.txt
to supply it to pip, and somehow it goes wrong. Maybe for local files it should use URLs withfile
scheme instead of plain absolute paths? ( hinted link)Steps to replicate
be on Windows (10)
have a Python project which already has associated virtual environment managed by pipenv (I created it with
python -m pipenv --python=<python-path>
at project root)3.1. from the root directory of the project, run
python -m pipenv install -e .
(as in docs)OR
3.2. run
python -m pipenv install -e <project-absolute-path>
Expected result
The package is installed into associated virtual environment as editable.
Actual result
The package is not installed, pipenv exits with an error, producing this:
long traceback
$ pipenv --support
Pipenv version:
'2023.11.17'
Pipenv location:
'C:\\Users\\user\\AppData\\Roaming\\Python\\Python310\\site-packages\\pipenv'
Python location:
'C:\\Program Files\\Python310\\python.exe'
OS Name:
'nt'
User pip version:
'23.3.2'
user Python installations found:
PEP 508 Information:
System environment variables:
...
PIP_DISABLE_PIP_VERSION_CHECK
PYTHONDONTWRITEBYTECODE
PIPENV_VENV_IN_PROJECT
PYTHONFINDER_IGNORE_UNSUPPORTED
Pipenv-specific environment variables:
PIPENV_VENV_IN_PROJECT
:1
Debug-specific environment variables:
PATH
:...;C:\Program Files\Python310\Scripts\;C:\Program Files\Python310\;...;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;...;C:\Users\user\AppData\Roaming\Python\Python310\Scripts;...;
Contents of
Pipfile
('D:\long\windows\path\project\Pipfile'):Contents of
Pipfile.lock
('D:\long\windows\path\project\Pipfile.lock'):The text was updated successfully, but these errors were encountered: