Setting up a virtualenv for googleappengine

55 views
Skip to first unread message

JammyZ

unread,
Apr 4, 2011, 2:46:42 PM4/4/11
to python...@googlegroups.com
Hi,
I'm trying to setup a virtualenv to develop a project for
googleappengine. This is the first time I play with virtualenv.
I wanted to set it up with python2.5, to avoid getting all sort of
warnings from deprecated libraries etc.
Since my Ubuntu distro doesn't have python 2.5 packages, I downloaded
2.5.5, compiled and installed it on /usr/local/python2.5

I then did
virtualenv -p python2.5 --no-site-packages TEST_ENV_2.5

Then started figuring out what other dependencies I needed in the
virtualenv to get the system running.

So I did:
source activate
pip install readline
pip install ipython
pip install PIL

so far so good, no issues.

I then needed the package ssl and that's when it started going wrong:

....
copying test/test_ssl.py -> /usr/local/python2.5/lib/python2.5/test

error: /usr/local/python2.5/lib/python2.5/test/test_ssl.py: Permission denied

----------------------------------------
Command /home/jammyz/playground/TEST_ENV_2.5/bin/python2.5 -c "import
setuptools; __file__='/home/jammyz/playground/TEST_ENV_2.5/build/ssl/setup.py';
execfile('/home/jammyz/playground/TEST_ENV_2.5/build/ssl/setup.py')"
install --single-version-externally-managed --record
/tmp/pip-0Igjsq-record/install-record.txt --install-headers
/home/jammyz/playground/TEST_ENV_2.5/include/site/python2.5 failed
with error code 1
Storing complete log in /home/jammyz/.pip/pip.log
Traceback (most recent call last):
File "/home/jammyz/playground/TEST_ENV_2.5/bin/pip", line 9, in <module>
load_entry_point('pip==0.7.2', 'console_scripts', 'pip')()
File "/home/jammyz/playground/TEST_ENV_2.5/lib/python2.5/site-packages/pip-0.7.2-py2.5.egg/pip/__init__.py",
line 94, in main
return command.main(initial_args, args[1:], options)
File "/home/jammyz/playground/TEST_ENV_2.5/lib/python2.5/site-packages/pip-0.7.2-py2.5.egg/pip/basecommand.py",
line 139, in main
log_fp = open_logfile(log_fn, 'w')
File "/home/jammyz/playground/TEST_ENV_2.5/lib/python2.5/site-packages/pip-0.7.2-py2.5.egg/pip/basecommand.py",
line 196, in open_logfile
log_fp = open(filename, mode)
IOError: [Errno 13] Permission denied: '/home/jammyz/.pip/pip.log'


It still seems to be working fine, ssl seems to be available, but it
is not nice to see that error. Looks like it needs to copy a file into
the python2.5 installation folder and it doesn't have permissions.

I want to write a set of instructions on how to get the virtualenv
setup for other developers (working on Mac OS), is there any way I can
get around the permissions issue?

Thanks.

Iker.

Sean

unread,
Apr 4, 2011, 5:53:14 PM4/4/11
to python...@googlegroups.com
I think the first error is actually a permission problem with pip trying
to write to its log file (which indicates a second error).
I bet the first time you ran pip and it created a log you where using
sudo, check the permissions of your .pip directory and the files inside,
they are probably owned by root, change em back to your normal user
account, and the pip error will go away.

The actual problem, as you said is that the setup.py for the package is
a little dodgy, and always trys to copy some test files under /usr.

You pretty much have to fix that by hand,

download the source for the ssl module from

http://pypi.python.org/pypi/ssl/1.15#downloads

edit the setup.py and comment out these lines (its just stuff for
running test on the package, so you dont really need it)


#data_files=[(testdir, ['test/test_ssl.py',
# 'test/keycert.pem',
# 'test/badcert.pem',
# 'test/badkey.pem',
# 'test/nullcert.pem'])],

Then run python setup.py install (after source bin/activate of course)
and you should be ok.

Sean

Michael Thompson

unread,
Apr 4, 2011, 5:57:23 PM4/4/11
to python...@googlegroups.com, Sean
On 4 April 2011 22:53, Sean <se...@odonnell.nu> wrote:
> I think the first error is actually a permission problem with pip trying
> to write to its log file (which indicates a second error).
> I bet the first time you ran pip and it created a log you where using
> sudo, check the permissions of your .pip directory and the files inside,
> they are probably owned by root, change em back to your normal user
> account, and the pip error will go away.
>
> The actual problem, as you said is that the setup.py for the package is
> a little dodgy, and always trys to copy some test files under /usr.
>
> You pretty much have to fix that by hand,
>
> download the source for the ssl module from
>
> http://pypi.python.org/pypi/ssl/1.15#downloads
>
> edit the setup.py and comment out these lines (its just stuff for
> running test on the package, so you dont really need it)
>
>
>      #data_files=[(testdir, ['test/test_ssl.py',
>      #                       'test/keycert.pem',
>      #                       'test/badcert.pem',
>      #                       'test/badkey.pem',
>      #                       'test/nullcert.pem'])],
>
> Then run python setup.py install (after source bin/activate of course)
> and you should be ok.

Could also try changing this line in setup.py for ssl.

from
get_python_lib(False, True)
to
get_python_lib()

Michael

Geoffroy Lorieux

unread,
Aug 24, 2011, 6:08:44 PM8/24/11
to python...@googlegroups.com, Sean
Thank you for the advice.

You saved me a time.
Reply all
Reply to author
Forward
0 new messages