1

Possible Duplicate:
Upgrade python without breaking yum

I'm running a Redhat VM (2.6.18-274.el5 64 bit). I installed nodejs on the vm in order to use browserstack. To get nodejs running I had to upgrade Python to 2.6 or above. I installed 2.7 from source using make altinstall. Then I createda hard-link to point from 2.4 to 2.7. Checking the python -V now shows 2.7 being the default. That all worked out fine and node is now up and running.

There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named yum

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.7.2 (default, Jul  2 2012, 23:35:52) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)]

If you cannot solve this problem yourself, please go to 
the yum faq at:
  http://wiki.linux.duke.edu/YumFaq

My problem is Yum. It's no longer working as its looking for the older version of Python which is 2.4? Is there anyway I can have both of them working as in Yum and node both using different versions?

Community
  • 1
  • 1
DanyZift
  • 647
  • 1
  • 7
  • 11
  • 2
    You shouldn't try to replace the system python on a redhat machine. Instead, you can install a newer python in, e.g., /usr/local, and use it for the scripts that require it. – Wooble Jul 02 '12 at 17:18

2 Answers2

1

There are two issues here. One is that you broke your system python. Yum is installed in the python's site packages. If you damage python, yum will break. Breaking the system python installation is a stupid idea. Maybe you made backups, or have another sister machine from which you can transplant the original 2.4 python.

The other issue is that there is no problem with having several pythons on the same machine. To install Node.js you must simply tell it which python to use. Set PYTHON=/opt/local/my/path/to/python2.7/bin/python, possibly PYTHONHOME as well, before running ./configure .

Tadeusz A. Kadłubowski
  • 8,047
  • 1
  • 30
  • 37
  • Tadeusz, I dont think there is a problem. I should be able to delete the hard link and revert back to the 2.4 python that is in the /usr/bin folder unless I am missing something here? Will removing the hard link help in this case or is there any other options? – DanyZift Jul 02 '12 at 20:11
  • just as a side note, I experienced this same problem when the RHEL 6.8 - 7.3 upgrade tool refused to upgrade until I removed python. Finally got my new rhel 7.3 and no package manager even though it installed python 2.7.8 and it was complaining about not finding python 2.7.8. – cs_alumnus Feb 08 '17 at 06:44
0

You should never overwrite the system Python; too many scripts rely on knowing the behavior of that interpreter. You can have a newer version of Python installed in /usr/local, and then use the Python package virtualenv to further isolate your environments as needed.

asthasr
  • 9,125
  • 1
  • 29
  • 43
  • The original python is still on the system in the /usr/bin directory. The 2.7 was installed in the /usr/local/bin directory. Will removing the hard link not revert back to the previous or will I have to install the original version via a force install? – DanyZift Jul 02 '12 at 18:44
  • Try it. It depends on if you did anything beyond just linking, which I can't really tell. – asthasr Jul 02 '12 at 19:18