Installing Python 3.0 on Ubuntu 8.10 Intrepid Ibex

UPDATE (Dec, 7): apt-get install python3 works now. this might be the prefered way for most of us.

Based on sofen’s blog’s post about python 2.6

This was the easiest thing I did recently. It went so smooth that this post is totally redundant.

Seven commands and you are all unicode.

Step 1: Make sure you got all the prerequisites

$ sudo apt-get install build-essential libncursesw5-dev libreadline5-dev libssl-dev libgdbm-dev libbz2-dev libc6-dev libsqlite3-dev tk-dev g++ gcc

Step 2: Grab the bits, extract them and build them

$ wget http://www.python.org/ftp/python/3.0/Python-3.0.tgz
$ tar xvzf Python-3.0.tgz
$ cd Python-3.0/
$ ./configure
$ make
$ sudo make install

That’s it my friend. You now have the best software development platform in the entire universe!

$ python3.0
Python 3.0 (r30:67503, Dec  4 2008, 21:27:40)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

Good luck and enjoy the sweetness of open source software!


21 Comments on “Installing Python 3.0 on Ubuntu 8.10 Intrepid Ibex”

  1. sebn says:

    The following modules failed for me: _dbm _tkinter

    Solution for _dbm: http://bugs.python.org/issue4483
    $ cd Python-3.0/
    $ wget http://bugs.python.org/file12234/dbm.diff
    $ patch -p0 < dbm.diff
    $ ./configure –prefix=/usr/local

    Solution for _tkinter:
    $ sudo apt-get install tk8.5 tk8.5-dev

  2. `make install` is evil because its result is unmanageable. Thus, in many cases there is even no way to uninstall such software. Not to mention such things as dependencies etc.

    The proper way is getting the source package using ‘apt-get source python3.0’ and tweaking it to work with newer upstream source.

    However, this can be more difficult and to make a halfway you may build the package from source using checkinstall. Alternatively, it’s possible to use equivs to trick the package management system: http://www.debian.org/doc/manuals/apt-howto/ch-helpers.en.html

    Best Regards,
    Timur

  3. Nick says:

    Thanks, easy to understand and super simple guide. Helped me since I am a complete novice to both Ubuntu and Python, and I couldn’t make heads or tails of any official documentation.

  4. @sben, I will check this on a new installed machine and update this as necessary.
    @timur, checkinstall was the option in previous preview releases. Python 3.0 is now production ready and live side by side with previous installation.

  5. RM says:

    If you get any gcc errors try:

    sudo apt-get install libc6-dev g++ gcc

    before:

    $ ./configure

  6. @RM libc6-dev was listed, I added gcc and g++.
    Thanks

  7. Pyth0n says:

    [ot] For heaven’s sake. White JS snow on white background is just uselessly eating CPU cycles. Is this _really_ necessary?

  8. @Pyth0n. you are right. I just couldn’t find where to remove this crappy option. removed now anyway. that was annoying dude.

  9. Pyth0n says:

    Thank you for de-snowing!

    As a note to P3k on Ubuntu (and all other Debian spinoffs) – system management strongly depends on properly operating Python environment. I would suggest using
    make altinstall
    in place of
    make install
    as the latter may harm the system by overwriting default Python2.5 links. After use of “altinstall” you have P3k accessible as “python3.0”.

  10. As far as I experienced so far, make install keeps python 2.5 in place as the default.

  11. Bart says:

    As of today, ‘apt-get install python3’ installs RC3/Beta 3, not the release version.

  12. tutos Linux says:

    for the gcc :
    sudo apt-get install libc6-dev g++ gcc

    Tutos Linux

  13. gfdgdf says:

    IT installs RC3/Beta 3 and the best option is to install with altinstal option because
    as it is said it is ovewriting the default installation

  14. Clayton says:

    After running these scripts in terminal to install, are there any folders that can be deleted that are no longer necessary (other than the tar balls of course)?

  15. cae says:

    using apt-get install python3 is easy but after installing,

    python -V still shows Python 2.5.2

    how can we made ubuntu default to python 3 instead of 2.5.2?

  16. karlzt says:

    >>how can we made Ubuntu default to python 3 instead of 2.5.2?

    you can’t do that unless you want to make your own distribution

  17. from the sudo make install stdout

    * Note: not installed as ‘python’.
    * Use ‘make fullinstall’ to install as ‘python’.
    * However, ‘make fullinstall’ is discouraged,
    * as it will clobber your Python 2.x installation.

  18. jerzyo says:

    Hi, I am using ubuntu 8.04 and I want to install python 2.6 not python3
    What repositories do you use? Because I do not see any of the packages you are mentioning

    Jurek

  19. @jerzyo, I believe that is you will follow the steps and just replace the version 3.0 tarball with version 2.6 (http://python.org/ftp/python/2.6.1/Python-2.6.1.tgz) you will get the same results.

  20. Salma says:

    This post really helped me getting svn mailer going on ubuntu. After make install I ran

    sudo apt-get install python-subversion

    to install python bindings for svn and it all worked.

    Thanks

  21. kannan says:

    Hi Guys,

    Below are my experience, and the same working for Python 3

    I am use SLES 10.1 and which has python 2.4 and i was in process of installing python 2.7 as 2.7 is a bridge version to python 3

    But to install it i tried many ways, and finally attempted to try it installing from source.

    First i thought that installing from source will be of rocket science. But this is not true, atleast with Python.

    Here are the steps which i followed. ( even you can do these with out a root privilege)

    1) get the required version of python from official site, here i am using python 2.7.1. I am placing the source in /home/kannan/menporul

    2) create a directory where you need to install (/home/kannan/menporul/install) . as we already have python 2.4 our installation should not disturb this.

    3) untar the source, and configure the source as

    $ ./configure –prefix=/home/kannan/menporul/install/ –exec-prefix=/home/kannan/menporul/install/

    the –prefix and –exec-prefix tells where python needs to keep its libraries and packages ( the parth must be absoulte).

    4) To perform installation after this

    $ make altinstall

    This will install Python 2.7 in /home/kannan/menporul/install/ ( but this is where i got error previously)

    5) create a link for Python 2.7 binary to your bin directory

    $ cd ~/bin
    $ ln -sf /home/kannan/menporul/install/bin/python2.7

    6) Now you should have got all things set. If you have got any errors which i have mentioned in my previous post follow the below actions.

    install ‘readline-devel’ this is a development library files for readline package

    then restart from step 3.

    7) And also have easy_install installed in the system for easy install of python modules.

    get easy_install package for this location depending upon your python version Python Package Index : setuptools 0.6c11

    to install

    $ sh setuptools-0.6c11-py2.7.egg

    It should have got installed successfully.

    8) try to install any of the python module to check every thing is fine.

    $ easy_install [module name]

    Hope this will be helpful to you guys.

    Thanks,
    M. Kannan.


Leave a comment