Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing Python BeautifulSoup package with Homebrew on macOS

I installed Python on my macOS using Homebrew. Now, I'm attempting to use BeautifulSoup, so I executed the following command: brew install python-beautifulsoup4. However, I encountered a message stating, 'Warning: No available formula with the name python-beautifulsoup4.

What could be the issue here? How should I properly install and use this Python package?

like image 342
notGeek Avatar asked Nov 02 '25 17:11

notGeek


2 Answers

All forms of python3 -m pip install beautifulsoup4 or pip3 install beautifulsoup4 gave me the same error which the OP got as they mentioned in the comments:

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

I finally successfully installed it using this rather scary-looking argument:

pip3 install beautifulsoup4 --break-system-packages

Caution: I got this solution from Alok's answer ('How do I solve "error: externally-managed-environment" every time I use pip 3?') which says it shouldn't be overused. maciek97x's accepted answer over there explains it in detail.

like image 138
joeljpa Avatar answered Nov 04 '25 10:11

joeljpa


You should use pip to install BeautifulSoup4 with pip install beautifulsoup4 or pip3 install beautifulsoup4.

like image 36
Notscientific Farmer Avatar answered Nov 04 '25 08:11

Notscientific Farmer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!