2

OS bsd 13.2 on dedicated rental server
csh terminal
python3.9.17 system and venv
Django 4.2.2

wanting to learn django, I set up a venv and installed django there. all good but at (django) pyweb@os3-286-32838:~/django/eigoweb % python3 manage.py runserver

things seem to be loading but it stalls at the end with...

 File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/pyweb/django/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py", line 9, in <module>
    from sqlite3 import dbapi2 as Database
  File "/usr/local/lib/python3.9/sqlite3/__init__.py", line 57, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/local/lib/python3.9/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'

while the venv is activated I tried to import sqlite3 from python3

>>> import sqlite3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/sqlite3/__init__.py", line 57, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/local/lib/python3.9/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'
>>> 

I get the same message with the system python. so.. the module is not there it seems

After reading several posts here I added PYTHONPATH in the venv to where there appeared to be sqlite3 module but it was not _sqlite3 so I guess that is the problem?

pyweb@os3-286-32838:~/django/lib/python3.9/site-packages % ls Django-4.2.2.dist-info            
dbrelmgr.py                 __pycache__
distutils-precedence.pth    _distutils_hack             django
antiorm-1.2.1.dist-info     pip
antiorm.py                  pip-23.1.2.dist-info
antipool.py                 pkg_resources
asgiref                     setuptools
asgiref-3.7.2.dist-info     setuptools-58.1.0.dist-info
db                          sqlparse
db-0.1.1.dist-info          sqlparse-0.4.4.dist-info
db_sqlite3-0.0.1.dist-info  typing_extensions-4.6.3.dist-info
db_sqlite3.py               typing_extensions.py
dbapiext.py

I installed sqlite3 with pip install sqlite3 from the venv but it installed on system level. That made no difference when trying to import sqlite3 to the python3 activated at system level. Same error message.

So sorry, the question may be worded poorly, full on noob here.Trying to learn.

Any tips, ideas would be greatly appreciated.

Razenstein
  • 3,532
  • 2
  • 5
  • 17
  • 1
    https://stackoverflow.com/questions/1210664/no-module-named-sqlite3 – stick Cour Jun 20 '23 at 07:33
  • (django) pyweb@os3-286-32838:~/django/eigoweb/eigoweb % python3 -m pip install sqlite3. ERROR: Could not find a version that satisfies the requirement sqlite3 (from versions: none). ERROR: No matching distribution found for sqlite3. from a different post, tried installing the module. (django) pyweb@os3-286-32838:~/django/eigoweb/eigoweb % python3 -m pip install _sqlite3. ERROR: Invalid requirement: '_sqlite3'. – lost in japan Jun 22 '23 at 09:18
  • tried to find venv/..../DLLs/ but failed. (django) pyweb@os3-286-32838:~/django % ls. bin include lib64 eigoweb lib pyvenv.cfg I dont see ...../DLLs – lost in japan Jun 22 '23 at 09:22
  • The comment from the contributor about the.... /DLLs/ was removed. Not sure but that may have been directed at windows install – lost in japan Jun 26 '23 at 03:20

0 Answers0