Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Copy/Clone a Virtual Environment from Server to Local Machine

I have an existing Python django Project running in Web Server. Now the client needs to make some changes in the existing code. So I need to set it up in my Local Machine. All the packages needed for this project is installed in a Virtual environment. How can I copy or clone this virtual environment to my Local machine to run this Project.

like image 244
Jubin Thomas Avatar asked Feb 09 '12 08:02

Jubin Thomas


People also ask

Can you share a virtual env?

sharing with partnersIf you want to share your virtualenv with a lab partner, you just need to allow read-execute access to the Envs directory and any files below that. All that's stored in there is the software you installed (e.g., with pip ), so it's OK to open up this directory for others to access.


2 Answers

  1. Run pip freeze > requirements.txt on the remote machine
  2. Copy that requirements.txt file to your local machine
  3. In your local virtual environment, run pip install -r requirements.txt

And, so long as all of the requirements are well behaved Python packages, you should be good to go.

like image 84
David Wolever Avatar answered Oct 11 '22 17:10

David Wolever


Please using Freeze command and you will get text file with all the versions of packages. Then install them using easy install or pip install

like image 45
Abin Abraham Avatar answered Oct 11 '22 18:10

Abin Abraham