Edgewall Software
Modify

Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#7320 closed defect (fixed)

traceback for genshi-related error

Reported by: anonymous Owned by: jonas
Priority: high Milestone: 0.11.1
Component: general Version: 0.11-stable
Severity: major Keywords:
Cc:
Release Notes:
API Changes:

Description

i was able to resolve this by installing a non-zipped genshi egg. i am running trac from branches/0.11-stable

[Tue Jun 10 11:32:49 2008] [error] [client xx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: Traceback (most recent call last):
[Tue Jun 10 11:32:49 2008] [error] [client xx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 287, in HandlerDispatch\n    log=debug)
[Tue Jun 10 11:32:49 2008] [error] [client xx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 464, in import_module\n    module = imp.load_module(mname, f, p, d)
[Tue Jun 10 11:32:49 2008] [error] [client xx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r7189-py2.4.egg/trac/web/__init__.py", line 1, in ?\n    from trac.web.api import *
[Tue Jun 10 11:32:49 2008] [error] [client xx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r7189-py2.4.egg/trac/web/api.py", line 29, in ?\n    from trac.util import get_last_traceback
[Tue Jun 10 11:32:49 2008] [error] [client xx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r7189-py2.4.egg/trac/util/__init__.py", line 33, in ?\n    from trac.util.html import escape, unescape, Markup, Deuglifier
[Tue Jun 10 11:32:49 2008] [error] [client xx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r7189-py2.4.egg/trac/util/html.py", line 16, in ?\n    from genshi import Markup, escape, unescape
[Tue Jun 10 11:32:49 2008] [error] [client xx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/Genshi-0.5-py2.4-linux-i686.egg/genshi/__init__.py", line 28, in ?
[Tue Jun 10 11:32:49 2008] [error] [client xx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/Genshi-0.5-py2.4-linux-i686.egg/genshi/core.py", line 544, in ?
[Tue Jun 10 11:32:49 2008] [error] [client xx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/Genshi-0.5-py2.4-linux-i686.egg/genshi/_speedups.py", line 7, in ?
[Tue Jun 10 11:32:49 2008] [error] [client xx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/Genshi-0.5-py2.4-linux-i686.egg/genshi/_speedups.py", line 4, in __bootstrap__
[Tue Jun 10 11:32:49 2008] [error] [client xx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/setuptools-0.6c6-py2.4.egg/pkg_resources.py", line 840, in resource_filename\n    return get_provider(package_or_requirement).get_resource_filename(
[Tue Jun 10 11:32:49 2008] [error] [client xx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/setuptools-0.6c6-py2.4.egg/pkg_resources.py", line 1311, in get_resource_filename\n    return self._extract_resource(manager, zip_path)
[Tue Jun 10 11:32:49 2008] [error] [client xx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/setuptools-0.6c6-py2.4.egg/pkg_resources.py", line 1331, in _extract_resource\n    real_path = manager.get_cache_path(
[Tue Jun 10 11:32:49 2008] [error] [client xx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/setuptools-0.6c6-py2.4.egg/pkg_resources.py", line 921, in get_cache_path\n    self.extraction_error()
[Tue Jun 10 11:32:49 2008] [error] [client xx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.4/site-packages/setuptools-0.6c6-py2.4.egg/pkg_resources.py", line 887, in extraction_error\n    raise err
[Tue Jun 10 11:32:49 2008] [error] [client xx.xxx.xxx.xxx] PythonHandler trac.web.modpython_frontend: ExtractionError: Can't extract file(s) to egg cache\n\nThe following error occurred while trying to extract file(s) to the Python egg\ncache:\n\n  [Errno 13] Permission denied: '/root/.python-eggs'\n\nThe Python egg cache directory is currently set to:\n\n  /root/.python-eggs\n\nPerhaps your account does not have write access to this directory?  You can\nchange the cache directory by setting the PYTHON_EGG_CACHE environment\nvariable to point to an accessible directory.\n

Attachments (1)

modpython_egg_cache.patch (1.3 KB) - added by jonas 6 years ago.
Set PYTHON_EGG_CACHE using PythonOption?

Download all attachments as: .zip

Change History (21)

comment:1 Changed 6 years ago by eblot

  • Resolution set to invalid
  • Status changed from new to closed

This is an installation issue (and as such should have been posted to the MailingList).

The root cause of the error is shown in the last line:

Permission denied: '/root/.python-eggs'

and the solution to resolve it is also printed out…

comment:2 Changed 6 years ago by luis.silva@…

  • Milestone set to 0.11
  • Priority changed from normal to high
  • Resolution invalid deleted
  • Severity changed from normal to major
  • Status changed from closed to reopened
  • Version set to 0.11-stable

I'm having this problem even with python_egg_path defined as: "SetEnv PYTHON_EGG_CACHE /tmp/". The same directive was used in older versions of trac sucessfully. Either this is a problem with trac or with genshi 0.5 (i've not managed to exclude that option yet)

This directive is ignored…

I'm changing the severity to major as Genshi defaults its install method to zipped egg…

comment:3 Changed 6 years ago by dna

I've the same problem while upgrading from Trac 0.11dev-r6658 to HEAD. The Apache directive is ignored.

comment:4 Changed 6 years ago by davidck@…

Also having the same issue. Setting ENV PYTHON_EGG_CACHE did not work for me neither. Reinstalled Genshi 0.5 / Trac 0.11rc2 did not make a difference.

comment:5 follow-up: Changed 6 years ago by davidck@…

Found the answer on the net, some other guy having the same issue. Solution: Extract Genshi egg as a directory under the same egg name.

comment:6 follow-up: Changed 6 years ago by buhrt@…

Trac 0.12dev-r7204 on Fedora 8, apache (httpd-2.2.8-1.fc8) still gives:

[Thu Jun 12 18:10:57 2008] [error] [client 192.168.1.90] ExtractionError?: Can't extract file(s) to egg cache\n\nThe following error occurred while trying to extract file(s) to the Python egg\ncache:\n\n [Errno 13] Permission denied: '/root/.python-eggs'\n\nThe Python egg cache directory is currently set to:\n\n /root/.python-eggs\n\nPerhaps your account does not have write access to this directory? You can\nchange the cache directory by setting the PYTHON_EGG_CACHE environment\nvariable to point to an accessible directory.\n

Adding:

SetEnv PYTHON_EGG_CACHE /tmp

inside the

<Location /trac>

block didn't help.

The quick/simple fix is to add to the end of: /etc/sysconfig/httpd export PYTHON_EGG_CACHE=/tmp

Then restart Apache.

comment:7 in reply to: ↑ 5 Changed 6 years ago by anonymous

Replying to davidck@gmail.com:

Found the answer on the net, some other guy having the same issue. Solution: Extract Genshi egg as a directory under the same egg name.

FYI: this worked for me too. Thank you very much davidck.

comment:8 follow-up: Changed 6 years ago by anonymous

Hey

For anyone still clueless I did the following.

added the environment variables (Im not sure if this has any affect) by changing

/etc/apache2/sites-enabled/trac to:

<Location /trac>

SetHandler? mod_python PythonInterpreter? main_interpreter PythonHandler? trac.web.modpython_frontend PythonOption? TracEnvParentDir? /var/lib/trac PythonOption? TracUriRoot? /trac SetEnv PYTHON_EGG_CACHE /tmp

</Location>

Then: easy_install -m genshi went to the python directory /usr/lib/python2.5/site-packages$ deleted the genshi egg ran easy_install -z genshi==0.5

comment:9 Changed 6 years ago by conny@…

I can not understand what just happened. I updated from 0.11b1 to 0.11, and all of a sudden when I restarted apache2 my SetEnv PYTHON_EGG_CACHE was no longer taken into respect.

AFAICR I didn't modify Apache in since I last restarted it… :-/

Is this a Trac 0.11 issue or an Apache 2.2 mod_env bug/vagueness?

comment:10 Changed 6 years ago by mail@…

Upgraded from 0.11rc1 to 0.11. Experiencing same symptoms as conny@.

comment:11 Changed 6 years ago by jkempf@…

Upgraded from 0.10.4 to 0.11, same symptoms as conny@.

comment:12 Changed 6 years ago by anonymous

Teste

comment:13 in reply to: ↑ 8 Changed 6 years ago by anonymous

Replying to anonymous:

Hey

For anyone still clueless I did the following.

added the environment variables (Im not sure if this has any affect) by changing

/etc/apache2/sites-enabled/trac to:

<Location /trac>

SetHandler? mod_python PythonInterpreter? main_interpreter PythonHandler? trac.web.modpython_frontend PythonOption? TracEnvParentDir? /var/lib/trac PythonOption? TracUriRoot? /trac SetEnv PYTHON_EGG_CACHE /tmp

</Location>

Then: easy_install -m genshi went to the python directory /usr/lib/python2.5/site-packages$ deleted the genshi egg ran easy_install -z genshi==0.5

Should be

easy_install -Z genshi==0.5

-Z option ensures the egg is unzipped when installed

comment:14 in reply to: ↑ 6 Changed 6 years ago by anonymous

Replying to buhrt@aftinc.net:

The quick/simple fix is to add to the end of: /etc/sysconfig/httpd export PYTHON_EGG_CACHE=/tmp

Then restart Apache.

This worked for me, too, and was the only method that worked (tried the other methods as well)

Changed 6 years ago by jonas

Set PYTHON_EGG_CACHE using PythonOption?

comment:15 Changed 6 years ago by jonas

The main issue here is that we can't set the env variable PYTHON_EGG_CACHE from values passed using SetEnv since these values are only available at request handling time and not at the initial import.

attachment:modpython_egg_cache.patch uses a different approach and instead uses a global PythonOption:

PythonOption PYTHON_EGG_CACHE /some/path

But for this to work this statement needs to be placed outside any virtualhost or location section.

comment:16 Changed 6 years ago by anonymous

  • Resolution set to fixed
  • Status changed from reopened to closed

Fixed in r7406 and r7407.

comment:17 Changed 6 years ago by markokobal

I can not set the PYTHON_EGG_CACHE, using

apache-2.2.9 trac-0.11_2

Have tried inside

<Location> Set PYTHON_EGG_CACHE /some/path …

and aslo directly into httpd.conf with; PythonOption? PYTHON_EGG_CACHE /some/path

Is there really no way of changing the PYTHON_EGG_CACHE?

comment:18 Changed 6 years ago by suCrabu@…

I've been able to solve this on BSD (apache 2.2.9 + mod_python) creating a trac.env file under /usr/local/etc/apache22/envvars.d which reads

  export PYTHON_EGG_CACHE=/tmp

This has the effect of exporting the PYTHON_EGG_CACHE variable to the apache process on startup. Any similar trick in your favorite Un*x/Apache flavour should work.

comment:19 Changed 6 years ago by lsegal

suCrabu, that's a beautiful fix for us BSD users, thanks! I'll use this until FreeBSD ports gets sync'd up with the next release.

comment:20 Changed 5 years ago by voltechs@…

tried suCrabu's "fix", with no luck. http-error.log still reports the value to be ""

Grrr, I hate it when things like this break for no good reason.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed The owner will remain jonas.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from jonas to the specified user.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.