-
-
Notifications
You must be signed in to change notification settings - Fork 481
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
Add a lock around running pip #21672
Comments
comment:1
I might have run into something like this when doing an incremental build from 7.4.beta6 to 7.4.rc0. I was getting failures trying to build a bunch of pip packages (e.g. alabaster). Although I did a |
comment:2
Replying to @tscrim:
The building of Python packages now involves uninstalling the packages first. See #21441.
Or it further proves my hypothesis that the problems happen only while uninstalling a package. If you do |
This comment has been minimized.
This comment has been minimized.
comment:4
I'm inclined to think we need some kind of lock around running Jeroen is right that this specific issue was egg-related. I don't know if there are other similar issues that could occur though even without eggs. |
comment:5
Replying to @embray:
Or a
in the right place. But then you have to understand the code better. |
comment:6
I specifically meant without patching anything (i.e. something at the level of |
comment:8
Good, I'm glad this was caught. On an incremental build from 7.4.beta6 to 7.4.rc0 I guess I had to type New commits:
|
Commit: |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:10
This patch seems to fix the issues within Sage. Erik, what do you think? |
Author: Jeroen Demeyer |
This comment has been minimized.
This comment has been minimized.
comment:13
Any idea how to interpret this traceback?
Why does it refer to files in |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:15
Answering my own question:
So |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:18
OK, I needed a few iterations to get this right. But now it seems to work. The way I tested this:
|
Changed reviewer from Erik Bray to Erik Bray, Volker Braun |
comment:46
Three things:
Since I have experience with the fasteners module I can take that over if you want. |
comment:47
Sounds good to me but would be nice to do on another ticket so that we can release 7.4 |
comment:48
Is there some rush? I can work on this now. And I imagine you're going to do another RC right? |
comment:49
Replying to @embray:
That's exactly what I did. |
comment:50
Replying to @jdemeyer:
Yeah, I see that now. I think what I meant is if using |
comment:51
Replying to @embray:
I don't think that having few scripts should be a goal by itself. |
comment:52
Replying to @embray:
Well, it is portable to most UNIX-like operating systems. I don't think that there is a system on which Sage runs which does not have That being said, I am not against using fasteners, but I agree with Volker that it's something which can be done in the future. |
comment:53
Since this has come up before with setuptools, what if instead of making this lock script pip-specific we just make it general? After all, there's virtually nothing in it specific to pip. |
comment:54
Replying to @embray:
Well, there are still various mentions of
|
comment:55
Yeah but clearly none of that has to be hard-coded for pip. It could wrap any command. |
comment:56
Replying to @embray:
Of course it could, at the expense of making the script and the calling of the script more complicated. I don't care much about this. If you feel like generalizing the script, go for it. Just not on this blocker ticket. |
comment:57
Another relevant question: is this locking something that would have a chance to get accepted upstream (of course, not with this implementation and we would need to support Windows too)? Since the race conditions seem to be mostly in |
comment:58
I don't know. I leave it your hands. |
comment:59
Replying to @jdemeyer:
I'm barely talking about anything more than making the first argument the script (where the "SHARED" thing really ought to be a simple flag like |
Changed branch from u/jdemeyer/race_condition_in_pkg_resources to |
comment:61
It seems like this issue puts using |
Changed commit from |
comment:62
Replying to @jhpalmieri:
I do care but this problem really needed fixing. I honestly tried hard to fix it by different means (look at the comments on this ticket) but I did not manage. But yes, it is certainly a regression. |
comment:63
So should we consider changing the installation methods for certain packages which take a relatively long time to build, like |
comment:64
Replying to @jhpalmieri:
I would rather focus on fixing the problem at the level of |
Just like
setuptools
(#13201),pkg_resources
(vendored bypip
or stand-alone) has race conditions when building in parallel.First race condition:
The same error can also happen in the non-vendored
pkg_resources
package, which is part ofsetuptools
.Second race condition:
Some vendored packages inside
pip
conditionally import certain packages. One example fromlocal/lib/python/site-packages/pip/_vendor/requests/certs.py
:This is bad because it can happen that we are (un)installing
certify
while running a different instance ofpip
.Third race condition:
The file
local/bin/pip
contains the lineIt turns out that
pkg_resources
actually imports the packageszope
andmpl_toolkit
(from matplotlib) due to these packages having.pth
files. This is again a race condition.Note: it seems that these race conditions only happen while uninstalling a package.
CC: @embray
Component: build
Author: Jeroen Demeyer
Branch:
75c1fff
Reviewer: Erik Bray, Volker Braun
Issue created by migration from https://trac.sagemath.org/ticket/21672
The text was updated successfully, but these errors were encountered: