If you installed python3 via brew, installing python libs globally is not allowed anymore:
pip3 install requests
Fails with the error: "This environment is externally managed"
brew install python-requests
Fails with the error: "Error: python-requests has been disabled because it does not meet homebrew/core's requirements for Python library formulae! It was disabled on 2024-06-23"
Solution: Luckily the solution is stated in the first error message, you have to create a virtual environment instead of a globally installed lib with:
python3 -m venv path/to/venv
source path/to/venv/bin/activate
python3 -m pip install requests
Answer from Simon Meyer on Stack OverflowIf you installed python3 via brew, installing python libs globally is not allowed anymore:
pip3 install requests
Fails with the error: "This environment is externally managed"
brew install python-requests
Fails with the error: "Error: python-requests has been disabled because it does not meet homebrew/core's requirements for Python library formulae! It was disabled on 2024-06-23"
Solution: Luckily the solution is stated in the first error message, you have to create a virtual environment instead of a globally installed lib with:
python3 -m venv path/to/venv
source path/to/venv/bin/activate
python3 -m pip install requests
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
So:
brew install pipx
then
pipx install requests --include-deps
Error: python-requests has been disabled because it does not meet homebrew/core's requirements for Python library formulae! It was disabled on 2024-06-23.
What does it mean and how do i install requests?
i have python 3.6.4.
I installed pip, and entered in terminial: "sudo pip install requests", and it tells me it's installed. But when I type "import requests" in python, it tells me "moduleNotFoundError: no module named'requests".
So I go back to terminal and try to install requests again, and it tells me "Requirement already satisfied: certifi>=2017.4.17 in /Library/Python/2.7/site-packages (from requests)" so it looks like requests has already been installed. But what's the reason i cant import requests in python? Is it because the version is too old?
update Looks like it's because I installed 2.7pip, which I shouldn't have, I would like to uninstall that 2.7pip but not sure how.
I would very much appreciate some help. Thanks!!