virtualenv "later". So I thought I'd document my experience here.
In summary, it probably works well if you have Visual Studio. The
process outlined below shows a clumsy workaround if you don't.
Hope it helps someone
- - - - - -
$pip install virtualenv # first step (requires pip obviously)
$virtualenv --no-site-packages c:\users\miked\env\proj-x
New python executable in c:\users\miked\env\proj-x\Scripts\python.exe
Installing setuptools, pip...done.
Now copy your "myproject-x" into c:\users\miked\env\proj-x\myproject-x
At this point on Linux one would install virtualenv-wrapper but that is
unfortunately not available for Windows so a simple workaround is ...
1. mkdir \users\miked\bin # could be anything eg \users\miked\bat
2. Add C:\users\miked\bin to the path environment variable
3. Create a batch file called C:\users\miked\bin\proj-x.bat containing:
4. Create another batch file
5. Test the workaround by opening a command prompt somewhere and
entering proj-x. You should see:
C:\Documents and Settings\Mike Dewhirst\Desktop>cd
6. Test the exit batch file by entering exit at that command prompt:
(proj-x) C:\users\miked\env\proj-x\myproject-x>cd \users\miked\
This should let you get into and out of the virtualenv quite easily.
Now comes the difficult bit for Windows - installing stuff in the new
Python's site-packages. First, though, discover what you already have
installed in your main site-packages:
pip freeze > requirements.txt # lists existing site-packages
Here is mine, most of which I don't want in proj-x
So I edit it down to the following, create a directory and save it as
pip install -r C:\users\miked\env\proj-x\requirements\requirements.txt
And this where (my) problems start. First pip will download the packages
successfully but I don't have Visual Studio installed so those packages
requiring compilation don't get installed. Here is a snippet of pip
output after the downloads:
Installing collected packages: Django, South, coverage,
django-discover-runner, pillow, psycopg2, pytz
Running setup.py install for Django
... and so on until errors start to appear. In my case the signal is:
error: Unable to find vcvarsall.bat
Afterwards, pip freeze shows:
(proj-x) C:\users\miked\env\proj-x>pip freeze
... which indicates pillow, psycopg2 and pytz did not install.
But how come they were installed in the main site-packages? That's
because they were originally downloaded from
http://www.lfd.uci.edu/~gohlke/pythonlibs/ and installed manually.
However, even after downloading from that site they cannot be installed
manually into a virtualenv! Only pip can do that. The only workaround I
have found is to manually copy them from the main site-packages to the
new virtualenv site-packages. Clumsy.
My proj-x requirements.txt file now looks like this ...
# pillow==2.3.0 http://www.lfd.uci.edu/~gohlke/pythonlibs/
# psycopg2==2.4.5 http://www.lfd.uci.edu/~gohlke/pythonlibs/
# pytz==2013.9 http://www.lfd.uci.edu/~gohlke/pythonlibs/
After the above clumsy workaround everything works well and pip freeze
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firstname.lastname@example.org.
To post to this group, send email to email@example.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/52E86DE2.5010907%40dewhirst.com.au.
For more options, visit https://groups.google.com/groups/opt_out.