Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when importing newspaper module

I'm trying to use the newspaper package on python 2 and I keep getting the error cannot import name images error when I download it.

I followed previous SO advice and created an image directory in /usr/local/lib/python2.7/site-packages/newspaper with the images.py and __init__.py files but it still doesn't work: ImportError when installing newspaper

The only difference between that advice and what I implemented is that I have site-packages instead of dist-packages. Any ideas?

like image 421
Fernando Hidalgo Avatar asked May 19 '26 09:05

Fernando Hidalgo


1 Answers

Newspaper has been deprecated for Python2 and it's a buggy version according to their official documentation. You should switch to Python3 version.

Installation on Python 3:

pip3 install newspaper3k

Newspaper is a Python3 library! Or, view our deprecated and buggy Python2 branch. Run : pip3 install newspaper3k and NOT pip3 install newspaper. On python3 you must install newspaper3k, not newspaper. newspaper is our python2 library. Although installing newspaper is simple with pip, you will run into fixable issues if you are trying to install on ubuntu.

like image 136
utengr Avatar answered May 21 '26 23:05

utengr



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!