I want to run some of my python scripts on my new Linux (Centos 6.5) machine that I developed on another Linux machine (also Centos 6.5). But my problem is that my new machine is not having internet connectivity and so I am not able to download all my required modules. Is there a way using which I can simply clone the Python configuration from one machine to another? For example saving image of the python configuration to a pendrive and then installing in new machine using image stored in pendrive? Clone Python from one Linux machine to another? I tried this but it did not work for me.

  • 1
    You could probably download the required rpms to the machine that is connected, then copy them over and install on the machine without connectivity. But a better alternative might be to burn some DVDs so you can just install directly from them. – Faheem Mitha Mar 31 '15 at 11:10
  • how to burn existing python configuration to DVD? – Bhoomika Sheth Mar 31 '15 at 11:12
  • You misunderstand. I just meant that you could burn the CentOS DVDs (which contain Centos rpms) and then use them for your machine that is not connected to the net. This would be a lot simpler and better than trying to copy stuff from other machines, which doesn't really make sense, imo. – Faheem Mitha Mar 31 '15 at 16:04
  1. Plug a pendrive on the CentOS host that have internet conectivity
  2. Mount the pendrive(depends on your hardware probing). Probably: mount /dev/sdb1 /media
  3. Create a dir inside your media to keep things clean mkdir /media/rpms
  4. Use yum to download the software you want with it's dependencies. Here:

yum install -y --downlaodonly --downloaddir=/media/rpms python

The last argument(packages) will vary depending on what python version you want, and what python modules you have installed on your system that needs to be replicated to the other host.

  1. Plug the usb on the machine with no internet connection, mount the pendrive and use the following command to install all the rpms downloaded: rpm -Uvh *rpm

All steps needs to be executed as root user.

Further Reading

  • nixCraft. How To Download a RPM Package Using yum Command Without Installing On Linux;
  • Ask.Fedora Project. How to install new software offline;
|improve this answer|||||
  • A big part of the question is what packages to select at step 4. – Gilles 'SO- stop being evil' Mar 31 '15 at 22:30
  • seems good. will try – Bhoomika Sheth Apr 1 '15 at 4:24
  • If it is just python, the command line at step 4 should be enough. If it is python3, and python with additional modules/eggs, you will have to add all packages needed. – user34720 Apr 6 '15 at 18:04

Just copied contents of following directories from machine to another. /usr/lib/python2.6/site-packages and /usr/lib64/python2.6/site-packages. And it worked for me.

|improve this answer|||||
  • This way you totally broke the meaning of having a package management tool to install things... – user34720 Apr 6 '15 at 18:03
  • @nwildner Given that the OP described these were self developed scripts, it is unlikely that they were installed with setup.py let alone with the unnecessary overhead of rpm/yum. – Anthon Apr 6 '15 at 18:37
  • Fair enough. But those scripts could be deployed somewhere else, and the python infrastructure installed through packages. It didn't sound clear enough if there are custom scripts inside python libs directory – user34720 Apr 6 '15 at 20:02
  • yes i know that it is not a correct way, but it worked for me – Bhoomika Sheth Apr 8 '15 at 11:47
  • how ever some i had to install some missing linux dependencies – Bhoomika Sheth Apr 15 '15 at 4:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.