Anselm Kruis edited this page Oct 9, 2018 · 6 revisions

How to build Stackless for (Ana-)Conda

The most important ready to use Python distribution of today is probably Anaconda or its little cousin Miniconda, which is a subset of Anaconda. I'll use the term :dfn:`Conda` to refer to both of them. The vendor of Conda is Continuum Analytics, Inc..

A Conda installation contains packages. Packages come from channels. The channel defaults provides official packages from the vendor. It is possible use other channels to provide additional packages like Stackless. Stackless uses the channel stackless. It provides a package named python, that contains Stackless-Python and replaces the package 'python' from channel defaults.

Before you can use Stackless Python you must add the channel stackless to your Conda environment.:

conda --add channels stackless

Because the Stackless Python must be used instead of the regular C-Python, the Conda feature mechanism is used to select the Stackless python package over the regular python package. This mechanism requires two packages: a Conda (meta-) package tracks a feature with a certain name. This causes the Conda package manager to prefer packages which provide the feature over packages without the feature. For Stackless we provide the meta-package stackless, which tracks the feature named stackless. Our python-packages provide the feature stackless.

Building the meta package stackless

This package is trivial, because it does nothing but tracking the feature stackless. There is no need to change or rebuild this package. The build recipe is included into the package archives.

Building the package python

This documentation assumes, that you are familiar with the Conda build instructions.

Because the Stackless python package is a drop in replacement for the python package from Continuum, it is very important to use a build procedure, that creates a comparable result. Fortunately Continuum publishes build instructions on GitHub. The project AnacondaRecipes/python-feedstock contains the recipes for their official Python packages. Each Python version has its own branch. I forked AnacondaRecipes/python-feedstock as stackless-dev/anaconda-python-feedstock and modified the recipes to use Stackless Python. Additionally I added a build script Stackless branch names have the suffix -slp (i.e. master-2.7-slp).

Building on Linux

You need a host with a recent miniconda installation. Build steps:

  1. Activate miniconda;
  2. check out the appropriate branch from stackless-dev/anaconda-python-feedstock
  3. Run the build script: $ ./

It downloads dependencies and sources and builds the python package in $CONDA_PREFIX/conda-bld/$ARCH/. You can use the command anaconda upload to upload the created package into the anaconda cloud.

Building on Windows

Fortunately the process is exactly the same as on Linux. But you need additional Software:

  1. Microsoft Visual Studio 2015 Professional (or any other version that supports PGO)
  2. Microsoft Visual Studio 2008 (only for Stackless version 2.7)
  3. Windows 10 SDK (ver. 10.0.15063.468) available from
  4. Git for Windows

Use the git-bash to run

Building for MacOS

I don't have a Mac. Therefore I use Travis CI to build the osx-64 packets. Make sure, that the file .travis.yml of the appropriate branch from stackless-dev/anaconda-python-feedstock is up to date and then trigger a build of that branch using the Travis GUI. Make sure, that the resulting package does not yet exist on Otherwise the upload fails. (Intentionally disabled builds on every push.) The uploaded package has the label "test". To install it use the command conda install --channel stackless/label/test python=$ver. If the package is ok, set the label to "main" in the anaconda UI.


As a smoke test I install and test stackless-testsuite and the Python extension package bitarray. It contains a C-extension and a test suite. The package is available as a precompiled conda package as well as a source only package on PyPi.

Commands used to test:

ver="3.6"  # or whatever your version is
# Setup of the test environment
command -v conda || exit 1
conda_dir="$(dirname "$(which conda)")"
conda remove --yes --all --name testenv
conda create --yes --name testenv
. "$conda_dir/activate" testenv
conda config --env --add channels stackless
conda install --yes stackless
conda install --yes python="$ver"  # or: conda install --yes --channel stackless/label/test python="$ver"
conda install --yes pip
python -m pip install -U pip
# Tests start here
python -m pip install git+
python -m unittest discover -v stackless_testsuite
conda install --yes bitarray
python -c "import stackless, bitarray; bitarray.test()"
conda uninstall --yes bitarray
python -m pip install --no-binary :all: bitarray
python -c "import stackless, bitarray; bitarray.test()"
# Cleanup
. "$conda_dir/deactivate"
conda remove --yes --all --name testenv
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.