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

18,977

Solution 1

  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.

Solution 2

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

Share:
18,977
Jubin Thomas
Author by

Jubin Thomas

Currently working as Software Engineer in Binary Fountain Inc. My Skills are: + PHP + Python + Django + Drupal My about.me profile is here, http://about.me/jubinthomas/

Updated on June 18, 2022

Comments

  • Jubin Thomas
    Jubin Thomas almost 2 years

    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.

  • Niclas Nilsson
    Niclas Nilsson about 12 years
    Did'nt know about pip freeze. Is that all packages that are installed on the machine. Or is it only those that are installed by pip?
  • David Wolever
    David Wolever about 12 years
    All of the packages installed on the machine (or in the virtual environment you're currently in).
  • Niclas Nilsson
    Niclas Nilsson about 12 years
    That is great. I missed that :-)
  • Jay Modi
    Jay Modi over 8 years
    What if you don't want to install them again ? Can you copy installed package library in new virtual environment's location ?
  • Wesley Ranger
    Wesley Ranger about 7 years
    What if I want to copy the entire environment to an offline computer?
  • Akshay Gehi
    Akshay Gehi over 2 years
    This would work only for PyPI available packages right? If there are any custom libraries those would be missed isn't it