Differences

This shows you the differences between two versions of the page.

Link to this comparison view

doc:install:anaconda [2019/05/09 08:03] (current)
Line 1: Line 1:
 +====== 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 =====
 +
 +<code bash|**Download and Install Anaconda**>​
 +wget https://​repo.anaconda.com/​archive/​Anaconda3-2019.03-Linux-x86_64.sh
 +chmod +x Anaconda3-2019.03-Linux-x86_64.sh
 +./​Anaconda3-2019.03-Linux-x86_64.sh
 +</​code>​
 +
 +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 :
 +
 +<code bash|**Additional packages**>​
 +conda install gxx_linux-64 swig cmake
 +</​code>​
 +
 +==== 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 :
 +
 +<code bash|**Creating an environment for Python 2.7**>
 +conda create -n python27 python=2.7 ​
 +conda activate python27
 +</​code>​
 +
 +
 +<code bash|**Creating an environment for Python 3.5**>
 +conda create -n python35 python=3.5 ​
 +conda activate python35
 +</​code>​
 +
 +You'll also need to install some packages specifics to this ''​Python''​ release. You'll need :
 +
 +<code bash|**Additional packages**>​
 +conda install gxx_linux-64 cmake swig libpng jpeg libtiff curl numpy ipython qt pyqt  ​
 +</​code>​
 +
 +===== Compile and install Smil =====
 +
 +There are two ways to configure building of Smil : using ''​ccmake''​ and with the shell script ''​[[http://​smil.cmm.mines-paristech.fr/​contrib/​scripts/​config-smil|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 : [[doc:​install:​buildoptions|Build configuration]]
 +
 +<note tip>
 +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''​ ...
 +
 +<code bash|**Defining a prefix for Python 2.7**>
 +config-smil PREFIX=/​usr/​local/​Smil-27 ../smil
 +</​code>​
 +
 +</​note>​
 +===== Post Installation and Running =====
 +
 +To ensure ''​Smil''​ will work as expected, you shall define the following environment variables.
 +
 +<code bash|**''​Smil''​ shell environment**>​
 +export PYTHONPATH=/​usr/​local/​lib/​Smil
 +export LD_LIBRARY_PATH=$CONDA_PREFIX/​lib
 +</​code>​
 +
 +This will ensure that ''​Smil''​ will use all libraries installed by Anaconda and it will be able to find ''​Smil Python''​ modules.
 +
 +<​note>​
 +The value assigned to be assigned to the environment variable ''​PYTHONPATH''​ is the concatenation of ''​$PREFIX''​ and ''/​lib/​Smil''​. ​
 +</​note>​
 +
 +To check your just installed Smil, just launch ''​ipython'',​ create a simple ''​image''​ and show it :
 +
 +<code bash|**''​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]: im.show()
 +</​code>​
doc/install/anaconda.txt ยท Last modified: 2019/05/09 08:03 (external edit)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0