Repository navigation
Closed
Labels
kind/bugSomething isn't working as expectedSomething isn't working as expected
Description
- I am on the latest Poetry version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvvoption).
- OS version and name: Windows 10
- Poetry version: 1.2.0a2
- Link of a Gist with the contents of your pyproject.toml file: Will publish if necessary for this issue, don't think it is.
Issue
When trying to poetry add a dependency or do poetry install or poetry update, the command fails with an error saying that the file does not exist. The file refers to the weel of any dependencies that need to be installed. However, the file actually does exist at the correct location, but is somehow not found by poetry. I think this is due to a leading \ in the path. I haven't looked at the code, but I use bash bundled with git-for-windows in Windows Terminal. I assume that has something to do with the problem.
This is the error message, you can see the leading backslash in the path which I think is the culprit:
ValueError
File \C:\Users\<user>\AppData\Local\pypoetry\Cache\artifacts\ac\59\ac\9fc6b3c55594c6a7395665b20538ee05fb2ade328e723d2761b44c70ca\typed_ast-1.4.3-cp37-cp37m-win_amd64.whl does not exist
at c:\users\<user>\appdata\roaming\pypoetry\venv\lib\site-packages\poetry\core\packages\file_dependency.py:41 in __init__
37│ except FileNotFoundError:
38│ raise ValueError("Directory {} does not exist".format(self._path))
39│
40│ if not self._full_path.exists():
→ 41│ raise ValueError("File {} does not exist".format(self._path))
42│
43│ if self._full_path.is_dir():
44│ raise ValueError("{} is a directory, expected a file".format(self._path))
45│
However, the file does exist:
❯ file "C:\Users\<user>\AppData\Local\pypoetry\Cache\artifacts\ac\59\ac\9fc6b3c55594c6a7395665b20538ee05fb2ade328e723d2761b44c70ca\typed_ast-1.4.3-cp37-cp37m-win_amd64.whl"
C:\Users\<user>\AppData\Local\pypoetry\Cache\artifacts\ac\59\ac\9fc6b3c55594c6a7395665b20538ee05fb2ade328e723d2761b44c70ca\typed_ast-1.4.3-cp37-cp37m-win_amd64.whl: Zip archive data, at least v2.0 to extract, compression method=deflate
Edit:
I get the same error using powershell, so it seems like the issue is not related to using bash.
Reacted by Nathan Vaughn, luis, Dan Gonzalez, bosbyj, Paul Kronenwetter, Nikolaus Waxweiler, guzuomuse, Matthew Messinger, Wouter Poncin, Ivo Flipse and 5 more
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't working as expectedSomething isn't working as expected
Activity
klnrdknt commentedon Sep 20, 2021
As of today I have the exact same problem. (Havent updated any package in a while, so might have been there earlier).
So far I've tried:
I am on the latest version of
poetry.serverwentdown commentedon Sep 21, 2021
The cause of the issue is in executor.py and core/packages/utils/link.py.
Links (file:///C:/Users...) are converted into absolute paths (/C:/Users...) without accounting for Windows.This issue only surfaces when using the cached local packages.
Fix cache URLs on Windows
fix: cache URLs on Windows
GoodiesHQ commentedon Sep 22, 2021
I am experiencing this exact issue on Poetry 1.1.10. I am using pyenv to manage my python versions, currently using the most recent available, 3.9.7. Not sure how to proceed other than to use pip for now and remake dependencies once this has been solved. Thank you for your PR! Hopefully it will be done shortly.
jonapich commentedon Oct 6, 2021
For anyone who ran into this and bricked their installation, here's how to fix it:
poetry cache cleardid not work, the leading\still appeared afterwards.)You can locate your cache folder by calling
poetry config --list.jonapich commentedon Oct 13, 2021
Unfortunately the fix was temporary on my end. Still running into this regularly and have to wipe the cache each time.
serverwentdown commentedon Oct 13, 2021
@jonapich try applying my patches at #4549
fix: cache URLs on Windows
fix: cache URLs on Windows
fix: Broken cache on Windows (#4531)
fix: Broken cache on Windows (python-poetry#4531)
aptmess commentedon Nov 15, 2021
For me this problem happens, when i tried to install package that was already installed and placed in
Cachefolder (for example, install dependencies for another project).Manually deleting folder
Cachesolves the problem on poetry version 1.11, but issue should be fixed in next version.dibog commentedon Nov 16, 2021
When will there be a fix for this?
serverwentdown commentedon Nov 16, 2021
@dibog Wait a while for the next release. In the meantime, you can install the branch with:
lock before broken windows cache
lululukas commentedon Dec 1, 2021
Is this also available in the preview version (1.2.x) yet? I want to keep using that version, but I really need this patch.
serverwentdown commentedon Dec 2, 2021
@lululukas You can adjust the command accordingly, replace
1.1withmasterlululukas commentedon Dec 3, 2021
Failed with
ERROR: Invalid requirement: 'git+git+https://github.com/python-poetry/poetry.git@master'.You have to remove the
git+so(Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py -UseBasicParsing).Content | python - --git https://github.com/python-poetry/poetry.git@masterworks.Thanks for the patch!
mbardwell commentedon Sep 15, 2023
I experienced something similar on Windows 11 trying to install Sphinx. The problem was fixed by enabling long path lengths.
My error
https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=powershell#enable-long-paths-in-windows-10-version-1607-and-later
github-actions commentedon Feb 29, 2024
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.