Will python2.7 be available for 10.04 in the future?
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.
Solution 1:
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:
Open the file
/etc/apt/sources.list
(you need root privileges; if you're on the shell, this probably means runningsudo vim /etc/apt/sources.list
).-
Go all the way to the bottom of the file (if using
vim
, switch to insert mode by pressingi
) 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
Save and exit (in
vim
: type:wq
) and go back to a shell.-
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
-
Now enter the following to update your source list:
sudo apt-get update
Install and set up Python 2.7
-
Open up a shell on your server and enter the following:
sudo apt-get install python2.7 python2.7-dev
-
To get
easy_install
working, get thedistribute
bootscrap script:curl -O http://python-distribute.org/distribute_setup.py python2.7 distribute_setup.py
-
Finally, you want
pip
andvirtualenv
working if you plan to do anything serious:easy_install-2.7 pip pip-2.7 install virtualenv
Setting up a virtualenv
-
Create the folder for your new environment and open it:
mkdir my_env && cd my_env
-
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 .
-
Activate the environment. You'll notice the shell prompt changes to reflect the active environment:
source bin/activate
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 (includingpip
, however), so you need to install all packages you'll need.-
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).
Solution 2:
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
Solution 3:
There's a PPA with Python 2.7 built for Ubuntu 10.04. It may be safer/more convenient than building from source.
Solution 4:
This resolved all sorts of problem I was having https://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.
Solution 5:
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.