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
Avoid the Windows file lock by moving files to a trash directory #1133
Conversation
The trash mechanism should make this no longer necessary.
This avoids issues when the a file with the same name is already in the trash.
Also, don't raise exceptions in move_to_trash. Try the next envs dir, and if everything fails, we only log errors.
Known issue: a lot of "access is denied" errors are printed to the screen on installation. |
TODO:
|
This reverts commit 287b4a0. subprocess.DEVNULL is only available in Python 3.
The output is printed to the log.
An error I got changing Python versions:
I don't know if this is a bug in conda or if it's due to pulling out DLLs from under Python. |
I have no idea how to fix these mock tests. |
Annoyingly, the above error is only triggered if you don't use |
I've only seen it happen when moving from Python 2 to Python 3. Unfortunately, this is something that people try to do. |
Heh, so catching LookupError on that line fixes it. I'm still quite concerned, though. |
I just gave it a try on Windows XP, it updated from Python 2.7.7 to 2.7.9 without any problems. Great! |
Anyway, don't merge at least until all of these are checked off. |
Yes, testing is critical here, because otherwise people are likely to hose their installations. |
I've managed to complete the testing from the first checkbox (test envs dirs stuff), and I didn't run into any issues. It all seems to be working correctly. |
The two are related, but the pkgs dir is where we can actually expect to be able to write things.
With the new trash functionality, it is unnecessary.
It now uses Popen, and it isn't worth my time to figure out how to change these meaningless mock tests.
Otherwise the retries are on a delay timer, which would slow down the install.
Once we are sure there are no other issues with the trash stuff we can remove it again.
This is pretty much ready for merging. I have left the |
Looks great. Thanks for the effort Aaron. |
Avoid the Windows file lock by moving files to a trash directory
@asmeurer Does this apply to any package with binary modules, or only to Python, pycosat, and psutil? (Going to test this in a minute, but would like to know whether it's intended to work.) |
This applies to any packages, which contain files that are opened by a process and then not closed. So yes, any package with binary modules, but it could also be any other file which is open. |
Awesome :) |
Sometimes updating Python in the root environment on Windows raises this error. See conda#1657 and conda#1133.
Hi there, thank you for your contribution to Conda! This pull request has been automatically locked since it has not had recent activity after it was closed. Please open a new issue or pull request if needed. |
This lets you update Python, pycosat, and psutil in the root environment.
Conda moves all files that it can't delete to a trash directory. Conda attempts to clear the trash directory every time it links a package. This typically will not actually work until the next time conda is run.
Preliminary tests indicate this is working, but obviously it needs a lot more testing. If you do test, I highly recommend installing a new Miniconda, as the risk of borking your existing installation is still high.
Fixes #1001.