Clean env

53 views
Skip to first unread message

markh

unread,
Aug 4, 2010, 9:40:53 AM8/4/10
to virtualenvwrapper
I am having a few problems creating a clean env, ie one with out all
the site-package bagage.
I'm not sure if the answer lies with my python installation, or with
my virtualenv(wrapper) installation

On running
.............
>mkvirtualenv env3 --no-site-packages
>workon env3
(env3)> python -V
Python 2.4.3
(env3)> python
>>> import sys
>>> for x in sys.path:print x
/usr/lib/python2.4/site-packages/pip-0.8-py2.4.egg
..........
I get all the /usr/lib/python2.4/site-packages


Also running
.........
env3)>lssitepackages
File "<string>", line 1
import sys; print ".".join(str(p) for p in sys.version_info[:2])
^
SyntaxError: invalid syntax
ls: /home/batch/Envs/env3/lib/python/site-packages: No such file or
directory
...........
However there is a dir
/home/batch/Envs/env3/lib/python2.4/site-packages/

( could it be that my python exe is in /usr/bin/python2.4, this is as
I run multiple version of python )

Doug Hellmann

unread,
Aug 4, 2010, 5:05:09 PM8/4/10
to virtuale...@googlegroups.com

On Aug 4, 2010, at 9:40 AM, markh wrote:

> I am having a few problems creating a clean env, ie one with out all
> the site-package bagage.
> I'm not sure if the answer lies with my python installation, or with
> my virtualenv(wrapper) installation
>
> On running
> .............
>> mkvirtualenv env3 --no-site-packages
>> workon env3
> (env3)> python -V
> Python 2.4.3
> (env3)> python
>>>> import sys
>>>> for x in sys.path:print x
> /usr/lib/python2.4/site-packages/pip-0.8-py2.4.egg
> ..........
> I get all the /usr/lib/python2.4/site-packages

Try reversing the order of env3 and --no-site-packages on the command line. mkvirtualenv expects the environment name to be the last argument.

>
>
> Also running
> .........
> env3)>lssitepackages
> File "<string>", line 1
> import sys; print ".".join(str(p) for p in sys.version_info[:2])
> ^
> SyntaxError: invalid syntax

This is a separate problem. I don't remember when generator expressions went into the language. Apparently not in 2.4. I'll have to look at the tests and see if there's one for lssitepackages.

> ls: /home/batch/Envs/env3/lib/python/site-packages: No such file or
> directory
> ...........
> However there is a dir
> /home/batch/Envs/env3/lib/python2.4/site-packages/
>
> ( could it be that my python exe is in /usr/bin/python2.4, this is as
> I run multiple version of python )

lssitepackages isn't able to get the Python version number because of the syntax error, so it is building an invalid path.

Would you open a ticket so I don't don't forget to work on this? (http://bitbucket.org/dhellmann/virtualenvwrapper/issues?status=new&status=open)

Thanks,
Doug

markh

unread,
Aug 5, 2010, 5:31:41 AM8/5/10
to virtualenvwrapper
Bug raised, #61

putting the name at the end does not apear to have worked
-----------------------
[Dev]:/home/mhallett/dev/virt_env> mkvirtualenv --no-site-packages
env4
New python executable in env4/bin/python2.4
Also creating executable in env4/bin/python
Installing setuptools.............done.
virtualenvwrapper.user_scripts Creating /home/batch/Envs/env4/bin/
predeactivate
virtualenvwrapper.user_scripts Creating /home/batch/Envs/env4/bin/
postdeactivate
virtualenvwrapper.user_scripts Creating /home/batch/Envs/env4/bin/
preactivate
virtualenvwrapper.user_scripts Creating /home/batch/Envs/env4/bin/
postactivate
(env4)[Dev]:/home/mhallett/dev/virt_env> python
Python 2.4.3 (#1, Dec 11 2006, 11:39:03)
[GCC 4.1.1 20061130 (Red Hat 4.1.1-43)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> for x in sys.path: print x
...

/usr/lib/python2.4/site-packages/Tempita-0.2-py2.4.egg
/usr/lib/python2.4/site-packages/WebTest-1.1-py2.4.egg
/usr/lib/python2.4/site-packages/WebError-0.10.1-py2.4.egg
/usr/lib/python2.4/site-packages/WebOb-0.9.6.1-py2.4.egg
/usr/lib/python2.4/site-packages/Mako-0.2.4-py2.4.egg
/usr/lib/python2.4/site-packages/nose-0.10.4-py2.4.egg
------------------------------------

Any thoughts/ideas

Rgds
Mark

Doug Hellmann

unread,
Aug 5, 2010, 7:04:05 AM8/5/10
to virtuale...@googlegroups.com

What version of virtualenv are you using, and does it work as expected if you create the environment directly instead of using mkvirtualenv?

Doug

markh

unread,
Aug 6, 2010, 9:08:49 AM8/6/10
to virtualenvwrapper

I'm using virtualenv-1.4.9-py2.4.egg.
It also includes site packages when I user virtualenv --no-site-
packages.
(This is part of the reason why I moved to virtualenvwrapper, hoping a
simpler interface would fix it, clearly it is wrapping the underlying
problem)
I am guessing that it does not spot that the dir is my site-packages
dir?

Rgsd

Doug Hellmann

unread,
Aug 6, 2010, 10:37:57 AM8/6/10
to virtuale...@googlegroups.com

The wrapper just calls virtualenv, so if the problem is in the lower layer using mkvirtualenv will show it, too.

You may want to look at the archives on http://groups.google.com/group/python-virtualenv/ and see if anyone else had this problem.

Doug

Reply all
Reply to author
Forward
0 new messages