You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to install a Python package in the user directory. According Python, user site is under my home directory:
$ python3
Python 3.12.4 (main, Jun 6 2024, 18:26:44) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import site
>>> site.USER_SITE
'/Users/tek30584/Library/Python/3.12/lib/python/site-packages'
Also:
$ pip3 --version
pip 24.2 from /opt/homebrew/lib/python3.12/site-packages/pip (python 3.12)
What happened (include all command output)?
$ pip3 install --user uv
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try brew install
xyz, where xyz is the package you are trying to
install.
If you wish to install a Python library that isn't in Homebrew,
use a virtual environment:
python3 -m venv path/to/venv
source path/to/venv/bin/activate
python3 -m pip install xyz
If you wish to install a Python application that isn't in Homebrew,
it may be easiest to use 'pipx install xyz', which will manage a
virtual environment for you. You can install pipx with
brew install pipx
You may restore the old behavior of pip by passing
the '--break-system-packages' flag to pip, or by adding
'break-system-packages = true' to your pip.conf file. The latter
will permanently disable this error.
If you disable this error, we STRONGLY recommend that you additionally
pass the '--user' flag to pip, or set 'user = true' in your pip.conf
file. Failure to do this can result in a broken Homebrew installation.
Read more about this behavior here: <https://peps.python.org/pep-0668/>
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
What did you expect to happen?
I expected the package to install under my home directory.
Oddly enough, the error message says:
You may restore the old behavior of pip by passing
the '--break-system-packages' flag to pip, or by adding
'break-system-packages = true' to your pip.conf file. The latter
will permanently disable this error.
If you disable this error, we STRONGLY recommend that you additionally
pass the '--user' flag to pip, or set 'user = true' in your pip.conf
file. Failure to do this can result in a broken Homebrew installation
The USER_SITE directory are not system packages; it is under my home directory
I did pass --user to use the user site directory, but it still generated the error.
It said "If you believe this is a mistake, please contact your Python installation or OS distribution provider." So I'm opening an issue. :)
FYI: This only shows up with 3.12. Using pip3.10 and pip3.11 seems to do the right thing.
$ python3.10
Python 3.10.15 (main, Sep 7 2024, 00:20:06) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import site
>>> site.USER_SITE
'/Users/tek30584/Library/Python/3.10/lib/python/site-packages'
and
$ python3.11
imPython 3.11.10 (main, Sep 7 2024, 01:03:31) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import site
>>> site.USER_SITE
'/Users/tek30584/Library/Python/3.11/lib/python/site-packages'
The text was updated successfully, but these errors were encountered:
Quick summary of that: we think this behaviour is really on upstream (Python/pip). Though they might point this back at us if you complain about this behaviour to them.
brew gist-logs <formula>
link ORbrew config
ANDbrew doctor
outputand
Verification
brew doctor
output saysYour system is ready to brew.
and am still able to reproduce my issue.brew update
and am still able to reproduce my issue.brew doctor
and that did not fix my problem.What were you trying to do (and why)?
I am trying to install a Python package in the user directory. According Python, user site is under my home directory:
Also:
What happened (include all command output)?
What did you expect to happen?
I expected the package to install under my home directory.
Oddly enough, the error message says:
--user
to use the user site directory, but it still generated the error.It said "If you believe this is a mistake, please contact your Python installation or OS distribution provider." So I'm opening an issue. :)
Step-by-step reproduction instructions (by running
brew
commands)FYI: This only shows up with 3.12. Using
pip3.10
andpip3.11
seems to do the right thing.and
The text was updated successfully, but these errors were encountered: