Over a million developers have joined DZone.

Install Stackless Python on Ubuntu

· DevOps Zone

The DevOps zone is brought to you in partnership with Sonatype Nexus. The Nexus suite helps scale your DevOps delivery with continuous component intelligence integrated into development tools, including Eclipse, IntelliJ, Jenkins, Bamboo, SonarQube and more. Schedule a demo today

I'm just about to write a couple of posts on Stackless Python and theNagare Micro Framework which runs on it. So I've been installing Stackless on my Ubuntu 12.04. Here are some nice copy and paste instructions if you want to play along.

First install the required libraries and get stackless itself:

sudo run apt-get update
sudo apt-get install libreadline-dev
sudo apt-get build-dep python2.7
 
cd /tmp
wget http://www.stackless.com/binaries/stackless-272-export.tar.bz2
bunzip2 stackless-272-export.tar.bz2
tar xf stackless-272-export.tar

Now install stackless:

cd /tmp/stackless-272-export/
./configure --prefix=/opt/stackless --enable-unicode=ucs4
make 
sudo make install

After the "make" you'll see some failures as below. Just ignore them.

Python build finished, but the necessary bits to build these modules were not found:
_bsddb             bsddb185           dl
imageop            linuxaudiodev      ossaudiodev
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
 
 
Failed to build these modules:
_curses            _curses_panel

Now it's time to link your standard (CPython) packages so that they can be used with stackless:

sudo ln -s /usr/lib/python2.7/dist-packages/ /opt/stackless/lib/python2.7/site-packages
sudo ln -s /usr/local/lib/python2.7/dist-packages/ /opt/stackless/lib/python2.7/dist-packages
sudo ln -s  /opt/stackless/bin/python /usr/bin/stackless
sudo vi /opt/stackless/lib/python2.7/site.py

...and edit the paths in the site.py file. At about line 300, edit the file to look like this. It's the second sitepackages.append bit we're adding here:

       elif os.sep == '/':
            sitepackages.append(os.path.join(prefix, "lib",
                                        "python" + sys.version[:3],
                                        "site-packages"))
            sitepackages.append(os.path.join(prefix, "lib",
                                        "python" + sys.version[:3],
                                        "dist-packages"))
            sitepackages.append(os.path.join(prefix, "lib", "site-python"))

That should be it! Let's test it:

$stackless
 
Python 2.7.2 Stackless 3.1b3 060516 (default, Jan  2 2013, 22:39:14)
[GCC 4.6.3] on linux3
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()


The DevOps zone is brought to you in partnership with Sonatype Nexus. Use the Nexus Suite to automate your software supply chain and ensure you're using the highest quality open source components at every step of the development lifecycle. Get Nexus today

Topics:

Published at DZone with permission of Col Wilson, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}