-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Upgrade pip after virtualenv is created #11149
Conversation
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @larsbergstrom (or someone else) soon. |
Heads up! This PR modifies the following files:
|
@campaul What problem is this addressing? Does an out of date pip cause problems? I'm a little worried about what will happen here if we're building and not connected to the network or even just that it might cause extra latency on a no-op build as it goes out to check for a new version of |
One alternative is add instructions to upgrade pip to the README.md. |
@larsbergstrom the build crashes if pip is out of date because pip fails to install mach. Manually updating pip right now is really cumbersome because you have to run mach, let it crash, then activate the virtualenv it created and then run the pip upgrade. What I would like to do instead of simply adding those instructions to the README is add a build target like |
@campaul I like that plan - sounds perfect! |
@campaul Are you still planning on doing this? Sorry if we're asking for too much work here - let me know if there's anything we can do to clarify or help! |
My proposed solution doesn't work as well as I imagined. The crash occurs during bootstraping, which is before args are parsed, so adding an At this point I want to go back to the strategy of asking the user to upgrade manually, but instead of asking them to upgrade pip ask them to upgrade virtualenv and exit before the virtualenv is even created. This completely avoids the problem of having a partially initialized virtualenv. I just need to go find what version of virtualenv started bundling a new enough pip so I know what version to check for. |
By trial and error I found that virtualenv 14.0.0 was the oldest version that works fine on Mac OS and Linux, so I changed the branch to check for older versions and exit with a message to upgrade. This happens before the the virtualenv is created so you're never left in a broken state. It would be more robust to use the |
And now I'm really confused. CI fails because my version check detects that virtualenv is too old, but clearly Travis is able to build master without issue so it must not be too old. |
@campaul Can you please change this to print out the version that was found? Sorry for the horrible delay in review, btw! Let me know if you want me to carry this through to landing! |
I'm fine continuing work on this. I'll make it print the version it found, but I also need to figure out how Travis CI manages to build with a version that's too old to work on my machine. |
☔ The latest upstream changes (presumably #13151) made this pull request unmergeable. Please resolve the merge conflicts. |
Is this still being worked on? |
Not at the moment. I never figured out a solution to the issues I mentioned and haven't had the time to investigate recently. |
superseded by #14253 |
…r=frewsxcv Commit that fixes the issue #11074 by upgrading pip whenever virtuale… <!-- Please describe your changes on the following line: --> I have kind of resolved the issue #11074 by adding bool variable which is set to `True` if we had created the virtualenv and `False` otherwise. Then it updates pip by executing `pip install --upgrade pip` in the same way as packages are updated. I am a little bit worried that I have almost duplicated the installation routine from the `for` loop but I am not sure whether I should add a function or not. I think it is the best way of doing this because it does not need any Internet access for regular work (only for the first time you execute mach) as @larsbergstrom worried [here](#11149). It also doesn't add any extra latency on a no-op build. I have checked the solution inside a docker container based on debian wheezy. Before the patch `./mach` failed to run because it wasn't able to install some packages. Now it runs successfully. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #11074 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because it changes only mach_bootstrap.py <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14452) <!-- Reviewable:end -->
… pip whenever virtuale… (from PeterZhizhin:upgrade-pip-with-new-virtualenv); r=frewsxcv <!-- Please describe your changes on the following line: --> I have kind of resolved the issue #11074 by adding bool variable which is set to `True` if we had created the virtualenv and `False` otherwise. Then it updates pip by executing `pip install --upgrade pip` in the same way as packages are updated. I am a little bit worried that I have almost duplicated the installation routine from the `for` loop but I am not sure whether I should add a function or not. I think it is the best way of doing this because it does not need any Internet access for regular work (only for the first time you execute mach) as @larsbergstrom worried [here](servo/servo#11149). It also doesn't add any extra latency on a no-op build. I have checked the solution inside a docker container based on debian wheezy. Before the patch `./mach` failed to run because it wasn't able to install some packages. Now it runs successfully. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #11074 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because it changes only mach_bootstrap.py <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: ea59e7bb68e83ac2631dcdad24f270bff68092eb
… pip whenever virtuale… (from PeterZhizhin:upgrade-pip-with-new-virtualenv); r=frewsxcv <!-- Please describe your changes on the following line: --> I have kind of resolved the issue #11074 by adding bool variable which is set to `True` if we had created the virtualenv and `False` otherwise. Then it updates pip by executing `pip install --upgrade pip` in the same way as packages are updated. I am a little bit worried that I have almost duplicated the installation routine from the `for` loop but I am not sure whether I should add a function or not. I think it is the best way of doing this because it does not need any Internet access for regular work (only for the first time you execute mach) as larsbergstrom worried [here](servo/servo#11149). It also doesn't add any extra latency on a no-op build. I have checked the solution inside a docker container based on debian wheezy. Before the patch `./mach` failed to run because it wasn't able to install some packages. Now it runs successfully. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #11074 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because it changes only mach_bootstrap.py <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: ea59e7bb68e83ac2631dcdad24f270bff68092eb UltraBlame original commit: ca239fcfa931c379dfc327af16e37358379f0fda
… pip whenever virtuale… (from PeterZhizhin:upgrade-pip-with-new-virtualenv); r=frewsxcv <!-- Please describe your changes on the following line: --> I have kind of resolved the issue #11074 by adding bool variable which is set to `True` if we had created the virtualenv and `False` otherwise. Then it updates pip by executing `pip install --upgrade pip` in the same way as packages are updated. I am a little bit worried that I have almost duplicated the installation routine from the `for` loop but I am not sure whether I should add a function or not. I think it is the best way of doing this because it does not need any Internet access for regular work (only for the first time you execute mach) as larsbergstrom worried [here](servo/servo#11149). It also doesn't add any extra latency on a no-op build. I have checked the solution inside a docker container based on debian wheezy. Before the patch `./mach` failed to run because it wasn't able to install some packages. Now it runs successfully. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #11074 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because it changes only mach_bootstrap.py <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: ea59e7bb68e83ac2631dcdad24f270bff68092eb UltraBlame original commit: ca239fcfa931c379dfc327af16e37358379f0fda
… pip whenever virtuale… (from PeterZhizhin:upgrade-pip-with-new-virtualenv); r=frewsxcv <!-- Please describe your changes on the following line: --> I have kind of resolved the issue #11074 by adding bool variable which is set to `True` if we had created the virtualenv and `False` otherwise. Then it updates pip by executing `pip install --upgrade pip` in the same way as packages are updated. I am a little bit worried that I have almost duplicated the installation routine from the `for` loop but I am not sure whether I should add a function or not. I think it is the best way of doing this because it does not need any Internet access for regular work (only for the first time you execute mach) as larsbergstrom worried [here](servo/servo#11149). It also doesn't add any extra latency on a no-op build. I have checked the solution inside a docker container based on debian wheezy. Before the patch `./mach` failed to run because it wasn't able to install some packages. Now it runs successfully. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #11074 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because it changes only mach_bootstrap.py <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: ea59e7bb68e83ac2631dcdad24f270bff68092eb UltraBlame original commit: ca239fcfa931c379dfc327af16e37358379f0fda
./mach build
does not report any errors./mach test-tidy
does not report any errorsEither:
This change is