pip: Assertion Error: assert not (home and prefix)
Environment
- pip version: 20.1.1
- Python version: 3.8.3
- OS: Windows 10
PIP_CACHE_DIR = D:\Environments\Python\pip cache dir PIP_TARGET = D:\Environments\Python\Lib\site-packages
Description
A weird error when I tried to install pyinstaller
Expected behavior install normally
How to Reproduce
pip install pyinstaller
Output
Collecting pyinstaller
Using cached PyInstaller-3.6.tar.gz (3.5 MB)
Installing build dependencies ... error
ERROR: Command errored out with exit status 2:
command: 'd:\environments\python\python.exe' 'd:\environments\python\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'D:\Environments\TEMP\pip-build-env-siqaoa6a\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel
cwd: None
Complete output (22 lines):
Collecting setuptools>=40.8.0
Using cached setuptools-47.1.1-py3-none-any.whl (583 kB)
Collecting wheel
Using cached wheel-0.34.2-py2.py3-none-any.whl (26 kB)
Installing collected packages: setuptools, wheel
ERROR: Exception:
Traceback (most recent call last):
File "d:\environments\python\lib\site-packages\pip\_internal\cli\base_command.py", line 188, in _main
status = self.run(options, args)
File "d:\environments\python\lib\site-packages\pip\_internal\cli\req_command.py", line 185, in wrapper
return func(self, options, args)
File "d:\environments\python\lib\site-packages\pip\_internal\commands\install.py", line 398, in run
installed = install_given_reqs(
File "d:\environments\python\lib\site-packages\pip\_internal\req\__init__.py", line 67, in install_given_reqs
requirement.install(
File "d:\environments\python\lib\site-packages\pip\_internal\req\req_install.py", line 769, in install
scheme = get_scheme(
File "d:\environments\python\lib\site-packages\pip\_internal\locations.py", line 185, in get_scheme
scheme = distutils_scheme(
File "d:\environments\python\lib\site-packages\pip\_internal\locations.py", line 118, in distutils_scheme
assert not (home and prefix), "home={} prefix={}".format(home, prefix)
AssertionError: home=D:\Environments\TEMP\pip-target-wydanjze prefix=D:\Environments\TEMP\pip-build-env-siqaoa6a\overlay
----------------------------------------
ERROR: Command errored out with exit status 2: 'd:\environments\python\python.exe' 'd:\environments\python\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'D:\Environments\TEMP\pip-build-env-siqaoa6a\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel Check the logs for full command output.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 8
- Comments: 15 (3 by maintainers)
Links to this issue
Commits related to this issue
- Bump the dependabot group across 1 directory with 3 updates (#309) Bumps the dependabot group with 3 updates in the / directory: [pip](https://github.com/pypa/pip), [setuptools](https://github.com/py... — committed to google/scaaml by dependabot[bot] 2 years ago
- Bump pip from 24.2 to 24.3.1 (#9562) Bumps [pip](https://github.com/pypa/pip) from 24.2 to 24.3.1. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/pypa/pip/blob... — committed to aio-libs/aiohttp by dependabot[bot] 2 years ago
- Bump pip from 24.2 to 24.3.1 (#9564) Bumps [pip](https://github.com/pypa/pip) from 24.2 to 24.3.1. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/pypa/pip/blob... — committed to aio-libs/aiohttp by dependabot[bot] 2 years ago
- chore(deps-dev): Bump pip from 24.2 to 24.3.1 in /packages/jsii-pacmak/test/generated-code (#4682) Bumps [pip](https://github.com/pypa/pip) from 24.2 to 24.3.1. <details> <summary>Changelog</summary>... — committed to aws/jsii by dependabot[bot] 2 years ago
- chore(deps): Update pip requirement from ~=24.2 to ~=24.3 in /packages/@jsii/python-runtime (#4684) Updates the requirements on [pip](https://github.com/pypa/pip) to permit the latest version. <detai... — committed to aws/jsii by dependabot[bot] 2 years ago
- Bump pip from 24.2 to 24.3.1 (PR #8279) Bumps [pip](https://github.com/pypa/pip) from 24.2 to 24.3.1. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/pypa/pip/b... — committed to inmanta/inmanta-core by dependabot[bot] 2 years ago
- Bump pip from 24.2 to 24.3.1 (PR #8281) Bumps [pip](https://github.com/pypa/pip) from 24.2 to 24.3.1. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/pypa/pip/b... — committed to inmanta/inmanta-core by dependabot[bot] 2 years ago
- ci: bump pip from 24.2 to 24.3.1 in /.github/workflows (#48) Bumps [pip](https://github.com/pypa/pip) from 24.2 to 24.3.1. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="http... — committed to MeltanoLabs/tap-gohighlevel by dependabot[bot] 2 years ago
- ci: Bump the ci group in /.github/workflows with 2 updates (#142) Bumps the ci group in /.github/workflows with 2 updates: [pip](https://github.com/pypa/pip) and [hatch](https://github.com/pypa/hatch... — committed to reservoir-data/tap-canny by dependabot[bot] 2 years ago
- chore(deps): Bump pip from 24.2 to 24.3.1 (#2044) Bumps [pip](https://github.com/pypa/pip) from 24.2 to 24.3.1. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.... — committed to kai687/sphinxawesome-theme by dependabot[bot] 2 years ago
- Bump pip from 24.2.0 to 24.3.1 (#204) Bumps [pip](https://github.com/pypa/pip) from 24.2.0 to 24.3.1. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/pypa/p... — committed to Ouranosinc/miranda by Zeitsperre 2 years ago
- Bump the dependabot group across 1 directory with 7 updates (#65) Bumps the dependabot group with 7 updates in the / directory: | Package | From | To | | --- | --- | --- | | [packaging](https://gith... — committed to google/sedpack by dependabot[bot] 2 years ago
- Update pip requirement from <24.3,>=24.1.1 to >=24.1.1,<24.4 (#193) Updates the requirements on [pip](https://github.com/pypa/pip) to permit the latest version. <details> <summary>Changelog</summa... — committed to torbennehmer/hacs-e3dc by torbennehmer 2 years ago
I was getting a similar error with pip 22.3 & Python 3.7.3 on Windows 10:
ERROR: Cannot set --home and --prefix together.The work around was to remove
targetfrom theglobalfield in fileC:\Users\<USER>\AppData\Roaming\pip\pip.iniand provide the target as a CLI argument to pip install:--target path\to\site-packages.This was fixed by #12744, so closing.
I had this problem now too while installing a local package like this:
python3 -m pip install -U .I have thePIP_TARGETvariable set, which seems to be the culprit. However, I was able to workaround this, by building a wheel first and then installing the wheel:pip 21.2.4 / python 3.9.7 I also tested with 22.0.4 but the only difference is the new shiny error message (they look really good! But do not solve the issue 😅)
I had a similar issue and solved it with the sudo’s -H flag:
sudo -H pip install pyinstallerBut it works if
--targetis specified via command line (since this wayPIP_TARGETdoesn’t get propagated to the subprocess):The closest alternatives are
--prefix(PIP_PREFIX), and--root(doesn’t work with an environment variable either).P.S. Make sure to set
PYTHONPATH=site-packagesor something to be able to import the packages.Hi @McSinyx, I did not use
--prefix. I do not understand why this error happens as well. It installs successfully if I remove thePIP_TARGETenvironment variables. I also have other environment variables set, not sure if they are related: