2

I'm using Python3.4, I recently upgraded from python 3.3.2.

I'm following these instructions on how to install newspaper which is a python library/tool.

https://github.com/codelucas/newspaper

I'm getting errors after executing this command:

curl https://raw.githubusercontent.com/codelucas/newspaper/master/download_corpora.py | python3

Note: I've also specified python3.4 in the above command and I'm getting the same/following output/error:

import sqlite3
  File "/usr/local/lib/python3.4/sqlite3/__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/local/lib/python3.4/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: No module named '_sqlite3'
[root@neil bin]# curl https://raw.githubusercontent.com/codelucas/newspaper/master/download_corpora.py | python3.4
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   657  100   657    0     0    206      0  0:00:03  0:00:03 --:--:--   206
Traceback (most recent call last):
  File "<stdin>", line 6, in <module>
  File "/usr/local/lib/python3.4/site-packages/nltk/__init__.py", line 137, in <module>
    from nltk.stem import *
  File "/usr/local/lib/python3.4/site-packages/nltk/stem/__init__.py", line 29, in <module>
    from nltk.stem.snowball import SnowballStemmer
  File "/usr/local/lib/python3.4/site-packages/nltk/stem/snowball.py", line 24, in <module>
    from nltk.corpus import stopwords
  File "/usr/local/lib/python3.4/site-packages/nltk/corpus/__init__.py", line 66, in <module>
    from nltk.corpus.reader import *
  File "/usr/local/lib/python3.4/site-packages/nltk/corpus/reader/__init__.py", line 105, in <module>
    from nltk.corpus.reader.panlex_lite import *
  File "/usr/local/lib/python3.4/site-packages/nltk/corpus/reader/panlex_lite.py", line 15, in <module>
    import sqlite3
  File "/usr/local/lib/python3.4/sqlite3/__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/local/lib/python3.4/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: No module named '_sqlite3'

So i've had a look in /usr/local/lib/python3.4/sqlite3/dbapi2.py

and this script does try to import from _sqilte3 :

from _sqlite3 import *

I removed the underscore and tried the original curl command again, but that then causes different errors, so I deduce that isn't the answer.

Does anyone know what might be going on here?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
treetop
  • 165
  • 1
  • 13
  • Possible duplicate of [No module named \_sqlite3](http://stackoverflow.com/questions/1210664/no-module-named-sqlite3) – Josh Lee Feb 15 '17 at 15:25

1 Answers1

5

sqlite3 is the python module (written in python) to wrap _sqlite3 (a c module) to make it look more pythonic.

Apparently you are missing the binary module, so you can't import from there. Changing the import string will give you many errors because those modules are actually distinct. Try to reinstall python, at least for me the _sqlite3 binary module is owned by python itself.

Sekuraz
  • 548
  • 3
  • 15