Can I create a virtualenv offline (without internet) on CentOS/Redhat? if yes what are all the dependencies I've to download? with python 2.7
2 Answers
You can't create a virtualenv offline, nor can you easily install Python packages offline anyway.
What you can do is to create the virtualenv and install your desired packages from another CentOS machine connected to the Internet, and then copy the entire directory structure to the offline machine. Keep in mind that the path of the virtualenv directory is hardcoded into many files in the <virtualenv_name>/bin
directory, and if you need the directory to be different on the destination machine, you need to edit all these manually.

- 244,070
- 43
- 506
- 972
-
This is a bad idea. Moving around virtualenv's usually breaks them "even if the experimental --relocatable flag is set." – Josh Usre Feb 12 '19 at 22:57
-
@JoshUsre This is why I recommended having the identical path on each system. – Michael Hampton Feb 12 '19 at 22:59
You can use the --never-download option with virtualenv
virtualenv $YOUR_VENV_NAME --never-download --extra-search-dir=/path/to/eggs
--extra-search-dir is to be used if you have extra eggs that can be installed from a custom location. --never-download option forbids virtualenv from connecting to the internet.