Issue
I'm trying to use beautiful soup however the python kernel can't find it in jypter. When running:
!pip3 list
!pip3 install BeautifulSoup4
from bs4 import BeautifulSoup
I receive this error:
Package Version
--------------- -------
beautifulsoup4 4.9.3
bs4 0.0.1
numpy 1.20.1
pandas 1.2.3
pip 21.0.1
python-dateutil 2.8.1
pytz 2021.1
setuptools 53.0.0
six 1.15.0
soupsieve 2.2
wheel 0.36.2
Requirement already satisfied: BeautifulSoup4 in /usr/local/lib/python3.9/site-packages (4.9.3)
Requirement already satisfied: soupsieve>1.2 in /usr/local/lib/python3.9/site-packages (from BeautifulSoup4) (2.2)
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-11-c89f195c7568> in <module>
1 get_ipython().system('pip3 list')
2 get_ipython().system('pip3 install BeautifulSoup4')
----> 3 from bs4 import BeautifulSoup
4 print("scapy time")
5 for url in stillAlive:
beautiful soup is also installed outside of jupyter through pip
Solution
Jupiter notebook was not pointing at the correct pip packages. To resolve this I placed this at the top of my code:
import sys
sys.path.append("/usr/local/lib/python3.9/site-packages")
Answered By - Osian
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.