0

I have to copy a couple of projects to a different server that have their own virtual environments (virtualenv).

So, what would be a good way of recreating those virtual environments on that different server, something tells me that they wont work out of the box.

Can I just delete the one that is there and make a new one? Or can I just use it even though it was copied to a different location?

Tnx, Tom

Tomislav Mikulin
  • 5,306
  • 4
  • 23
  • 36
  • Possible duplicate of [How to Copy/Clone a Virtual Environment from Server to Local Machine](https://stackoverflow.com/questions/9207430/how-to-copy-clone-a-virtual-environment-from-server-to-local-machine) – phd Oct 31 '17 at 15:04

1 Answers1

1

Yes, you can delete one and create new env on the other server. Just make sure you have list of dependencies. You can create this list by activating your environment and typing:

pip freeze > requirements.txt

Later on, if you want to install those dependencies just activate new env and type

pip install -r requirements.txt

All libraries will be installed with proper version. Example output of the pip freeze command:

pip freeze                                            
adium-theme-ubuntu==0.3.4
ansible==2.4.0.0
backports.ssl-match-hostname==3.5.0.1
certifi==2017.4.17
cffi==1.9.1
chardet==3.0.4
checksumdir==1.1.4
click==6.7
cryptography==1.7.1
Laszlowaty
  • 1,295
  • 2
  • 11
  • 19
  • yes I already have the requirements file, so when I create and activate the new virtualenv I will just pip install -r requirements.txt – Tomislav Mikulin Oct 31 '17 at 11:12