Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

failing to runserver - ImportError: No module named 'pysqlite2' #20

Open
idannik opened this issue Aug 18, 2018 · 0 comments
Open

failing to runserver - ImportError: No module named 'pysqlite2' #20

idannik opened this issue Aug 18, 2018 · 0 comments

Comments

@idannik
Copy link

idannik commented Aug 18, 2018

Hi,
I tried to run the django server. However I get the following error :
ImportError: No module named 'pysqlite2'
full log below.

What can be the cause of this error?

Traceback (most recent call last):
File "/home/idan/.pyenv/versions/productionready/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py", line 34, in
from pysqlite2 import dbapi2 as Database
ImportError: No module named 'pysqlite2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/idan/.pyenv/versions/productionready/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py", line 36, in
from sqlite3 import dbapi2 as Database
File "/home/idan/.pyenv/versions/3.5.2/lib/python3.5/sqlite3/init.py", line 23, in
from sqlite3.dbapi2 import *
File "/home/idan/.pyenv/versions/3.5.2/lib/python3.5/sqlite3/dbapi2.py", line 27, in
from _sqlite3 import *
ImportError: No module named '_sqlite3'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "manage.py", line 22, in
execute_from_command_line(sys.argv)
File "/home/idan/.pyenv/versions/productionready/lib/python3.5/site-packages/django/core/management/init.py", line 367, in execute_from_command_line
utility.execute()
File "/home/idan/.pyenv/versions/productionready/lib/python3.5/site-packages/django/core/management/init.py", line 341, in execute
django.setup()
File "/home/idan/.pyenv/versions/productionready/lib/python3.5/site-packages/django/init.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/idan/.pyenv/versions/productionready/lib/python3.5/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/home/idan/.pyenv/versions/productionready/lib/python3.5/site-packages/django/apps/config.py", line 199, in import_models
self.models_module = import_module(models_module_name)
File "/home/idan/.pyenv/versions/3.5.2/lib/python3.5/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 673, in _load_unlocked
File "", line 665, in exec_module
File "", line 222, in _call_with_frames_removed
File "/home/idan/.pyenv/versions/productionready/lib/python3.5/site-packages/django/contrib/auth/models.py", line 4, in
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/home/idan/.pyenv/versions/productionready/lib/python3.5/site-packages/django/contrib/auth/base_user.py", line 52, in
class AbstractBaseUser(models.Model):
File "/home/idan/.pyenv/versions/productionready/lib/python3.5/site-packages/django/db/models/base.py", line 119, in new
new_class.add_to_class('_meta', Options(meta, app_label))
File "/home/idan/.pyenv/versions/productionready/lib/python3.5/site-packages/django/db/models/base.py", line 316, in add_to_class
value.contribute_to_class(cls, name)
File "/home/idan/.pyenv/versions/productionready/lib/python3.5/site-packages/django/db/models/options.py", line 214, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/home/idan/.pyenv/versions/productionready/lib/python3.5/site-packages/django/db/init.py", line 33, in getattr
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/home/idan/.pyenv/versions/productionready/lib/python3.5/site-packages/django/db/utils.py", line 211, in getitem
backend = load_backend(db['ENGINE'])
File "/home/idan/.pyenv/versions/productionready/lib/python3.5/site-packages/django/db/utils.py", line 115, in load_backend
return import_module('%s.base' % backend_name)
File "/home/idan/.pyenv/versions/3.5.2/lib/python3.5/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/idan/.pyenv/versions/productionready/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py", line 39, in
raise ImproperlyConfigured("Error loading either pysqlite2 or sqlite3 modules (tried in that order): %s" % exc)
django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named '_sqlite3'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant