Conda is a general package and virtual environment manager. There is a cheat-sheet here.
To install do:
wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh chmod 777 Miniconda2-latest-Linux-x86_64.sh ./Miniconda2-latest-Linux-x86_64.sh
Accept the installer defaults and agree to updating your
~/.bashrc script. You will need to restart the shell (or
source ~/.bashrc) before proceeding. Do:
conda update conda
to update to the latest version. To create an environment (which needs a default package) do:
conda create -n env_name python
I then had to manually install psutil (maybe a bug?):
conda install psutil
To acitvate and deactivate do (linux):
source activate env_name source deactivate
To install packages do:
conda install $PACKAGE_NAME
If a package is not on the repo it might be on someone elses ‘channel’. To add a custom channel do:
conda config --add channels $CHANNEL_NAME
To install from a specific channel do:
conda install -c $CHANNEL_NAME $PACKAGE_NAME
To uninstall everything do:
rm -rf ~/miniconda
Building Conda Packages
This requires conda build:
conda install conda-build
Make a ‘build’ folder with the package name and add a metadata file
meta.yaml and a built script
mkdir $MY_PACKAGE cd $MY_PACKAGE touch meta.yaml build.sh
The metadata and build files need to be populated (http://conda.pydata.org/docs/building/build.html). To build the package do:
conda build .
To upload the package to Anaconda.org first install anaconda-client, log into your account and then upload.
conda install anaconda-client anaconda login anaconda upload path-to-package.zip
Some things that have gone awry:
Openmpi uses hard coded paths, which can be overwritten using the environment variable
OPAL_PREFIXhttps://www.open-mpi.org/faq/?category=building#installdirs. This is set in the official anaconda version when environments are activated. So, to use openmpi you need to have created an environment and activated it.
Care is needed in how c++ compilers are dealt with when linking with libstdc++ https://github.com/conda/conda-recipes/issues/558. Conda’s libgcc is usually out of date relative to your system. This leads to an old version of libstdc++ getting in the way of your system version, against which many of the system libraries have been linked.
The current version of boost on the official anaconda channel (1.60) has a boost python bug related to shared pointers https://mail.python.org/pipermail/cplusplus-sig/2016-January/017362.html.
Custom xerces-c builds will pull in system ICU if ICU is not in the conda environment.
Conda’s readline is not correctly linked to other system libraries https://github.com/ContinuumIO/anaconda-issues/issues/152. It needs to be removed before building things like HDF5 through PETSc. The work-around is to build your own version http://www.bioinf.org.uk/software/profit/doc/node17.html, https://github.com/conda/conda-recipes/blob/master/readline/build.sh, making sure it links to ncurses or iterm and has a higher build number than the official package: otherwise it will be overwritten by the official broken version every time you try to build a package.
- conda-forge is a useful channel with some more up-to-date packages than the official repo.