ImportError - BeautifulSoup4 - using Pandas on Spyder

540 views
Skip to first unread message

Florin-Daniel Cioloboc

unread,
Jul 16, 2016, 8:32:57 AM7/16/16
to spyder

Hello everyone,



I'm quite new to Spyder as I've only installed it very recently.


For some point in my tutorial for Data Science, I had the task of loading a table into pandas.


Here is the script I'm using so far:


import pandas as pd
from bs4 import BeautifulSoup

url
= 'http://espn.go.com/nhl/statistics/player/_/stat/points/sort/points/year/2015/seasontype/2'
df
= pd.read_html(url)

But I get the following error which ends in:


"BeautifulSoup4 (bs4) not found, please install it")
ImportError: BeautifulSoup4 (bs4) not found, please install it


But the thing is, the tutorial didn't a mention whether pandas is capable of getting a table from a website in this manner, 
therefore I
might be completely wrong.

 

My configuration is built on Linux, where I'm using pip, and through it I've successfully installed spyder, numpy, scipy, pandas, bs4., html5lib, lxml.


The thing is, if I simply import and run the script with bs4 or pandas, I don't get any errors but when I'm trying to use read_html, I'm getting that error.

Not sure where the problem is in this case.



Best,

Florin


Joseph Martinot-Lagarde

unread,
Jul 18, 2016, 9:46:00 AM7/18/16
to spyder
It looks like you're not using the same spyder version inside and outside spyder, that's why it doesn't find the bs4 module.. Please check that the python version is correct in Preferences > Console > Advanced options.
How did you install pyhton and spyder ? A link to you tutorial could help too (if possible).

Joseph
Reply all
Reply to author
Forward
0 new messages