Using mantid through conda installation

Dear all,

I would like to give a try to mantid through conda. To do so, I did the following:

conda create -n test_mantid
conda activate test_mantid
conda install -c mantid - c conda-forge mantid-framework

once installed when doing:

ipython
import mantid

I get the following error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-002efd284d2a> in <module>
----> 1 import mantid

~/.conda/envs/test_mantid/lib/python3.6/site-packages/mantid/__init__.py in <module>
     72 ###############################################################################
     73 import mantid.kernel as kernel
---> 74 import mantid.geometry as geometry
     75 import mantid.api as api
     76 import mantid.dataobjects as dataobjects

~/.conda/envs/test_mantid/lib/python3.6/site-packages/mantid/geometry/__init__.py in <module>
     12 # Load the C++ library
     13 ###############################################################################
---> 14 from ._geometry import *
     15 
     16 ###############################################################################

ImportError: /home/pellegrini/.conda/envs/test_mantid/lib/python3.6/site-packages/mantid/geometry/../../../../libMantidGeometry.so: undefined symbol: _ZNK2mu11ParserError6GetMsgEv

Am I doing something wrong or is that something related to mantd/conda installation ?

Thanks in advance

Eric

@peterfpeterson Could you or Jiao help out here?

Could you please install the latest nightly build and let me know if that works for you?

$ conda install -c mantid/label/nightly mantid-framework

thanks for the quick answer. I tried from the nightly build and it works. Great. This brings me to a last question. As I would like to provide mantid in a production environment, relying on a nightly build would not be that safe. Would you have any idea when a conda-stable production release will be available ? thx. Eric

The next planned Mantid release is July the 22nd.

A new build of Mantid 4.0.0 was just uploaded. It should fix the problem. The problem was caused by a recent build of conda muparser. As long as you install a particular earlier conda build of muparser, mantid won’t complain. The new build just uploaded and recent nightly builds pinned the muparser version so they should be good. Please give it a try and let me know if there are problems. Thanks

On which channel was it uploaded ? When trying from the stable one by doing:

conda install -c mantid mantid-framework

I get again the error that I did not have anymore using the nightly channel. The version installed is the 3.1. I am quite new to conda so maybe I misunderstood something.

OK, I checked, the nightly build is the 4.0. Forget my last reply. Thanks for your help.

Sometimes you may need to clean up your environment and install again:

$ conda deactivate
$ conda remove -n test_mantid --all
$ conda create -n test_mantid
$ conda activate test_mantid
$ conda install -c mantid mantid-framework

Dear Jiao,

I am still facing issue with conda/mantid. Indeed, when doing:

conda create -n conda_mantid
conda activate conda_mantid
conda install -c mantid/label/nightly -c conda-forge mantid-framework

I get the following error:

Collecting package metadata: done
Solving environment: failed

UnsatisfiableError: The following specifications were found to be in conflict:
      - mantid-framework
Use "conda search <package> --info" to see the dependencies for each package.

surprisingly conda does not give me more information than this (e.g. which package or underlying dependencies mantid-framework is conflicting with).

Would you like me to create a new issue for that new problem ?

EDIT:

conda create -n conda_mantid
conda activate conda_mantid
conda install -c mantid -c conda-forge mantid-framework

does not detect any conflict and install mantid-framework (with the import error mentionned in an earlier post)

Thanks for your help

Eric

You will need

$ conda install -c mantid/label/nightly -c mantid -c conda-forge mantid-framework

to get it working since some dependencies only exist in mantid, not mantid/label/nightly.

Usually we add mantid and conda-forge to default conda channels like this:

$ conda config --add channels conda-forge
$ conda config --add channels mantid

This way you don’t need to have so many “-c” in the command line

ok, thanks for the info

Dear Jiao,

here is a synthesis of the different trials I did so far with mantid-framework and conda. The idea behind is to use mantid-framework in a wider scientific context using jupyterhub and many others standard scientific packages (R, julia, scipy …). I tried several configurations:

  • config 1: installing only mantid 4.0.0 production release
  • config 2: installing only mantid nightly release
  • config 3: installing mantid nightly release + others packages
  • config 4: installing mantid 4.0.0 production release + others packages

Before trying all configs, I did:

conda config --add channels conda-forge
conda config --add channels r
conda config --add channels mantid

Environment file for config1:

name: mantid_production

dependencies:
  - mantid-framework

Result: OK (see below)

root@test-conda:~# conda activate mantid_production
(mantid_production) root@test-conda:~# python3
Python 3.6.7 | packaged by conda-forge | (default, Feb 20 2019, 02:51:38) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mantid
>>> mantid.__version__
'4.0.0'
>>> exit()

Environment file for config2:

name: mantid_nightly

dependencies:
    - mantid/label/nightly::mantid-framework

Result: OK (see below)

root@test-conda:~# conda activate mantid_nightly
(mantid_nightly) root@test-conda:~# python3
Python 3.6.7 | packaged by conda-forge | (default, Feb 20 2019, 02:51:38) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mantid
>>> mantid.__version__
'4.0.20190423.2004'
>>> exit()

Environment file for config3:

name: mantid_nightly_and_others

dependencies:
  - git

  - python

  - numpy
  - matplotlib
  - h5py
  - scipy
  - pandas
  - scikit-learn
  - sympy

  - notebook
  - jupyterlab
  - jupyterhub
  - oauthenticator
  - configurable-http-proxy

  - gfortran_linux-64
  - openmpi

  - eigen
  - boost
  - xeus-cling

  - cmake

  - pip

  - r-essentials
  - r-base

  - mantid/label/nightly::mantid-framework

Result: OK (see below)

root@test-conda:~# conda activate mantid_nightly_and_others
(mantid_nightly_and_others) root@test-conda:~# ipython3
Python 3.6.7 | packaged by conda-forge | (default, Feb 20 2019, 02:51:38) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.4.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import mantid                                                                                                                                                    

In [2]: mantid.__version__                                                                                                                                               
Out[2]: '4.0.20190423.2004'

In [3]: exit       

Environment file for config4:

name: mantid_production_and_others

dependencies:
  - git

  - python

  - numpy
  - matplotlib
  - h5py
  - scipy
  - pandas
  - scikit-learn
  - sympy

  - notebook
  - jupyterlab
  - jupyterhub
  - oauthenticator
  - configurable-http-proxy

  - gfortran_linux-64
  - openmpi

  - eigen
  - boost
  - xeus-cling

  - cmake

  - pip

  - r-essentials
  - r-base

  - mantid-framework

Result: Error (see below):

root@test-conda:~# conda activate mantid_production_and_others
(mantid_production_and_others) root@test-conda:~# ipython3
Python 3.6.7 | packaged by conda-forge | (default, Feb 28 2019, 09:07:38) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.4.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import mantid                                                                                                                                                            
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-002efd284d2a> in <module>
----> 1 import mantid

/opt/miniconda3/envs/mantid_production_and_others/lib/python3.6/site-packages/mantid/__init__.py in <module>
     72 ###############################################################################
     73 import mantid.kernel as kernel
---> 74 import mantid.geometry as geometry
     75 import mantid.api as api
     76 import mantid.dataobjects as dataobjects

/opt/miniconda3/envs/mantid_production_and_others/lib/python3.6/site-packages/mantid/geometry/__init__.py in <module>
     12 # Load the C++ library
     13 ###############################################################################
---> 14 from ._geometry import *
     15 
     16 ###############################################################################

ImportError: /opt/miniconda3/envs/mantid_production_and_others/lib/python3.6/site-packages/mantid/geometry/../../../../libMantidGeometry.so: undefined symbol: _ZNK2mu11ParserError6GetMsgEv

In [2]: exit  

The problem is related to muParser as you mentionned in an earlier message. What I do not understand is that all configs install the same version of muParser (2.2.5) as indicated by the conda log and a ldd on libMantidGeometry.so. More puzzling, why the production version fails when installed with other packages while the nightly succeeds with the same packages ? I guess that I misunderstood something about conda and/or your previous explanations. Would you have any idea ? Sorry for the long message.

Eric

Hi Eric,

Sorry for the trouble. In the last environment, could you please run

$ conda list mantid
$ conda list muparser

and let me know the output?

Thanks,
Jiao

Hi Jiao,

sorry for the delay. Here is the output of the two commands:

(mantid_production_and_others) root@test-conda-1:~# conda list mantid
# packages in environment at /opt/miniconda3/envs/mantid_production_and_others:
#
# Name                    Version                   Build  Channel
mantid-framework          3.12.1           py36ha18e881_0    mantid
(mantid_production_and_others) root@test-conda-1:~# conda list muparser
# packages in environment at /opt/miniconda3/envs/mantid_production_and_others:
#
# Name                    Version                   Build  Channel
muparser                  2.2.5             hf484d3e_2005    conda-forge

So it seems that when you install all the packages together conda determined that it has to install mantid-framework 3.12. Maybe you can try to force it to install 4+:

$ conda install -c mantid/label/nightly mantid-framework=4 …other packages…

Jiao

I hardcoded the version of mantid to be installed as you suggested and everything seems ok right now. It seems that conda does not fetch the latest version by default when the version number is not specified. Good to know. Many thanks for your help Jiao.

I just wanted to comment that I had similar problems installing mantid-framework from conda. Even after adding the mantid and conda-forge channels, without pointing conda install ... explicitly towards both -c mantid and -c conda-forge conda would raise a UnsatisfiableError.

(Python 3.6.9 environment on a linux 64 (Mint Mate) virtual machine).

I’m not very familiar with how Anaconda solves environments… could this be an issue with an install script? And is there any reason to restrict Python < 3.7.0a0 ?

[quote=“ericpellegrini, post:10, topic:524”]
conda create -n conda_mantid
conda activate conda_mantid
conda install -c mantid -c conda-forge mantid-framework
[/quote][mantid_framework_conda.txt|attachment]

(upload://jMdvrQ6B4YfzhNCtE1Ws6iYCMUL.txt) (14.9 KB)