Reputation: 127
I've successfully installed BeautifulSoup4 in 2.7 and 3.6 in the terminal, but when I use either Spyder or Jupyter Notebook, I get the following error when trying to import bs4 when using the Python 3.6 kernel
from bs4 import BeautifulSoup
ModuleNotFoundError: No module named 'bs4'
I've tried the following Terminal commands:
NB: I have created separate kernels for the two versions of python:
Any other solutions that I haven't tried or anything that I've obviously missed/misunderstood?
Thanks in advance for your help!
Upvotes: 3
Views: 1682
Reputation: 127
I figured out what was going wrong. So for anyone else running into this problem, I had to do the following:
Activate the environment (i.e. the Kernel for the python version) by using the terminal command:
$ source activate NAME_OF_YOUR_KERNEL
For which I typed in:
$ source activate py3.6
Install the target package using the terminal command:
$ conda install TARGET_PACKAGE_NAME
For which I typed in:
$ conda install beautifulsoup4
$ source deactivate NAME_OF_YOUR_KERNEL
For which I typed:
$ source deactivate py3.6
Upvotes: 2