| Issue 110: | installation issue | |
| 10 people starred this issue and may be notified of changes. | Back to list |
richard@edgecomb:~/django-packages/django-tagging-read-only$ sudo python
setup.py install
Traceback (most recent call last):
File "setup.py", line 49, in <module>
version_tuple = __import__('tagging').VERSION
File
"/home/richard/django-packages/django-tagging-read-only/tagging/__init__.py",
line 3, in <module>
from tagging.managers import ModelTaggedItemManager, TagDescriptor
File
"/home/richard/django-packages/django-tagging-read-only/tagging/managers.py",
line 5, in <module>
from django.contrib.contenttypes.models import ContentType
File
"/usr/lib/python2.5/site-packages/django/contrib/contenttypes/models.py",
line 1, in <module>
from django.db import models
File "/usr/lib/python2.5/site-packages/django/db/__init__.py", line 10,
in <module>
if not settings.DATABASE_ENGINE:
File "/usr/lib/python2.5/site-packages/django/conf/__init__.py", line 28,
in __getattr__
self._import_settings()
File "/usr/lib/python2.5/site-packages/django/conf/__init__.py", line 57,
in _import_settings
raise ImportError("Settings cannot be imported, because environment
variable %s is undefined." % ENVIRONMENT_VARIABLE)
ImportError: Settings cannot be imported, because environment variable
DJANGO_SETTINGS_MODULE is undefined.
Comment
1
by
gdwar...@gmail.com,
Apr 21, 2008
,
May 11, 2008
Same here with a today's checkout
,
May 27, 2008
I'm also getting the same with 0.97-pre-SVN-7543
,
May 27, 2008
same today, bummer...i hope this gets fixed
,
Jun 2, 2008
I'd like to see this fixed as well.
,
Jun 3, 2008
Yes, me too (both trunk version django and tagging)
,
Jun 6, 2008
me too :)
,
Jun 9, 2008
Same here.
,
Jun 19, 2008
Same...
,
Jun 19, 2008
if your like me then you get this message from within the python interpreter. Well I figured out that I need to be running the"python manage.py shell" command from within the site DIR to get all the environment variables correct.
,
Jun 22, 2008
The setup.py script imports the tagging module to extra its version information.
Unfortunately, the tagging module's __init__.py file globally imports some models
which rely on the rest of Django's infrastructure to be up and running (hence the
need for settings).
Running the installation from with "python manage.py shell" as Dankles suggests
solves the problem, or you can move the this line in tagging.__init__.py:
from tagging.managers import ModelTaggedItemManager, TagDescriptor
... down into the register() function so that those modules aren't imported by
default just to query the VERSION value.
,
Jul 23, 2008
I'm having the same problem. Can't even start python manage.py shell without a: "AttributeError: 'module' object has no attribute 'tagging'" ... maybe it's the 1.0 alpha...
,
Jul 31, 2008
the DJANGO_SETTINGS_MODULE error has nothing to do with tagging - it means your environment isn't setup right for django, nothing more
,
Aug 27, 2008
You could remove the "version_tuple = __import__('tagging').VERSION" from the
setup.py file and explicitly set the version_tuple.
It's really important to have python setup.py <commands> working.
diff --git a/setup.py b/setup.py
index 66daf3e..728be22 100644
--- a/setup.py
+++ b/setup.py
@@ -46,7 +46,8 @@ for dirpath, dirnames, filenames in os.walk(tagging_dir):
data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
# Dynamically calculate the version based on tagging.VERSION
-version_tuple = __import__('tagging').VERSION
+#version_tuple = __import__('tagging').VERSION
+version_tuple = (0, 3, 'pre')
if version_tuple[2] is not None:
version = "%d.%d_%s" % version_tuple
else:
,
Sep 19, 2008
Dirty, dirty, filthy ugly hack that works (tested on Slackware Linux 12.1.0/-current, should work with no problems on other Unices - going by the Python documentation for the os module, may present with issues on FreeBSD/OSX. Unknown behaviour on Win32). Involves setting an environment variable in setup.py (DJANGO_TAGGING_SETUP = "Yes") and checking for that in __init__. Not as simple as simply hardcoding the version_tuple into setup.py.
,
Oct 3, 2008
If you add from django.conf import settings settings.configure() to setup.py it will fix the error you are getting.
,
Oct 19, 2008
Eric's solution worked for me, and seems like the simplest fix. Cheers!
,
Oct 31, 2008
eric is absolutely right. follow the same codes great eric
,
Apr 11, 2009
Hi all i get on error with eric's method error creating tagging folder in python folder django i.e. creating /usr/lib/python2.5/site-packages/tagging error: could not create '/usr/lib/python2.5/site-packages/tagging': Permission denied
,
Jul 27, 2009
Eric's solution worked a treat for me too
,
Aug 5, 2009
Thats Eric. Solution given by you works! :)
,
Aug 22, 2009
This shouldn't be a problem anymore since setup.py doesn't import from version from tagging/__init__.py any longer. Report new issues as they come up.
Status: Fixed
,
Nov 15, 2009
Seems like this should be fixed but I still get the error. I have to do all the steps in Eric's post to import tagging after a fresh install. I am using django1.1 and python2.6 $ sudo pip install django-tagging Python 2.6 (r26:66714, Jun 8 2009, 16:07:29) [GCC 4.4.0 20090506 (Red Hat 4.4.0-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import tagging Traceback (most recent call last): File "<stdin>", line 1, in <module> File "tagging/__init__.py", line 3, in <module> from tagging.managers import ModelTaggedItemManager, TagDescriptor File "tagging/managers.py", line 5, in <module> from django.contrib.contenttypes.models import ContentType File "/usr/lib/python2.6/site-packages/django/contrib/contenttypes/models.py", line 1, in <module> from django.db import models File "/usr/lib/python2.6/site-packages/django/db/__init__.py", line 10, in <module> if not settings.DATABASE_ENGINE: File "/usr/lib/python2.6/site-packages/django/utils/functional.py", line 269, in __getattr__ self._setup() File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line 38, in _setup raise ImportError("Settings cannot be imported, because environment variable %s is undefined." % ENVIRONMENT_VARIABLE) ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined. >>> from django.conf import settings >>> settings.configure() >>> import tagging >>> tagging.VERSION (0, 4, 'pre') >>>
,
Dec 23, 2009
Erics's solution fixed the problem for me. Thanks
,
Apr 28, 2010
Hey @rajeeja, Try this command sudo python setup.py install
,
Jul 31, 2010
Eric's solution fixed the problem for me, only after I used ardaeren13's suggestion. Thanks both. |
|
| ► Sign in to add a comment |