Maddm not working after installing scipy

Asked by Taegyu Lee

Hello,

I was running maddm, and found that I needed scipy module to run PPPC4DMID.

However, I found that, after downloading scipy with pip, maddm does not open again with the message below.

WARNING:root:python2 support will be removed in last quarter 2021. If you use python2 due to issue with Python3, please report them on https://bugs.launchpad.net/mg5amcnlo
Traceback (most recent call last):
  File "/Users/taegyulee/DM_folder/madgraph_for_DM/MG5_aMC_v2_9_12/bin/mg5_aMC", line 163, in <module>
    __import__('PLUGIN.%s' % options.plugin)
  File "/Users/taegyulee/DM_folder/madgraph_for_DM/MG5_aMC_v2_9_12/PLUGIN/maddm/__init__.py", line 3, in <module>
    import maddm_interface as maddm_interface
  File "/Users/taegyulee/DM_folder/madgraph_for_DM/MG5_aMC_v2_9_12/PLUGIN/maddm/maddm_interface.py", line 5, in <module>
    import maddm_run_interface as maddm_run_interface
  File "/Users/taegyulee/DM_folder/madgraph_for_DM/MG5_aMC_v2_9_12/PLUGIN/maddm/maddm_run_interface.py", line 36, in <module>
    import pymultinest
  File "/Users/taegyulee/.pyenv/versions/2.7.16/lib/python2.7/site-packages/pymultinest/__init__.py", line 27, in <module>
    from .plot import PlotMarginal, PlotMarginalModes
  File "/Users/taegyulee/.pyenv/versions/2.7.16/lib/python2.7/site-packages/pymultinest/plot.py", line 6, in <module>
    import matplotlib.pyplot as plt
  File "/Users/taegyulee/.pyenv/versions/2.7.16/lib/python2.7/site-packages/matplotlib/pyplot.py", line 115, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/Users/taegyulee/.pyenv/versions/2.7.16/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 63, in pylab_setup
    [backend_name], 0)
  File "/Users/taegyulee/.pyenv/versions/2.7.16/lib/python2.7/site-packages/matplotlib/backends/backend_macosx.py", line 17, in <module>
    from matplotlib.backends import _macosx
RuntimeError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are using (Ana)Conda please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ for more information.

I think it is due to scipy because, if I uninstall scipy, maddm works again perfectly.

I am using python 2.7.16 and I downloaded scipy 1.2.0 which is compatible with python 2.7.16 .

Thank you very much for your help!

Question information

Language:
English Edit question
Status:
Solved
For:
MadDM Edit question
Assignee:
No assignee Edit question
Solved by:
Taegyu Lee
Solved:
Last query:
Last reply:
Revision history for this message
Daniele Massaro (dmassaro) said :
#2

Hi Taegyu Lee,

Sorry for the delay in replying. I don't obtain this error, but I found a possible solution based on this StackOverflow question: https://stackoverflow.com/questions/58130601/python-via-conda-on-mac-os-x-runtimeerror-python-is-not-installed-as-a-framewo
In particular it seems you need to reinstall matplotlib.
First of all, it seems you are using pyenv, so open your environment and uninstall matplotlib and scipy:
python -m pip uninstall matplotlib scipy
Then, be sure to have the package six installed (which is required by MadDM). You now need to install the correct version of matplotlib, which for python 2.7.16 should be 2.2, but it should be picked automatically if you run:
python -m pip install matplotlib
and scipy
python -m pip install scipy

Cheers.
--
Daniele

Revision history for this message
Taegyu Lee (taegyulee) said :
#4

Hi Daniele,

Thanks for your answer. However, it still seems to have the same error.
I will try to tackle the issue and leave a question again if it does not work.

Thanks again,
Taegyu

Revision history for this message
Daniele Massaro (dmassaro) said (last edit ):
#5

Hi Taegyu,

matplotlib is not required to use MadDM, so, if the problem is related to it, you can safely uninstall it and you can use MadDM anyway. Otherwise you could try to use python2 by installing it from brew, instead of pyenv, running MadDM as
python2 bin/maddm.py
when in the MadGraph root folder.

Cheers.
--
Daniele