The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Python Python 2.7.1 Installation

Discussion in 'General Discussion' started by sgate1, Jan 24, 2011.

  1. sgate1

    sgate1 Registered

    Joined:
    Jan 24, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    How would you install Python 2.7.1 without blowing up cPanel and WHM. Is there step by step instructions on how to do this?
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Are you going to be using Mailman on the machine? I wouldn't suggest changing Python if you are using Mailman on the machine.

    Additionally, yum relies on Python. If you end up changing the needed Python version to use yum and then break yum, your system won't be able to update system packages at that point.

    Those are just a few points to keep in mind. Given those caveats, I'm a bit leery of providing details on how to update Python, since I'd then be responsible for Mailman and (more importantly) yum possibly breaking.

    Is there a specific reason you'd like to update Python?
     
  3. filmotheklown

    filmotheklown Member

    Joined:
    Oct 3, 2006
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Yes, I need to run python >= 2.5 for some scripts. Is it not possible to install a different version of Python into a different directory so as to avoid messing up cPanel.

    BTW Python 2.4 is circa 2005, so I don't think it's unreasonable to think that users of cPanel might want to have a more recent version available to them. 6 year old software is pretty stale. My version of WHM is showing Python 2.4.3 as the installed version.

    WHM 11.30.0 (build 32)
    CENTOS 5.6 i686 standard
     
  4. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Python 2.4 is the one provided by CentOS and RHEL as the one being used by yum. This isn't a cPanel issue for the version being used, it is an operating system one. We do not use newer versions than what the operating system requires since yum uses python. You can break yum functioning if python is updated as I already mentioned.
     
  5. NixTree

    NixTree Well-Known Member

    Joined:
    Aug 19, 2010
    Messages:
    387
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Gods Own Country
    cPanel Access Level:
    Root Administrator
  6. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    I agree 100% about testing before putting into production, since yum can break and, if yum breaks, we have a policy to not be able to assist in fixing it, since yum is part of the operating system rather than part of the control panel. Please be very aware that yum ceasing to function will break anything being able to update in the package system on the machine, including cPanel for EasyApache and other areas.
     
  7. filmotheklown

    filmotheklown Member

    Joined:
    Oct 3, 2006
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Hi, here's a link that allows you to install a separate version of Python 2.7

    Upgrading Python in Cpanel Servers | openhelp.net

    I stopped after Make Install and did not modify anything cpanel-ish. (the link provides instructions for modifying cpanel, but I did NOT follow it that far.)

    This allowed me to have a python 2.7 binary in the /usr/local/ folder which I can then modify my scripts to point to.

    Given that I did not modify the underlying python or any of the cpanel stuff on the link provided, I think I should still be okay as typing "python -V" still gives me "Python 2.4.3". In order to access 2.7 I have to use the following:

    /usr/local/python.2.7/bin/python -V
    Which gives "Python 2.7"

    Yum still appears to be working.

    yum --version
    3.2.22
    Installed: rpm-4.4.2.3-22.el5.i386 at 2011-05-03 06:20
    Built : [] at 2011-03-06 03:50
    Committed: Jindrich Novy <jnovy@redhat.com> at 2010-11-16 22:00

    Installed: yum-3.2.22-33.el5.centos.noarch at 2011-05-03 06:21
    Built : [] at 2011-01-31 23:12
    Committed: Karanbir Singh <kbsingh@centos.org> at 2011-01-31 22:00

    Installed: yum-metadata-parser-1.1.2-3.el5.centos.i386 at 2010-10-30 12:23
    Built : [] at 2009-08-27 16:20
    Committed: James Antill <james.antill@redhat.com> at 2009-04-06 22:00


    YMMV
     
  8. ServerMascot

    ServerMascot Member

    Joined:
    Jan 17, 2011
    Messages:
    13
    Likes Received:
    1
    Trophy Points:
    1
    cPanel installs python using yum/rpm which will be installed in /usr/bin (run which python). You can check this by running
    Code:
    rpm -qa python
    . You can install a different version of python using source by following the steps provided by filmotheklown . You can configure python through source installation by specifying prefix like /usr/local/bin/python. eg :
    Code:
    ./configure --prefix=/usr/local/bin/python
    . Later you can mention this python interpreter in your script to use this version.

    .
     
  9. shacker23

    shacker23 Well-Known Member

    Joined:
    Feb 20, 2005
    Messages:
    263
    Likes Received:
    1
    Trophy Points:
    16
    It's really easy to install a separate python without disturbing the system python. The bundled one is so old that the next version of Django won't even support it! Just download the python source from python.org into /usr/local/src and run as root:

    ./configure
    ./make install

    You'll end up with python2.7 in /usr/local/bin . You can then put this in your profile:

    PATH=/usr/local/bin:$PATH:$HOME/bin

    so that the new version is seen by the shell before the system version. Likewise, if you need to compile mod_wsgi, configure it to use the newer version.
     
  10. shacker23

    shacker23 Well-Known Member

    Joined:
    Feb 20, 2005
    Messages:
    263
    Likes Received:
    1
    Trophy Points:
    16
Loading...

Share This Page