Installing Smil under Anaconda

It's possible to install Smil under Anaconda and it's a good idea. But some particular precautions shall be taken to avoid conflicts between libraries installed system-wide and those installed inside Anaconda.

Typically, you shall follow these steps :

Install Anaconda

Download and Install Anaconda

chmod +x

After some questions, Anaconda will be installed, and your shell configuration file ($HOME/.bashrc) will be modified. Anaconda tree will be placed, by default, at $HOME/anaconda3, but you can place it elsewhere, if you prefer.

If you'll compile Smil, you'll need to install other packages which aren't installed by default. Just type :

Additional packages

conda install gxx_linux-64 swig cmake

What if I want an older version of Python ?

Current Anaconda release comes with Python 3.7. If you want an older version, e.g. Python 3.5 or Python 2.7, the probably better way, is to create an environment for it, after installing Anaconda. just type :

Creating an environment for Python 2.7

conda create -n python27 python=2.7 
conda activate python27

Creating an environment for Python 3.5

conda create -n python35 python=3.5 
conda activate python35

You'll also need to install some packages specifics to this Python release. You'll need :

Additional packages

conda install gxx_linux-64 cmake swig libpng jpeg libtiff curl numpy ipython qt pyqt  

Compile and install Smil

There are two ways to configure building of Smil : using ccmake and with the shell script config-smil.

For the moment, the best way to configure Smil is with this shell script as it will take into account that you're inside an Anaconda and configure Smil accordingly.

Usage of this script is better explained at : Build configuration

When building Smil with Python, each instance of Smil is valid only for the version of Python it was linked. So, if you intend to run Smil with different versions of Python, you'll need to build as many instances of Smil as you have versions of Python.

The easiest way to do this is to use different prefixes. E.g. : /usr/local/Smil-2.7, /usr/local/Smil-3.5, /usr/local/Smil-3.7

Defining a prefix for Python 2.7

config-smil --prefix=/usr/local/Smil-27

Post Installation and Running

To ensure Smil will work as expected, you shall define the following environment variables.

Smil shell environment

export PYTHONPATH=/usr/local/lib/Smil

This will ensure that Smil will use all libraries installed by Anaconda and it will be able to find Smil Python modules.

The value assigned to be assigned to the environment variable PYTHONPATH is the concatenation of $PREFIX and /lib/Smil.

To check your just installed Smil, just launch ipython, create a simple image and show it :

Smil test

$ ipython
Python 2.7.16 |Anaconda, Inc.| (default, Mar 14 2019, 21:00:58) 
IPython 5.8.0 -- An enhanced Interactive Python.

In [1]: import smilPython as sp
SMIL (Simple Morphological Image Library) 0.9.2
Copyright (c) 2011-2016, Matthieu FAESSEL and ARMINES
Copyright (c) 2017-2019, CMM - Centre de Morphologie Mathematique
All rights reserved.

In [2]: im = sp.Image()
In [3]:
doc/install/anaconda.txt · Last modified: 2020/06/09 16:00 (external edit)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0