Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 346647 - dev-python/django-1.2.3 - django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named sqlite3
Summary: dev-python/django-1.2.3 - django.core.exceptions.ImproperlyConfigured: Error ...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-24 13:40 UTC by Alex HeadHunter Pyattaev
Modified: 2010-11-29 15:33 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex HeadHunter Pyattaev 2010-11-24 13:40:56 UTC
emerge dev-python/django-1.2.3 does not pull pysqlite, but it is required for some functions of django

Reproducible: Always

Steps to Reproduce:
obvious

Actual Results:  
See additional info from backtrace. To workaround - emerge --oneshot pysqlite



Crashes with something like that:
Traceback (most recent call last):
  File "manage.py", line 34, in <module>
    execute_manager(settings)
  File "/usr/lib64/python2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/usr/lib64/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib64/python2.6/site-packages/django/core/management/__init__.py", line 252, in fetch_command
    app_name = get_commands()[subcommand]
  File "/usr/lib64/python2.6/site-packages/django/core/management/__init__.py", line 101, in get_commands
    apps = settings.INSTALLED_APPS
  File "/usr/lib64/python2.6/site-packages/django/utils/functional.py", line 276, in __getattr__
    self._setup()
  File "/usr/lib64/python2.6/site-packages/django/conf/__init__.py", line 40, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/lib64/python2.6/site-packages/django/conf/__init__.py", line 73, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib64/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/home/headhunter/tmp/mirosubs/dev-settings.py", line 21, in <module>
    from django.contrib.sites.models import Site
  File "/usr/lib64/python2.6/site-packages/django/contrib/sites/models.py", line 1, in <module>
    from django.db import models
  File "/usr/lib64/python2.6/site-packages/django/db/__init__.py", line 77, in <module>
    connection = connections[DEFAULT_DB_ALIAS]
  File "/usr/lib64/python2.6/site-packages/django/db/utils.py", line 91, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/usr/lib64/python2.6/site-packages/django/db/utils.py", line 32, in load_backend
    return import_module('.base', backend_name)
  File "/usr/lib64/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/usr/lib64/python2.6/site-packages/django/db/backends/sqlite3/base.py", line 34, in <module>
    raise ImproperlyConfigured("Error loading %s: %s" % (module, exc))
django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named sqlite3
Comment 1 Peter Le Bek 2010-11-24 21:27:39 UTC
The Django ebuild does pull pysqlite:

sqlite? ( || ( dev-lang/python:2.7[sqlite] dev-lang/python:2.6[sqlite] dev-lang/python:2.5[sqlite] dev-python/pysqlite:2 ) )

but only if it isn't already included with your python install (Python 2.5 and up all include the sqlite3 module).

I see you are using Python 2.6, so perhaps you should check if sqlite is set in your use flags?
Comment 2 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2010-11-28 01:13:30 UTC
Install dev-python/django with USE="sqlite".
Comment 3 Alex HeadHunter Pyattaev 2010-11-29 09:31:21 UTC
(In reply to comment #2)
> Install dev-python/django with USE="sqlite".
> 

Thats what I did. What I mean is that it is not cool when you install a library in a broken way just because some use-flag is not set. It should not get Broken(TM). If it depends on sqlite - make it hard dep. If it does not - remove the module that uses it from install if sqlite is not in USE. That's it. And global sqlite is not a good option, as you might know.
Comment 4 Matt Summers (RETIRED) gentoo-dev 2010-11-29 15:33:59 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > Install dev-python/django with USE="sqlite".
> > 
> 
> Thats what I did. What I mean is that it is not cool when you install a library
> in a broken way just because some use-flag is not set. It should not get
> Broken(TM). If it depends on sqlite - make it hard dep. If it does not - remove
> the module that uses it from install if sqlite is not in USE. That's it. And
> global sqlite is not a good option, as you might know.
> 

So, django supports many different database engines and many of us do not want to install sqlite where we do not need it. That is the reason for the USE flag. This behavior is cool, and completely copesetic. In fact its part of what makes Gentoo so configurable. We do not have to install every DB under the sun to get our desired outcome, which is a functioning system.

Further, removing the module that "uses" sqlite in django would be a burden not worth the time, and might require a serious hack job on the upstream package. We avoid this sort of poor practice in Gentoo as a general rule.

Finally, using the system sqlite _is_ the desired behavior. Using bundled libs over system libs is considered bad practice in Gentoo, and for very good reasons. I'll refer you to this post [1] by one of our devs, but there are many other resources. Just search a bit and perhaps you will see the wisdom.

I hope this helps you understand what is going on here, and why things are the way they are.

Cheers.

[1] http://blog.flameeyes.eu/2009/01/02/bundling-libraries-for-despair-and-insecurity