Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52558

Re: "Nested" virtual environments

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <marcelgmr@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.014
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'scipy': 0.05; '(using': 0.07; 'environments': 0.07; 'advance': 0.07; 'matplotlib': 0.09; 'reinstall': 0.09; 'skip:/ 10': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '[2].': 0.16; 'nest': 0.16; 'numpy': 0.16; 'scipy,': 0.16; 'subject:virtual': 0.16; 'all,': 0.19; 'packages.': 0.19; 'email addr:gmail.com&gt;': 0.22; 'cc:addr:python.org': 0.22; 'install': 0.23; 'directory.': 0.24; 'environment': 0.24; 'cc:2**0': 0.24; 'source': 0.25; '&gt;': 0.26; 'compiled': 0.26; 'header:In-Reply-To:1': 0.27; 'wondering': 0.29; '(this': 0.29; '[1]': 0.29; '[2]': 0.30; 'friends,': 0.30; 'programming.': 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'getting': 0.31; 'safely': 0.31; 'file': 0.32; 'url:python': 0.33; '(e.g.': 0.33; 'common': 0.35; 'created': 0.35; 'something': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'version': 0.36; 'installing': 0.36; 'url:listinfo': 0.36; 'thanks': 0.36; 'url:org': 0.36; 'should': 0.36; 'virtual': 0.37; 'requirements': 0.37; 'skip:- 20': 0.37; 'project': 0.37; 'easily': 0.37; 'skip:& 10': 0.38; 'skip:- 10': 0.38; 'recent': 0.39; 'skip:& 20': 0.39; 'environment.': 0.39; 'help,': 0.39; 'subject:" ': 0.39; 'delete': 0.39; 'url:mail': 0.40; 'how': 0.40; 'even': 0.60; 'solve': 0.60; 'then,': 0.60; 'new': 0.61; 'first': 0.61; 'save': 0.62; 'different': 0.65; 'dear': 0.65; 'to:addr:gmail.com': 0.65; 'here': 0.66; 'received:mail-ob0-x22d.google.com': 0.84; 'wheel': 0.84; 'url:latest': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=9DboNWD+vQJ16TFX8IeFuOwiXl38YjtHssd0v3gRYUA=; b=SIYz8IlZpplO5lHNUZ4DXoAEOgZHOu2Ugzdit0zX1D+wVddP5OjwMhgasdAT1AzLGj AYpSMuEUcEa77CxeYwWGQ2b8tuRpO37SMiweswRJdVSm9APdycX/iGvIE0lUyiQa9NHI GBNci71p0bmhZoBc0jV+kCKFsfo5PX6Rs9sRxp/IOGD9nLXQPtlQlsdYU6giJTrFgLu5 53a0F89V/ID9+j6/HVENFcAZEqQUrrP6hOjwx40NWU/0zy7HvRhE5IrjPeolhP6XTCiZ LL4lUCgIIEhf1+X21Sw5NC6WiiF7b3XOXrCqTAhCy/lIbHbH29B5m15ezOndAYYHaxWO aVbQ==
MIME-Version 1.0
X-Received by 10.60.69.137 with SMTP id e9mr533377oeu.80.1376584218487; Thu, 15 Aug 2013 09:30:18 -0700 (PDT)
In-Reply-To <18c0a8bb-9295-493b-b0aa-1593b7d05c2f@googlegroups.com>
References <18c0a8bb-9295-493b-b0aa-1593b7d05c2f@googlegroups.com>
Date Thu, 15 Aug 2013 13:30:18 -0300
Subject Re: "Nested" virtual environments
From Marcel Rodrigues <marcelgmr@gmail.com>
To Luca Cerone <luca.cerone@gmail.com>
Content-Type multipart/alternative; boundary=001a11330e2258b02504e3fefdcd
Cc python-list <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.603.1376584227.1251.python-list@python.org> (permalink)
Lines 146
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1376584227 news.xs4all.nl 15916 [2001:888:2000:d::a6]:49555
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:52558

Show key headers only | View raw


[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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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