[Answered ]-ImportError: No module named bs4 in django

1👍

You are running the script with Python2.7 (according to the traceback) while having beautifulsoup4 package installed in Python3.5 environment.

Adjust your run configuration to use Python3.5 to run the script.

👤alecxe

1👍

ok first thing, in your python 3 environment you have installed bs4, but in your python 2.7, you probably do not have. As you can see in your attached second screen, django is running on python 2.7.

I recommend using virtual environment, where you can have all of your dependencies personalized for single project. In fact, every project you are working on, should have its own separate virtualenv.

👤sebb

0👍

You’ve installed wrong Beautiful Soup package. The one that you installed is bs4

This is a dummy package managed by the developer of Beautiful Soup to prevent name squatting. The official name of PyPI’s Beautiful Soup Python package is beautifulsoup4.

The one that you need to install is beautifulsoup4. Which you should get with pip install beautifulsoup4 and not pip install bs4

Leave a comment