Skip to content
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

ci: pip: use installed version #6522

Closed
wants to merge 1 commit into from
Closed

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Jan 21, 2020

Currently fails with:

    Uninstalling pip-19.3.1:
      Successfully uninstalled pip-19.3.1
Successfully installed pip-20.0
Traceback (most recent call last):
  File "/opt/hostedtoolcache/PyPy/3.6.9/x64/bin/pip", line 8, in <module>
    sys.exit(main())
  File "/opt/hostedtoolcache/PyPy/3.6.9/x64/site-packages/pip/_internal/cli/main.py", line 73, in main
    command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
  File "/opt/hostedtoolcache/PyPy/3.6.9/x64/site-packages/pip/_internal/commands/__init__.py", line 96, in create_command
    module = importlib.import_module(module_path)
  File "/opt/hostedtoolcache/PyPy/3.6.9/x64/lib-python/3/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1003, in _gcd_import
  File "<frozen importlib._bootstrap>", line 980, in _find_and_load
  File "<frozen importlib._bootstrap>", line 964, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 674, in _load_unlocked
  File "<builtin>/frozen importlib._bootstrap_external", line 691, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/opt/hostedtoolcache/PyPy/3.6.9/x64/site-packages/pip/_internal/commands/install.py", line 24, in <module>
    from pip._internal.cli.req_command import RequirementCommand
  File "/opt/hostedtoolcache/PyPy/3.6.9/x64/site-packages/pip/_internal/cli/req_command.py", line 20, in <module>
    from pip._internal.operations.prepare import RequirementPreparer
  File "/opt/hostedtoolcache/PyPy/3.6.9/x64/site-packages/pip/_internal/operations/prepare.py", line 16, in <module>
    from pip._internal.distributions import (
  File "/opt/hostedtoolcache/PyPy/3.6.9/x64/site-packages/pip/_internal/distributions/__init__.py", line 1, in <module>
    from pip._internal.distributions.source import SourceDistribution
ImportError: cannot import name 'SourceDistribution'

Ref: https://github.com/pytest-dev/pytest/runs/400730404

@hugovk
Copy link
Member

hugovk commented Jan 21, 2020

It's already been reported to pip: pypa/pip#7620

@@ -122,7 +122,7 @@ jobs:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade "pip<20"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect 20.0.1 will be out with a fix soonish, how about?

Suggested change
python -m pip install --upgrade "pip<20"
python -m pip install --upgrade "pip!=20.0.0"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm more in favor to pinning it to some exact version instead: we should not get disrupted by issues through it, but rather bump it from time to time when feasible - it's just disruptive if it breaks suddenly.

Upgrading pip unnecessarily can be disruptive, e.g. when pip 20 breaks
[1].  This makes it more predictable, and a bit faster also.

1: pypa/pip#7620
@blueyed
Copy link
Contributor Author

blueyed commented Jan 21, 2020

Amended to just use the installed version.

@blueyed blueyed changed the title ci: pin pip: <20 ci: pip: use installed version Jan 21, 2020
@The-Compiler
Copy link
Member

I think upgrading pip is a good idea - and it looks like pip 20.0.1 fixing this is out already.

@blueyed
Copy link
Contributor Author

blueyed commented Jan 21, 2020

@The-Compiler

I think upgrading pip is a good idea

Why?

@The-Compiler
Copy link
Member

Often, CI environments do have quite outdated versions of pip (admittedly, I'm not sure about GitHub Actions though) - to the point where dependencies are non-installable or a wrong version is installed. One example that comes to mind is platform / python_version markers; another more recent one is manylinux2014 wheels.

@blueyed
Copy link
Contributor Author

blueyed commented Jan 21, 2020

@The-Compiler I see, but as can be seen here our image is fine.

@blueyed
Copy link
Contributor Author

blueyed commented Jan 22, 2020

@nicoddemus please approve, or close it.

@nicoddemus
Copy link
Member

nicoddemus commented Jan 22, 2020

Closing then, as in general it is recommended to always upgrade pip instead of using an installed version.

Of course this opens up the possibility of a pip upgrade being broken, but this is very very rare and usually fixed in hours, because it usually blows up the world.

@nicoddemus nicoddemus closed this Jan 22, 2020
@blueyed blueyed deleted the ci-pip branch January 22, 2020 11:46
blueyed added a commit to blueyed/pytest that referenced this pull request Jan 22, 2020
blueyed added a commit to blueyed/pytest that referenced this pull request Feb 9, 2020
blueyed added a commit to blueyed/pytest that referenced this pull request Feb 9, 2020
* ci: use installed pip, upgrade to pinned if necessary

Ref: pytest-dev#6522

* PIP_DISABLE_PIP_VERSION_CHECK=1
@blueyed
Copy link
Contributor Author

blueyed commented Mar 1, 2020

Just for reference: I've fixed Travis CI (for 3.5.1 though) two (or three) times now since then, which was caused due to package upgrades.

@blueyed blueyed mentioned this pull request Mar 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants