virtualenv question: include just a few site packages

Jean-Michel Pichavant jeanmichel at
Thu Oct 9 15:19:29 CEST 2014

----- Original Message -----
> From: "Gelonida N" <gelonida at>
> To: python-list at
> Sent: Thursday, 9 October, 2014 12:09:50 AM
> Subject: virtualenv question: include just a few site packages
> virtualenv has the switch
> --system-site-packages (including all system site pacgaes)
> and the switch
> --no-site-packages (to expclude all site packages)
> Does anyone know an easy way to include just a few site-packages?
> for example (PySide, but not PyQt)
> The reason I'm asking is following.
> Some site packages  are sometimes raher huge or sometimes refuse to
> compile on certain hosts.
> as these packages are already part of the site packages I'd like to
> include them.
> You might wonder why I care whether I have more site packages than I
> need. As long as I don't import them,  I shouldn't care about it.
> If I really wanted to replace a version I could use pip install -U.
> However sometimes I'd like to have a test environment where want to
> be
> sure, that no module can find certain other modules. so they should
> not
> be visible.
> at the moment I make some experiments with pyinstaller and the module
> pythonqtbindings. and there I'd like to be sure that no PuQt files
> end
> up in the generated code.
> The only idea, that I have so far is to
> run virutalanv with --system-side-packages and to manually remove
> modules I don't want or to
> run virtualenv without this switch and to manually add links for site
> packages, taht I want. both options don't really feel right for me.
> Is there any other way?

You could build a virtual machine, installing only your VIP modules, and create virtual environment on this virtual machine, using the system site packages.



The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

More information about the Python-list mailing list