My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips
Issue 110: installation issue
10 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Aug 2009


Sign in to add a comment
 
Reported by richardg...@gmail.com, Mar 30, 2008

 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
I'm getting the same
Comment 2 by marcos.d...@gmail.com, May 11, 2008
Same here with a today's checkout
Comment 3 by alexande...@gmail.com, May 27, 2008
I'm also getting the same with 0.97-pre-SVN-7543
Comment 4 by joe.vasquez, May 27, 2008
same today, bummer...i hope this gets fixed
Comment 5 by simon.ed...@gmail.com, Jun 2, 2008
I'd like to see this fixed as well.
Comment 6 by bcu...@gmail.com, Jun 3, 2008
Yes, me too (both trunk version django and tagging)
Comment 7 by aet...@gmail.com, Jun 6, 2008
me too :)
Comment 8 by miguel.f...@gmail.com, Jun 9, 2008
Same here.
Comment 9 by midnight...@gmail.com, Jun 19, 2008
Same...
Comment 10 by Dank...@gmail.com, 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.
Comment 11 by jparise, 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.
Comment 12 by neves....@gmail.com, 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... 
Comment 13 by cgr...@gmail.com, 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
Comment 14 by yati...@gmail.com, 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:

Comment 16 by gotenx...@gmail.com, 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.

django-tagging_issue110.diff
2.1 KB   View   Download
Comment 17 by eric.hen...@gmail.com, Oct 3, 2008
If you add

from django.conf import settings
settings.configure()

to setup.py it will fix the error you are getting.
Comment 18 by gavin.mc...@gmail.com, Oct 19, 2008
Eric's solution worked for me, and seems like the simplest fix. 

Cheers!
Comment 19 by srinivas...@gmail.com, Oct 31, 2008
eric is absolutely right. follow the same codes
great eric
Comment 20 by raje...@gmail.com, 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

Comment 21 by Liam.Bli...@gmail.com, Jul 27, 2009
Eric's solution worked a treat for me too
Comment 22 by p.harshal, Aug 5, 2009
Thats Eric. Solution given by you works! :)
Comment 24 by project member bros...@gmail.com, 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
Comment 25 by meenalp...@gmail.com, 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')
>>> 

Comment 26 by danielba...@gmail.com, Dec 23, 2009
Erics's solution fixed the problem for me.
Thanks
Comment 27 by ardaere...@gmail.com, Apr 28, 2010
Hey @rajeeja, 
Try this command 
sudo python setup.py install

Comment 28 by rahul.bi...@gmail.com, 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

Powered by Google Project Hosting