-
Notifications
You must be signed in to change notification settings - Fork 52
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
Figure out how to handle long paths on Windows #588
Comments
@jaimergp since you are our conda-forge wizard I'd like to hear what you'd suggest here. At a first glance it seems the easiest path would be to replace/shorten the hash used (UUID). |
It would be useful to get a feel for how long real-world paths are in packages on Windows. How hard would it be to compute a list of
for every Windows package on conda-forge? |
Some Jupyter stuff can get easily in the hundred characters (e.g. |
I would say that it should be a pre-requisite for Windows users to enable long paths and be in a recent enough Windows versions (this can be done with a script we ship). Alternatively, if the users cannot do that (e.g. insufficient permissions, locked Windows versions), we can provide a global parameter to shorten the UUIDs to a certain amount while informing of the collision risks. These users should also be instructed to install to a very short path (e.g. |
For clarify, the longest path in that package is
which is 122 characters.
IIRC, the error I saw was coming from conda somewhere. So conda doesn't completely take care of this internally. If it did, I suppose this wouldn't be an issue. I can try to reproduce the problem to see the full traceback if that helps. |
Long paths can also be an issue on other platforms. For me, the
In other words, some package can't be installed because it has a has a placeholder prefix of 255 characters, which is shorter than the install prefix. So I think we should definitely shorten/remove the hash from the env path. It's way too problematic. |
My take is that this hash doesn't need to be cryptographically secure, it is just to make collisions of environments less likely. I would personally be in favor of truncating the has to 8 characters and adding the datetime, or hashing the sha of the environment plus the datetime and truncating that hash to 8 characters. Either way, that should result in a pretty significant shortening of the path. |
@nkaretnikov needs to take a look on this. Research needed. |
We are looking at two separate issues related to paths here:
|
I have created more issues to split this problem in actionable items, all of them covered by this meta: #650 IMO this issue should be focused on the following subset:
|
The extended-length path prefix |
One possible workaround we haven't considered yet. Windows has a command to map directories to letter drives (e.g. We could use that to dramatically shorten the path used, or at least mention it in the documentation (drives are very visible on Windows, so some users might not like that permanent drive in their "My Computer"). |
Status update: I need to read through the proposals here again and propose the final plan that we're going to implement |
@jaimergp To address the Windows-specific limitation (this issue), I propose we implement the For completeness, I'll mention that other things discussed above have already been addressed:
|
Sure, this needs to be done but as I mentioned above, it's not a final solution either. See this comment upstream. So I'd say yes, let's proceed but:
Let me know if you need further clarification. |
Yeah, I meant the standard way we set options, via traitlets. |
Context
This was originally discussed at #559 (comment)
Windows support is still in progress (#559), but an issue that comes up is that Windows by default has a filesystem path length limit of 260 characters. You end up with errors like
See https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation
It is possible to remove this limitation in Windows 10 and later if you set a registry value https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry#enable-long-paths-in-windows-10-version-1607-and-later. However, this (presumably) requires administrator privileges so I don't know if it's a viable thing to require.
The exact length of the path depends on the specific conda package. However, it's pretty obvious that the issue is the long UUID generated by conda-store:
99108419ad0fd922fdeff9bbc434b58d41f68e3f923a83f6a7ab19568463bc82-20230915-201619-848782-1-test
. That's 90 characters (plus the 4 character environment name). Shortening or removing this UUID from the path would solve the issue for this specific package. One could also store the environment closer to the root (see also #554). However, I'm not really sure what the longest "real world" path in a conda package is. The conda issue mentions that this has been fixed upstream in many conda-forge packages with longer paths, but I don't know just how long of a path is considered "OK" for a Windows conda package, but it's still something that could pop up even if we fix both of those things. At that point, that would probably be considered an upstream issue with conda and/or the specific package, but it's worth being aware of this problem.This is a known issue in conda. See conda/conda#7203.
Based on this comment, conda/conda#7203 (comment), if we want to try to make the path no longer than a typical conda install default, the part of the path between
C:\Users\Username
and the individual package files (like\Lib\site-packages\...
) should be no longer than\AppData\Local\conda\conda\pkgs
, which is 31 characters. But\.conda-store\conda-store-state
, as proposed in #554, is already 31 characters.It might be possible to try a scheme where we store packages in paths with very short hashes. But otherwise, we might just have to require people to set that registry key if they want to use things on Windows.
Value and/or benefit
Some packages inherently have long paths in them, and this would make them unusable on Windows. I haven't done a thorough investigation of how long the longest paths are on various packages on Windows, but this could be something that could be done.
Anything else?
Regardless of what we do, we need to make sure error messages are properly shown to the user (but this is sort of moot at this point because Windows support itself is still not truly functional).
The text was updated successfully, but these errors were encountered: