Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    1

    Default Python Python 2.7.1 Installation

    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. #2
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: Python Python 2.7.1 Installation

    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?
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  3. #3
    Member
    Join Date
    Oct 2006
    Posts
    6

    Default Re: Python Python 2.7.1 Installation

    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. #4
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: Python Python 2.7.1 Installation

    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.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  5. #5
    Member
    Join Date
    Aug 2010
    Location
    India
    Posts
    238
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: Python Python 2.7.1 Installation

    Hello,

    You may go through the below URL, that has some patched RPMs

    RHEL5 / CentOS5 RPMs for Python 2.5 and 2.6 | The Second Order Effect

    PS. test things before implementing it on a production server

    Thank you.

  6. #6
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: Python Python 2.7.1 Installation

    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.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  7. #7
    Member
    Join Date
    Oct 2006
    Posts
    6

    Default Re: Python Python 2.7.1 Installation

    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. #8
    Member
    Join Date
    Jan 2011
    Posts
    13

    Default Re: Python Python 2.7.1 Installation

    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. #9
    Member
    Join Date
    Feb 2005
    Posts
    223

    Default Re: Python Python 2.7.1 Installation

    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. #10
    Member
    Join Date
    Feb 2005
    Posts
    223

    Default Re: Python Python 2.7.1 Installation

    I just got things up and running with python2.7 and mod_wsgi being properly compiled with an easy_apache module. All dialed in for WHM/cPanel. Wrote it up here:

    Building mod_wsgi through EasyApache for WHM/cPanel systems

    Hope someone finds it useful!

Similar Threads & Tags
Similar threads

  1. Python
    By nibb in forum cPanel and WHM Discussions
    Replies: 16
    Last Post: 06-25-2008, 09:55 AM
  2. python installation
    By Secret Agent in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 06-15-2005, 03:30 AM
  3. python 2.3.x?
    By candrews in forum cPanel Developers
    Replies: 0
    Last Post: 10-09-2003, 11:10 AM
  4. Python 2.2.1
    By Aerosmith in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 05-13-2003, 08:33 AM
  5. python
    By rich2 in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 11-05-2002, 03:36 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube