codelucas / newspaper

newspaper3k is a news, full-text, and article metadata extraction in Python 3. Advanced docs:
https://goo.gl/VX41yK
MIT License
14.04k stars 2.11k forks source link

installation error in Ubuntu 16.04 #677

Open shekharkoirala opened 5 years ago

shekharkoirala commented 5 years ago

I installed it using pip3 , looks good

shekhar@pc:~/Downloads$ sudo pip3 install newspaper3k
The directory '/home/shekhar/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/shekhar/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: newspaper3k in /usr/local/lib/python3.6/dist-packages (0.2.8)
Requirement already satisfied: tldextract>=2.0.1 in /usr/local/lib/python3.6/dist-packages (from newspaper3k) (2.2.0)
Requirement already satisfied: requests>=2.10.0 in /usr/local/lib/python3.6/dist-packages (from newspaper3k) (2.21.0)
Requirement already satisfied: feedparser>=5.2.1 in /usr/local/lib/python3.6/dist-packages (from newspaper3k) (5.2.1)
Requirement already satisfied: jieba3k>=0.35.1 in /usr/local/lib/python3.6/dist-packages (from newspaper3k) (0.35.1)
Requirement already satisfied: python-dateutil>=2.5.3 in /usr/local/lib/python3.6/dist-packages (from newspaper3k) (2.8.0)
Requirement already satisfied: nltk>=3.2.1 in /usr/local/lib/python3.6/dist-packages (from newspaper3k) (3.4)
Requirement already satisfied: PyYAML>=3.11 in /usr/local/lib/python3.6/dist-packages (from newspaper3k) (3.13)
Requirement already satisfied: lxml>=3.6.0 in /usr/local/lib/python3.6/dist-packages (from newspaper3k) (4.3.1)
Requirement already satisfied: feedfinder2>=0.0.4 in /usr/local/lib/python3.6/dist-packages (from newspaper3k) (0.0.4)
Requirement already satisfied: tinysegmenter==0.3 in /usr/local/lib/python3.6/dist-packages (from newspaper3k) (0.3)
Requirement already satisfied: beautifulsoup4>=4.4.1 in /usr/lib/python3/dist-packages (from newspaper3k) (4.4.1)
Requirement already satisfied: cssselect>=0.9.2 in /usr/local/lib/python3.6/dist-packages (from newspaper3k) (1.0.3)
Requirement already satisfied: Pillow>=3.3.0 in /usr/local/lib/python3.6/dist-packages (from newspaper3k) (5.4.1)
Requirement already satisfied: idna in /usr/local/lib/python3.6/dist-packages (from tldextract>=2.0.1->newspaper3k) (2.8)
Requirement already satisfied: requests-file>=1.4 in /usr/local/lib/python3.6/dist-packages (from tldextract>=2.0.1->newspaper3k) (1.4.3)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from tldextract>=2.0.1->newspaper3k) (20.7.0)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.6/dist-packages (from requests>=2.10.0->newspaper3k) (3.0.4)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in /usr/local/lib/python3.6/dist-packages (from requests>=2.10.0->newspaper3k) (1.24.1)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/dist-packages (from requests>=2.10.0->newspaper3k) (2018.11.29)
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.5.3->newspaper3k) (1.10.0)
Requirement already satisfied: singledispatch in /usr/local/lib/python3.6/dist-packages (from nltk>=3.2.1->newspaper3k) (3.4.0.3)

But testing in the python console , doesn't works

shekhar@pc:~/Downloads$ python3
Python 3.5.2 (default, Nov 12 2018, 13:43:14) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import newspaper3k
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'newspaper3k'
shekharkoirala commented 5 years ago
>>> import newspaper
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'newspaper'
Loquen commented 5 years ago

I'm also having this same issue. Installed with pip3 install newspaper3k on linux mint (v18.3). I'm getting the same error in the python console as well as when trying to import in my flask server.

codelucas commented 5 years ago

Interesting, thanks for filing guys @shekharkoirala I will try to reproduce this and investigate! 👍

codelucas commented 5 years ago

Be sure you import newspaper and not newspaper3k

codelucas commented 5 years ago

FYI your library is inside /usr/local/lib/python3.6/dist-packages, make sure the python version you are using references inside that directory.

Please type which python3 and paste me the output