Closed anetbnd closed 1 day ago
I do not think that we want to add special handling for long paths on Windows because it makes things complicated. For example, iirc you have to pay attention that both paths (or none) are prefixed with \\?\
when using relative_to
.
If you need support for long paths, your best option is to set the registry key as described in Enable Long Paths in Windows 10, Version 1607, and Later.
Its my working computer, I don't have administrator rights and I don't have access to the registry.
This simply means, you don't want that certain users are able to use your software. There is no real workaround available, if you don't have access to a different system. Then please document clearly on the first page, that windows is not fully supported by poetry and there might be issues in certain cases when using windows.
Its my working computer, I don't have administrator rights and I don't have access to the registry.
This simply means, you don't want that certain users are able to use your software. There is no real workaround available, if you don't have access to a different system. Then please document clearly on the first page, that windows is not fully supported by poetry and there might be issues in certain cases when using windows.
You could use symlinks then. Just mklink /d C:/Users/your_user/your_very_long_project_path C:/Users/your_user/shortcut_to_project
. Now, just use the newly created symlink instead of the long project path. It isn't perfect, but it will work in your case.
Its my working computer, I don't have administrator rights and I don't have access to the registry. This simply means, you don't want that certain users are able to use your software. There is no real workaround available, if you don't have access to a different system. Then please document clearly on the first page, that windows is not fully supported by poetry and there might be issues in certain cases when using windows.
You could use symlinks then. Just
mklink /d C:/Users/your_user/your_very_long_project_path C:/Users/your_user/shortcut_to_project
. Now, just use the newly created symlink instead of the long project path. It isn't perfect, but it will work in your case.
Yeah, it would be a dirty workaround, messing up with the file system and installation paths.
But actually we found a simpler solution: We substituted poetry
with pdm
, because pdm
can handle long path names and is otherwise more or less the same as poetry
.
@radoering I think this can be closed.
For future reference: If you have issues with long paths on Windows, you can Enable Long Paths in Windows or configure Poetry to use locations with shorter paths.
Description
When I install a package from git on windows by doing
poetry add git+https://github.com/BerriAI/litellm.git
, I get an error:Where
<path to the python env>
is just a placeholder for a longer base path to my python environment. If I do the same on Mac, it works without issues.What I think is, that the path is just too long for windows. Because Windows only supports path up to 260 characters. If you want to use paths longer than that you have to use the prefix
\\?\
, which allows path to up to 32.000 characters. See: https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registryIf I run the command with
-vvv
, I get the following output:I think
poetry
must add the prefix for long windows paths to thesource_root
(or base path) where it wants the git clone operation to take part.In my code, which needs to run on different systems, I often use a function like that:
Here it is necessary to make the path absolute, since the prefix only works with absolute paths.
Workarounds
I can install the package by pip directly and run operations like
poetry lock
on a linux client. But this is not a workaround for everyone.Poetry Installation Method
pip
Operating System
Windows 11
Poetry Version
Poetry (version 1.8.3)
Poetry Configuration
Python Sysconfig
Example pyproject.toml
Poetry Runtime Logs