flebel / django-tagging

Automatically exported from code.google.com/p/django-tagging
Other
0 stars 0 forks source link

installation issue #110

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

 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.

Original issue reported on code.google.com by richardg...@gmail.com on 30 Mar 2008 at 3:14

GoogleCodeExporter commented 9 years ago
I'm getting the same

Original comment by gdwar...@gmail.com on 22 Apr 2008 at 3:40

GoogleCodeExporter commented 9 years ago
Same here with a today's checkout

Original comment by marcos.d...@gmail.com on 11 May 2008 at 1:16

GoogleCodeExporter commented 9 years ago
I'm also getting the same with 0.97-pre-SVN-7543

Original comment by alexande...@gmail.com on 27 May 2008 at 12:14

GoogleCodeExporter commented 9 years ago
same today, bummer...i hope this gets fixed

Original comment by joe.vasquez on 28 May 2008 at 6:24

GoogleCodeExporter commented 9 years ago
I'd like to see this fixed as well.

Original comment by simon.ed...@gmail.com on 2 Jun 2008 at 2:09

GoogleCodeExporter commented 9 years ago
Yes, me too (both trunk version django and tagging)

Original comment by bcu...@gmail.com on 3 Jun 2008 at 11:33

GoogleCodeExporter commented 9 years ago
me too :)

Original comment by aet...@gmail.com on 6 Jun 2008 at 4:03

GoogleCodeExporter commented 9 years ago
Same here.

Original comment by miguel.f...@gmail.com on 9 Jun 2008 at 6:01

GoogleCodeExporter commented 9 years ago
Same...

Original comment by midnight...@gmail.com on 19 Jun 2008 at 2:18

GoogleCodeExporter commented 9 years ago
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.

Original comment by Dank...@gmail.com on 19 Jun 2008 at 4:24

GoogleCodeExporter commented 9 years ago
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.

Original comment by jparise on 22 Jun 2008 at 7:09

GoogleCodeExporter commented 9 years ago
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... 

Original comment by neves....@gmail.com on 23 Jul 2008 at 10:18

GoogleCodeExporter commented 9 years ago
the DJANGO_SETTINGS_MODULE error has nothing to do with tagging - it means your
environment isn't setup right for django, nothing more

Original comment by cgr...@gmail.com on 31 Jul 2008 at 8:53

GoogleCodeExporter commented 9 years ago
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:

Original comment by yati...@gmail.com on 27 Aug 2008 at 2:38

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
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.

Original comment by gotenx...@gmail.com on 19 Sep 2008 at 3:01

Attachments:

GoogleCodeExporter commented 9 years ago
If you add

from django.conf import settings
settings.configure()

to setup.py it will fix the error you are getting.

Original comment by eric.hen...@gmail.com on 3 Oct 2008 at 10:34

GoogleCodeExporter commented 9 years ago
Eric's solution worked for me, and seems like the simplest fix. 

Cheers!

Original comment by gavin.mc...@gmail.com on 20 Oct 2008 at 12:10

GoogleCodeExporter commented 9 years ago
eric is absolutely right. follow the same codes
great eric

Original comment by srinivas...@gmail.com on 31 Oct 2008 at 11:34

GoogleCodeExporter commented 9 years ago
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

Original comment by raje...@gmail.com on 11 Apr 2009 at 11:29

GoogleCodeExporter commented 9 years ago
Eric's solution worked a treat for me too

Original comment by Liam.Bli...@gmail.com on 27 Jul 2009 at 9:19

GoogleCodeExporter commented 9 years ago
Thats Eric. Solution given by you works! :)

Original comment by p.harshal on 5 Aug 2009 at 1:58

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
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.

Original comment by bros...@gmail.com on 23 Aug 2009 at 4:57

GoogleCodeExporter commented 9 years ago
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')
>>> 

Original comment by meenalp...@gmail.com on 15 Nov 2009 at 6:31

GoogleCodeExporter commented 9 years ago
Erics's solution fixed the problem for me.
Thanks

Original comment by danielba...@gmail.com on 23 Dec 2009 at 10:55

GoogleCodeExporter commented 9 years ago
Hey @rajeeja, 
Try this command 
sudo python setup.py install

Original comment by ardaere...@gmail.com on 29 Apr 2010 at 2:01

GoogleCodeExporter commented 9 years ago
Eric's solution fixed the problem for me, only after I used ardaeren13's 
suggestion. Thanks both.

Original comment by rahul.bi...@gmail.com on 31 Jul 2010 at 7:08