Mailing List Archive

setting PYTHON_EGG_CACHE doesn't do anything
I get the following error using mod_python and SQLite (latest stable
versions of everything:

PythonHandler trac.web.modpython_frontend: OSError: [Errno 13] Permission
denied: '/root/.python-eggs'

The recommended solution, setting:

SetEnv PYTHON_EGG_CACHE /tmp

in httpd.conf fixes the problem if I use CGI, but I'd rather use mod_python
for obvious reasons. It doesn't seem like adding the SetEnv does anything at
all since the error log always says "/root/.pything.eggs".

What's the deal??

Thanks,
Jeremy

_______________________________________________
Trac mailing list
Trac@lists.edgewall.com
http://lists.edgewall.com/mailman/listinfo/trac
Re: setting PYTHON_EGG_CACHE doesn't do anything [ In reply to ]
> What's the deal??

Could you please show us the relevant httpd.conf parts?

Regards,

Manuzhai
_______________________________________________
Trac mailing list
Trac@lists.edgewall.com
http://lists.edgewall.com/mailman/listinfo/trac
Re: setting PYTHON_EGG_CACHE doesn't do anything [ In reply to ]
Jeremy Herbison said the following on 02/19/2006 07:01 AM:
> I get the following error using mod_python and SQLite (latest stable
> versions of everything:
>
> PythonHandler trac.web.modpython_frontend: OSError: [Errno 13] Permission
> denied: '/root/.python-eggs'
>
> The recommended solution, setting:
>
> SetEnv PYTHON_EGG_CACHE /tmp
>
> in httpd.conf fixes the problem if I use CGI, but I'd rather use mod_python
> for obvious reasons. It doesn't seem like adding the SetEnv does anything at
> all since the error log always says "/root/.pything.eggs".
>
> What's the deal??

I see a similar error, but only after a server reboot:

[Errno 13] Permission denied: '/.python-eggs'

This is fixed if I restart apache.

My config follows. If you need any more let me know.

R.


projects.robinbowes.com.conf:
<VirtualHost *:80>
ServerName projects.robinbowes.com
ServerAdmin projects@sitepen.com

ErrorLog logs/projects.robinbowes.com.com-error_log
CustomLog logs/projects.robinbowes.com.com-access_log combined

# Re-direct all requests to secure server
RewriteEngine on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
</VirtualHost>

The following code is included in ssl.conf:

DocumentRoot /home/apache/projects.robinbowes.com/

# Re-direct from / to /trac
RewriteEngine On
RewriteRule ^/+$ /trac [R]
# Re-direct from old project locations to new one. 2006-02-14
RewriteRule ^/apply_replaygain$ /trac/apply_replaygain [R]
RewriteRule ^/check_validrcptto_cdb$ /trac/check_valid_rcptto_cdb [R]
RewriteRule ^/flac2mp3$ /trac/flac2mp3 [R]
RewriteRule ^/technotes$ /trac/technotes [R]

Alias /trac/ /usr/share/trac/htdocs/
<Directory "/usr/share/trac/htdocs">
Order allow,deny
Allow from all
</Directory>

<Location /trac>
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir "/home/trac/"
PythonOption TracUriRoot /trac
# page to show list of projects goes here
# PythonOption TracEnvIndexTemplate
/home/apache/projects.sitepen.com/static/AvailableProjects.cs
</Location>

<LocationMatch "/trac/[^/]+/login">
AuthType Basic
AuthName "robinbowes.com Projects"
AuthUserFile /etc/httpd/conf.d/auth/projects.robinbowes.com-users
Require valid-user
</LocationMatch>

<Directory /var/www/svn/>
Options ExecCGI FollowSymLinks
AllowOverride all
Allow from all
Order allow,deny
</Directory>

<Location /svn>
DAV svn

# any "/svn/foo" URL will map to a repository /home/svn/foo
SVNParentPath /home/svn
SVNIndexXSLT "/static/svnindex.xsl"
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /etc/httpd/conf.d/auth/projects.robinbowes.com-users
AuthzSVNAccessFile
/etc/httpd/conf.d/auth/projects.robinbowes.com-svnaccess
Require valid-user
</Location>

Alias /download /home/apache/projects.robinbowes.com/download
<Directory "/home/apache/projects.robinbowes.com/download">
Options Indexes FollowSymLinks MultiViews
Order allow,deny
Allow from all
</Directory>

_______________________________________________
Trac mailing list
Trac@lists.edgewall.com
http://lists.edgewall.com/mailman/listinfo/trac
Re: setting PYTHON_EGG_CACHE doesn't do anything [ In reply to ]
On Sun, 2006-02-19 at 00:01 -0700, Jeremy Herbison wrote:
> I get the following error using mod_python and SQLite (latest stable
> versions of everything:

When you say "latest versions of everything", what version of pysqlite
does that mean? I tried getting trac working with pysqlite 2.1.3,
failed, and went back to 2.0.7.

> The recommended solution, setting:
>
> SetEnv PYTHON_EGG_CACHE /tmp
>
> in httpd.conf fixes the problem if I use CGI, but I'd rather use mod_python
> for obvious reasons. It doesn't seem like adding the SetEnv does anything at
> all since the error log always says "/root/.pything.eggs".

Here's what I did. I reasoned that the egg file is unpacked so that
some of its files are available as real files in the file system, and I
wasn't getting any bonus points for having the egg present in python's
site-packages directory as a file anyway. So:

cd /path/to/python/site-packages
mv pysqlite-2.0.7-py2.4-linux-i686.egg foo.zip
mkdir pysqlite-2.0.7-py2.4-linux-i686.egg
cd pysqlite-2.0.7-py2.4-linux-i686.egg
unzip ../foo.zip
rm ../foo.zip

Now the egg file is unpacked, so the files are all present already in
the filesystem, nothing needs to be unpacked, PYTHON_EGG_CACHE is
irrelevant, and everybody is happy.

Perhaps that would work for you as well?

--
Brett Neumeier <random@rnd.cx>

_______________________________________________
Trac mailing list
Trac@lists.edgewall.com
http://lists.edgewall.com/mailman/listinfo/trac
RE: setting PYTHON_EGG_CACHE doesn't do anything [ In reply to ]
> -----Original Message-----
> From: trac-bounces@lists.edgewall.com [mailto:trac-
> bounces@lists.edgewall.com] On Behalf Of Manuzhai
> Sent: February 19, 2006 2:32 AM
> To: trac@lists.edgewall.com
> Subject: Re: [Trac] setting PYTHON_EGG_CACHE doesn't do anything
>
> > What's the deal??
>
> Could you please show us the relevant httpd.conf parts?
>
> Regards,
>
> Manuzhai

Sure, sorry I rattled that email off rather quickly...

<Location /projects/myproject>
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /var/trac/myproject
PythonOption TracUriRoot /projects/myproject
SetEnv PYTHON_EGG_CACHE /tmp/trac-eggs
</Location>

/var/log/httpd/error.log shows:

OSError: [Errno 13] Permission denied: '/root/.python-eggs'

Whether or not that SetEnv line is there. I assume this is because
the python interpreter runs as root, since my apache server runs as
user httpd. If I set things up to use CGI, then I get something like:

OSError: [Errno 13] Invalid directory: '/dev/null/.python-eggs'

Which makes sense since the httpd user has no home directory. But
with the CGI method, using SetEnv PYTHON_EGG_CACHE fixes the problem!

_______________________________________________
Trac mailing list
Trac@lists.edgewall.com
http://lists.edgewall.com/mailman/listinfo/trac
RE: setting PYTHON_EGG_CACHE doesn't do anything [ In reply to ]
> Here's what I did. I reasoned that the egg file is unpacked so that
> some of its files are available as real files in the file system, and I
> wasn't getting any bonus points for having the egg present in python's
> site-packages directory as a file anyway. So:
>
> cd /path/to/python/site-packages
> mv pysqlite-2.0.7-py2.4-linux-i686.egg foo.zip
> mkdir pysqlite-2.0.7-py2.4-linux-i686.egg
> cd pysqlite-2.0.7-py2.4-linux-i686.egg
> unzip ../foo.zip
> rm ../foo.zip
>
> Now the egg file is unpacked, so the files are all present already in
> the filesystem, nothing needs to be unpacked, PYTHON_EGG_CACHE is
> irrelevant, and everybody is happy.
>
> Perhaps that would work for you as well?
>
> --
> Brett Neumeier <random@rnd.cx>

That does work, and thanks. I am sort of intellectually curious though as
to why the python interpreter is not honouring the environment variable.

Jeremy

_______________________________________________
Trac mailing list
Trac@lists.edgewall.com
http://lists.edgewall.com/mailman/listinfo/trac
Re: setting PYTHON_EGG_CACHE doesn't do anything [ In reply to ]
when dealing with eggs and apache, it seems to be best to make sure they
are installed unzipped: the easiest way to do this is to supply a "-Z"
arg to easy_install when you setup... (I'm not at all a trac expert, but
I've experienced similar issues with turbogears) -- though I don't
really get why you have an egg installed at all, having looked at the
install instructions for pysqlite & for trac, it doesn't appear likely
that an egg would be installed (unless pysqlite is required as a
dependency by trac's install, but I don't think that's true...)

As to your environ q, I wonder whether, given that the egg may be
already unzipped by the time that modpython gets to it, it ignores the
PYTHON_EGG_CACHE variable and uses the default value instead?

I'd guess that the answer, in any case, won't be on the trac forum, but
you might try looking at the peak site (e.g.
http://peak.telecommunity.com/DevCenter/PkgResources#resource-extraction)
who are, I believe the maintainers of the "egg" implementation.

Tim



Jeremy Herbison wrote:
>> Here's what I did. I reasoned that the egg file is unpacked so that
>> some of its files are available as real files in the file system, and I
>> wasn't getting any bonus points for having the egg present in python's
>> site-packages directory as a file anyway. So:
>>
>> cd /path/to/python/site-packages
>> mv pysqlite-2.0.7-py2.4-linux-i686.egg foo.zip
>> mkdir pysqlite-2.0.7-py2.4-linux-i686.egg
>> cd pysqlite-2.0.7-py2.4-linux-i686.egg
>> unzip ../foo.zip
>> rm ../foo.zip
>>
>> Now the egg file is unpacked, so the files are all present already in
>> the filesystem, nothing needs to be unpacked, PYTHON_EGG_CACHE is
>> irrelevant, and everybody is happy.
>>
>> Perhaps that would work for you as well?
>>
>> --
>> Brett Neumeier <random@rnd.cx>
>
> That does work, and thanks. I am sort of intellectually curious though as
> to why the python interpreter is not honouring the environment variable.
>
> Jeremy
>
> _______________________________________________
> Trac mailing list
> Trac@lists.edgewall.com
> http://lists.edgewall.com/mailman/listinfo/trac
>
>

_______________________________________________
Trac mailing list
Trac@lists.edgewall.com
http://lists.edgewall.com/mailman/listinfo/trac