Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Since Ubuntu 10.04 is an LTS release will it support python 2.7 as a default package maintainer version or at least have a python2.7 package in future?

Since it will be the last major python 2.x release and is intended to remain in place for a long time, I decided to use it. I compiled it from source (After building deps of course) but now and then I find small problems.

Is it safe to define my compiled python 2.7 as the default, as there are some distribution applications that work on python.

share|improve this question
add comment

5 Answers

up vote 15 down vote accepted

No, it's not considered safe to define 2.7 as your default Python interpreter in Lucid. And I don't think it will be in the future.

  • There are no major version upgrades of any software in one release.

    So python2.7 will not replace 2.6 as the default interpreter. This kind of upgrade is only done between versions, within one - especially an LTS - there are only so called stable release upgrades, i.e. bugfixes and security related upgrades.

However, it's perfectly safe to use python2.7, defining your interpreter as #!/usr/bin/python2.7 and having users install it using make altinstall on the python source, alongside python2.6

share|improve this answer
add comment

This resolved all sorts of problem I was having http://stackoverflow.com/questions/7561221/undefined-symbol-pyobject-nextnotimplemented-error-when-loading-psycopg2-modu.

Now libpython2.7.so.1.0 is linking to my python2.7 etc all appears to be happier.

Last piece I needed to figure it out was mod_wsgi installation. If you simply issue:

$ apt-get install libapache2-mod-wsgi

Then this will be compiled for Python2.6 :(

$ ldd /usr/lib/apache2/modules/mod_wsgi.so

libpython2.6.so.1.0 => /usr/lib/libpython2.6.so.1.0 (0x00178000)

So I followed instruction provided by Gork-Zope here.

I have finally a working server. Thank you.

share|improve this answer
add comment

Had the same problem with a VPS that can't be upgraded to Maverick (even the new LTS images aren't always made available on time). Marius' answer did the trick to get me started, but it should be expanded upon:

Add the PPA to your sources

If you're in my situation, the simple advice of running add-apt-repository won't work for you. So let's do this the old-fashioned way:

  1. Open the file /etc/apt/sources.list (you need root privileges; if you're on the shell, this probably means running sudo vim /etc/apt/sources.list).

  2. Go all the way to the bottom of the file (if using vim, switch to insert mode by pressing i) and add the following lines:

    deb http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu lucid main 
    deb-src http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu lucid main 
    
  3. Save and exit (in vim: type :wq) and go back to a shell.

  4. Enter the following (you can find the correct key at the PPA; it's the part after the slash in the "technical details" -- make sure you got the right one):

    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DB82666C
    
  5. Now enter the following to update your source list:

    sudo apt-get update
    

Install and set up Python 2.7

  1. Open up a shell on your server and enter the following:

    sudo apt-get install python2.7 python2.7-dev
    
  2. To get easy_install working, get the distribute bootscrap script:

    curl -O http://python-distribute.org/distribute_setup.py
    python2.7 distribute_setup.py
    
  3. Finally, you want pip and virtualenv working if you plan to do anything serious:

    easy_install-2.7 pip
    pip-2.7 install virtualenv
    

Setting up a virtualenv

  1. Create the folder for your new environment and open it:

    mkdir my_env && cd my_env
    
  2. Create the virtual environment itself (the dot indicates the current directory is the location of the environment, replace it with the correct path if you skipped the previous step):

    virtualenv --no-site-packages --python=python2.7 .
    
  3. Activate the environment. You'll notice the shell prompt changes to reflect the active environment:

    source bin/activate
    
  4. Whatever you do in this shell now will use the scripts in the virtual environment's bin folder and that environment's Python packages. Keep in mind the option --no-site-packages means you're starting with the minimal set of packages (including pip, however), so you need to install all packages you'll need.

  5. When you're done, deactivate the environment (this is a command recognized by the active environment):

    deactivate
    

You can also install packages into the virtual environment by passing the -E option to pip (e.g. pip install some-package -E /path/to/virtual/environment to install some-package to the virtual environment on the given path). Keep in mind you'll have several different versions of pip corresponding to the different Python versions installed.

It's a good idea to use pip-2.7 if you want to install packages for Python 2.7 when working outside a virtual environment (the --python=python2.7 option we passed to virtualenv means the virtual environment will use the Python 2.7 versions of the tools it provides, so you don't have to worry about that).

share|improve this answer
    
In my case I had already installed pip for 2.6, and I had to easy_install-2.7 -U pip to force the install of the 2.7 version. But thanks, this is a great help! –  Gabe Moothart Sep 27 '12 at 0:41
add comment

There's a PPA with Python 2.7 built for Ubuntu 10.04. It may be safer/more convenient than building from source.

share|improve this answer
add comment

i do not think so since it will need to change many of the programs and libraries associated with the 10.04 version. Actually many of the work in Ubuntu is made using a specific python version. Changing it to python would change a lot of system files.

For 10.10 it is available from synaptic/aptitude just by installing python2.7 (you can also install 3 and 3.1) but for 10.04 there is no work made to make it out for 10.04.

10.10 has python 2.6 as the default. Sorry if the answer was not positive but just wanted to give you an idea of the changes.

EDIT - Changed Python 2.7 to Python 2.6 as default since it was double checked from the comments below. Thank you.

share|improve this answer
    
I just checked out 10.10 in virtual box, it has python 2.6.6 by default, though there are 2.7 packages available for maverick. I think its 11.04 which has it as default. I generally keep on updating and changing distros but was considering to stick on 10.04, for its long term support and my customizations. –  crodjer Dec 17 '10 at 8:06
    
yep, 11.04 has 2.7 per default since a few days –  Stefano Palazzo Dec 17 '10 at 8:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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