Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52558
| References | <18c0a8bb-9295-493b-b0aa-1593b7d05c2f@googlegroups.com> |
|---|---|
| Date | 2013-08-15 13:30 -0300 |
| Subject | Re: "Nested" virtual environments |
| From | Marcel Rodrigues <marcelgmr@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.603.1376584227.1251.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
I don't know how to completely solve this problem, but here is something that can alleviate it considerably. If you have a recent version of pip, you can use wheels [1] to save built packages locally. First create a new virtualenv and install the common packages. Then put these packages in a wheel directory. Then, for any other virtualenv that need the common packages, you can easily install then from the wheel directory (this is fast even for numpy & friends, because nothing will be compiled again) [2]. # Create a new virtualenv virtualenv myenv source myenv/bin/activate # Install the wheel package pip install wheel # Install your common packages pip install numpy scipy matplotlib # Create a requirements file pip freeze > /local/requirements.txt # Create wheel for the common packages pip wheel --wheel-dir=/local/wheels -r /local/requirements.txt Now you have all the built packages saved to /local/wheels, ready to install on any other environment. You can safely delete myenv. Test it with the following: # Create a virtualenv for a new project virtualenv myproj source myproj/bin/activate # Install common packages from wheel pip install --use-wheel --no-index --find-links=/local/wheels -r /local/requirements.txt [1] https://wheel.readthedocs.org [2] http://www.pip-installer.org/en/latest/cookbook.html#building-and-installing-wheels 2013/8/9 Luca Cerone <luca.cerone@gmail.com> > Dear all, is there a way to "nest" virtual environments? > > I work on several different projects that involve Python programming. > > For a lot of this projects I have to use the same packages (e.g. numpy, > scipy, matplotlib and so on), while having to install packages that are > specific > for each project. > > For each of this project I created a virtual environment (using virtualenv > --no-site-packages) and I had to reinstall the shared packages in each of > them. > > I was wondering if there is a way to nest a virtual environment into > another, > so that I can create a "common" virtual environment that contains all the > shared packages and then "specialize" the virtual environments installing > the packages specific for each project. > > In a way this is not conceptually different to using virtualenv > --system-site-packages, just instead of getting access to the system > packages a virtual environment should be able to access the packages of an > other one. > > Thanks a lot in advance for the help, > Luca > -- > http://mail.python.org/mailman/listinfo/python-list >
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
"Nested" virtual environments Luca Cerone <luca.cerone@gmail.com> - 2013-08-09 01:29 -0700
Re: "Nested" virtual environments Marcel Rodrigues <marcelgmr@gmail.com> - 2013-08-15 13:30 -0300
Re: "Nested" virtual environments Luca Cerone <luca.cerone@gmail.com> - 2013-08-16 01:35 -0700
csiph-web