Best way to share virtual environment definitions

Jul 25, 2013 at 12:01 AM
I like that the newest version of the tool let's you create virtual environments inside a project. But if I create an environment with more than a few packages, what is the best way to share this environment with another developer? In other words what is the minimum set that I would need to check into a version control system so that someone else can easily re-create the same environment on another machine?

Thank you.
Jul 25, 2013 at 9:39 PM
Right now, the easiest answer is "all of it" (or more precisely, all of it except .pyc and .pyo). We don't (yet) have support for recreating a virtual environment, so the only option is to share all the files. (There's also a hidden ".ptvs" folder that you probably want to exclude - this contains our cached analysis database, and we will recreate it when we need it.)

Unfortunately, because of how virtualenv works, it isn't easy to transfer them between machines. When created, a lot of absolute paths are written into the scripts that make up the environment. We work around these where we can, but you may see issues if the environment is not located in exactly the same path on both machines. The best advice is to avoid using the command line and stick to using VS except on the machine where it was created.

The virtualenv development team (who are completely unassociated with us) are aware of this problem, so we may get an update that will resolve it in the future.
Nov 27, 2013 at 1:59 PM
You may provide in the future some hooks (like after adding a new python package), so the developer would be free to find a simple solution (like using pip freeze > requirements.txt). Do you have any plans regarding such a feature?

best regards
Nov 27, 2013 at 3:23 PM