Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pip 21.1 can't import InvalidSchemeCombination

Tags:

At work, we use Github actions to build and test our Pull Requests before they can be approved. On Friday afternoon, everything was working just fine. On Monday morning, all tests were failing pretty early, with an error showing that pip could no longer find its own exceptions. Did something change with the newest Pip?

As you can see in the errors below, our own code isn't referenced, and I'm fairly certain nothing in our flow changed between Friday and Monday (we're a small team and the approved PRs don't have anything surprising there).

Error Traceback:

Traceback (most recent call last):     File "/opt/hostedtoolcache/Python/3.7.9/x64/bin/pip", line 5, in <module>       from pip._internal.cli.main import main     File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pip/_internal/cli/main.py", line 8, in <module>       from pip._internal.cli.autocompletion import autocomplete     File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>       from pip._internal.cli.main_parser import create_main_parser     File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>       from pip._internal.cli import cmdoptions     File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pip/_internal/cli/cmdoptions.py", line 22, in <module>       from pip._internal.cli.progress_bars import BAR_TYPES     File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pip/_internal/cli/progress_bars.py", line 9, in <module>       from pip._internal.utils.logging import get_indentation     File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pip/_internal/utils/logging.py", line 14, in <module>       from pip._internal.utils.misc import ensure_dir     File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pip/_internal/utils/misc.py", line 29, in <module>       from pip._internal.locations import get_major_minor_version, site_packages, user_site     File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pip/_internal/locations/__init__.py", line 9, in <module>       from . import _distutils, _sysconfig     File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pip/_internal/locations/_sysconfig.py", line 8, in <module>       from pip._internal.exceptions import InvalidSchemeCombination, UserInstallationInvalid   ImportError: cannot import name 'InvalidSchemeCombination' from 'pip._internal.exceptions' (/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/pip/_internal/exceptions.py) Error: The process '/opt/hostedtoolcache/Python/3.7.9/x64/bin/pip' failed with exit code 1 
like image 508
Zach Milan Avatar asked Apr 26 '21 20:04

Zach Milan


People also ask

How do I upgrade pip to a specific version?

Upgrade Or Downgrade To Specific Pip Version If you want to upgrade or downgrade your version of pip to a specific version on a Mac, you can do this by adding a pip==<version> flag to the end of your update command.

How do I install pip in Anaconda?

You can install pip in the current conda environment with the command conda install pip , as discussed in Using pip in an environment. If there are instances of pip installed both inside and outside the current conda environment, the instance of pip installed inside the current conda environment is used.


Video Answer


1 Answers

For macOS X, this problem happened to me after I upgraded my homebrew, What really worked for me is this,

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py 

then

python get-pip.py 

according to the discussion in the reference, it seems only pip version 21.1.1 fixed the problem.

Refer to the following discussion https://github.com/pypa/pip/issues/7217

like image 132
Dr Neo Avatar answered Sep 20 '22 23:09

Dr Neo