Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52582
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2013-08-16 01:35 -0700 |
| References | <18c0a8bb-9295-493b-b0aa-1593b7d05c2f@googlegroups.com> <mailman.603.1376584227.1251.python-list@python.org> |
| Message-ID | <cc5504bf-a518-4dde-aeaa-77f2535b85e1@googlegroups.com> (permalink) |
| Subject | Re: "Nested" virtual environments |
| From | Luca Cerone <luca.cerone@gmail.com> |
Thanks Marcel, I will give it a try during the weekend and let you know if it worked for me :) > > 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....@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 | 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