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

venv ends up in a broken state on focal #159

Closed
johnsca opened this issue Apr 1, 2020 · 1 comment · Fixed by #160
Closed

venv ends up in a broken state on focal #159

johnsca opened this issue Apr 1, 2020 · 1 comment · Fixed by #160

Comments

@johnsca
Copy link
Contributor

johnsca commented Apr 1, 2020

Focal includes a newer version of pip than we're bundling (20.0.2 vs 18.1) and the bootstrap logic ends up downgrading it in the venv. This is succeeds during the install hook, but on the first upgrade-charm hook it fails with:

Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-flannel-0/.venv/bin/pip", line 5, in <module>
    from pip._internal import main
  File "/var/lib/juju/agents/unit-flannel-0/.venv/lib/python3.8/site-packages/pip/_internal/__init__.py", line 40, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/var/lib/juju/agents/unit-flannel-0/.venv/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/var/lib/juju/agents/unit-flannel-0/.venv/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 12, in <module>
    from pip._internal.commands import (
  File "/var/lib/juju/agents/unit-flannel-0/.venv/lib/python3.8/site-packages/pip/_internal/commands/__init__.py", line 6, in <module>
    from pip._internal.commands.completion import CompletionCommand
  File "/var/lib/juju/agents/unit-flannel-0/.venv/lib/python3.8/site-packages/pip/_internal/commands/completion.py", line 6, in <module>
    from pip._internal.cli.base_command import Command
  File "/var/lib/juju/agents/unit-flannel-0/.venv/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 23, in <module>
    from pip._internal.index import PackageFinder
ImportError: cannot import name 'PackageFinder' from 'pip._internal.index' (/var/lib/juju/agents/unit-flannel-0/.venv/lib/python3.8/site-packages/pip/_internal/index/__init__.py)

Since the bundled pip (and setuptools) was there to work around an upstream pip bug due to bionic and below bundling pip < 10, we should just ignore the bundled pip when deploying on focal and above.

johnsca added a commit that referenced this issue Apr 1, 2020
Focal provides a newer version of pip (and setuptools) than what is
bundled, and downgrading it in the venv leads to it being broken. This
doesn't show until after the first bootstrap, so on the first
upgrade-charm hook. This skips installing pip and setuptools if pip is
already at a newer version in the venv.

Fixes #159
@johnsca
Copy link
Contributor Author

johnsca commented Apr 2, 2020

This is the cause of lp:1870134

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 a pull request may close this issue.

1 participant