<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>talino.org &#187; ubuntu</title>
	<atom:link href="http://www.talino.org/tag/ubuntu/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.talino.org</link>
	<description>Permanently under construction</description>
	<lastBuildDate>Sun, 23 May 2010 13:28:41 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Install Python 2.6.1 without trashing Ubuntu</title>
		<link>http://www.talino.org/tutorials/install-python-261-without-trashing-ubuntu/</link>
		<comments>http://www.talino.org/tutorials/install-python-261-without-trashing-ubuntu/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 20:33:01 +0000</pubDate>
		<dc:creator>Tal</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.talino.org/?p=105</guid>
		<description><![CDATA[<a href="/tutorials/install-python-261-without-trashing-ubuntu/"><img class="alignleft" src="/resources/images/tutorials/python261-ubuntu/thumbs/python261-ubuntu.jpg" alt="" /></a>Getting an independent Python 2.6.1 version running smoothly on <a href="http://www.ubuntu.com/">Ubuntu 8.10 ("Intrepid")</a>, without interfering with the system's reliance on Python 2.5 and without breaking the entire package dependency system.]]></description>
			<content:encoded><![CDATA[<p><a href="/tutorials/install-python-261-without-trashing-ubuntu/"><img class="alignleft" src="/resources/images/tutorials/python261-ubuntu/thumbs/python261-ubuntu.jpg" alt="" /></a>After <a href="http://python-forum.org/pythonforum/viewtopic.php?f=1&amp;t=10870&amp;start=0&amp;sid=a3a82a1171e4cd15e6544735d79d9f56">several</a> <a href="http://python-forum.org/pythonforum/viewtopic.php?f=1&amp;t=10924&amp;start=0&amp;sid=a3a82a1171e4cd15e6544735d79d9f56">trials</a> and <a href="http://python-forum.org/pythonforum/viewtopic.php?f=1&amp;t=10958&amp;start=0&amp;sid=a3a82a1171e4cd15e6544735d79d9f56">tribulations</a>, I finally managed to get an independent Python 2.6.1 version running smoothly on <a href="http://www.ubuntu.com/">Ubuntu 8.10 (&#8220;Intrepid&#8221;)</a>, without interfering with the system&#8217;s reliance on Python 2.5 and without breaking the entire package dependency system. The procedure described here has been successfully carried out on the <a href="http://www.geteasypeasy.com/">Easy Peasy</a> distribution of Ubuntu (ex-&#8221;Ubuntu-eee&#8221;), specifically tailored for the <a href="http://eeepc.asus.com/">Asus EEE-PC</a>. It should work, though, with any other 8.10 version of Ubuntu. It has also been tested successfully on Ubuntu 8.04 (&#8220;Hardy&#8221;).<br />
<span id="more-105"></span><br />
A lot of the following information will be obvious to people with a thorough knowledge of both Linux and Python. However, coming from Mac OSX, things haven&#8217;t been that obvious. For the poor souls who will be frantically googling for &#8220;zlib&#8221;, &#8220;zipimport.ZipImportError&#8221;, &#8220;setuptools&#8221;, &#8220;ipython&#8221;, &#8220;readline&#8221; and &#8220;ubuntu&#8221;, I offer a series of steps which, so far, haven&#8217;t disturbed the operating system and allow one to run the essential <a href="http://ipython.scipy.org/moin/">IPython</a> environment (and a lot more) without pulling one&#8217;s hair out. It&#8217;s actually quick and easy and involves no hacking whatsoever (I wouldn&#8217;t know how to hack either Python or Linux anyhow).</p>
<p>DISCLAIMER: My knowledge of linux is superficial. I write the following with the intent of helping out newbies such as myself. Do not hold me reponsible if you follow my method and end up with a system that&#8217;s pushing up the daisies.</p>
<p>NOTE: This method has been tested on <a href="http://www.gnome.org/">GNOME</a>, the default desktop environment for my distribution. I haven&#8217;t tried it with <a href="http://www.kde.org/">KDE</a> and, now that it&#8217;s finally working, I don&#8217;t think I will.</p>
<p>ACKNOWLEDGEMENT: I would never have gotten Python 2.6.1 and Ubuntu to work together if it hadn&#8217;t been for the precious help of wacky, a member of the <a href="http://www.python-forum.org/pythonforum/index.php">Python forum</a>, who saw me through several nightmarish reinstallations of both Ubuntu and Python. Several of his suggestions have been incorporated into the steps below.</p>
<p>I suggest you read through the entire list of steps so that you have an idea of what&#8217;s going to happen before actually running any command.</p>
<ol>
<li>Install a fresh copy of Ubuntu 8.10 if your system has been hopelessly pulverized by repeated tests, errors and packages scattered in the wrong places.</li>
<li>Before doing anything directly related to Python, you need to install the packages listed below. The list is an amalgam of several suggestions I found around the web, so one package or more might not be absolutely essential. But since it works, here&#8217;s the list:
<ul>
<li>build-essential</li>
<li>libncursesw5-dev</li>
<li>libreadline5-dev</li>
<li>libssl-dev</li>
<li>libgdbm-dev</li>
<li>libbz2-dev</li>
<li>libc6-dev</li>
<li>libsqlite3-dev</li>
<li>libdb-dev</li>
<li>tk-dev</li>
</ul>
<p>The easiest way to install a package is to use the <em>aptitude</em> command. Make sure you&#8217;re connected to the internet, open a terminal session and type the following: <code>sudo aptitude install package-name</code> You will be prompted for your password the first time you invoke the <em>sudo</em> command, which executes everything typed after it as a &#8220;superuser&#8221; (or &#8220;root&#8221; user). Instead of entering the command for each and every package, you can may prefer to enter them all at once (all of the following should be typed on a single line): <code>sudo aptitude install build-essential libncursesw5-dev libreadline5-dev libssl-dev libgdbm-dev libbz2-dev libc6-dev libsqlite3-dev libdb-dev tk-dev</code></li>
<li>Download and extract the <a href="http://www.python.org/download/">Python 2.6.1 source</a>. From inside the source directory, enter (still and always, one single line):<br />
<code>./configure --prefix=/home/yourusername/python/2.6</code>This will setup Python to install into a &#8216;python/2.6&#8242; directory inside your home directory, far away from anything system-like. You may choose to simply name the directory &#8216;python&#8217;, but the &#8216;2.6&#8242; subdirectory will help separate the installation from yet another custom setup, such as version 3.0, if you ever need to install one. Note, though, that this doesn&#8217;t mean I&#8217;ve tested the steps described in this tutorial with Python 3.0.</li>
<li>Compile Python with the standard command:<code>make</code>When the compile process finishes, read the few last lines it printed: you might get a couple of modules which can&#8217;t be found. I don&#8217;t remember their names but from searching around I gather that a lot of people can&#8217;t seem to find them and that nobody really cares. Most importantly, make sure that you don&#8217;t get a module missing error for <em>zlib</em> or <em>readline</em>, which are essential for the following steps. The packages installed previously will have taken care of that, though.</li>
<li>Install Python. I tried to do a <em>make altinstall</em> (after going through the Python source readme file), but for some reason I ended up without an executable. So just go through a regular install. Since you&#8217;re installing the Python files into your home directory, you don&#8217;t need to use <em>sudo</em>:<br />
<code>make install</code></li>
<li>Now, if you enter <em>python</em> in the terminal you should get the default Python version that comes with Ubuntu (currently 2.5.2). Typing <em>which python</em> should point to /usr/bin/python, not to the directory you just installed 2.6.1 into. All of this is normal and is actually what you&#8217;re looking for.</li>
<li>Optional: if you need an additional Python module (such as <a href="http://numpy.scipy.org/">Numpy</a>), install it from its source directory by typing: <code>/home/yourusername/python/2.6/bin/python setup.py install --prefix=/home/yourusername/python/2.6</code> This runs the setup script using the 2.6.1 interpreter and installs the module into the 2.6.1 directory structure (since we&#8217;re using the same prefix we specified when installing Python itself).</li>
<li>Create a symbolic link to the 2.6.1 interpreter so that the next step doesn&#8217;t blow up in your face: <code>sudo ln -s /home/yourusername/python/2.6/bin/python /usr/local/bin/python2.6</code> It is important that you <strong>do not</strong> use a different name of your fancy for the link. Now, if you enter <em>python</em> you&#8217;ll still have 2.5.2, whereas entering <em>python2.6</em> will launch, well, 2.6.1. This will also make sure that non-system versions of Python have to be run explicitly. Keeping the &#8216;python&#8217; command reserved for the exclusive use of the system&#8217;s Python version is likely to avoid headaches in the future.</li>
<li>In order to use the <em>easy_install</em> command which facilitates the installation of additional modules, you first need to install <a href="http://peak.telecommunity.com/DevCenter/setuptools">setuptools</a>: download the <a href="http://pypi.python.org/pypi/setuptools#downloads">egg file</a> for Python 2.6 and enter: <code>sh setuptools-0.6c9-py2.6.egg</code> This is the reason why the symbolic link created in the previous step must be called &#8216;python2.6&#8242; (the setuptools script runs a <em>python2.6 exec</em> command and will complain about a missing 2.6 version if it&#8217;s not linked with &#8216;python2.6&#8242;).</li>
<li>Optional but highly recommended: install <a href="http://ipython.scipy.org/moin/">IPython</a>, an enhanced command-line environment for Python. Do not download anything manually. With <em>setuptools</em> installed, you can simply go into your Python <em>bin</em> directory (with <em>cd /home/yourusername/python/2.6/bin</em>) and type: <code>./easy_install IPython</code>Apparently you may also enter the following directly, which saves you the directory switching part: <code>easy_install-2.6 IPython</code> I haven&#8217;t tried it myself, though. Anyway, download and install will be automatic.</li>
<li>You have to add the path to IPython to your terminal environment, so that the executable can be launched from any directory. Add the following line to the end of the <em>.bashrc</em> file which is located in your home directory. <code>PATH=$PATH:/home/yourusername/python/2.6/bin</code> I suppose you could create a symbolic link instead but i haven&#8217;t tried it.</li>
<li>If you use <a href="http://www.geany.org/">Geany</a> for Python development, you need to edit one of its configuration files so that the application&#8217;s <em>Run</em> command executes the proper interpreter: <code>sudo gedit /usr/share/geany/filetypes.python</code> Modify the <em>run_cmd</em> line to read: <code>run_cmd=python2.6 "%f"</code> This will use the symbolic link you created earlier.</li>
</ol>
<p>You can now run IPython, develop in the Geany IDE, and still install packages through aptitude or the Synaptic Package Manager without all hell breaking loose. If you&#8217;re using a tiny screen and touchpad I strongly recommend installing <a href="http://do.davebsd.com/">GNOME Do</a> to avoid mousing around too much. Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.talino.org/tutorials/install-python-261-without-trashing-ubuntu/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
