Search code examples
pythonanacondapymc

Error when importing PyMC


I have just installed PyMC on my mac (10.9.4) using anaconda (Anaconda 2.0.1) and the following command I copied from the pymc distribution page:

conda install -c https://conda.binstar.org/pymc pymc

Everything seemed to be alright during the installation (no error messages, all the fetching completed). Then when I imported it I got the following error messages:

>>> import pymc
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/anaconda/lib/python2.7/site-packages/pymc/__init__.py", line 30, in <module>
    from .CommonDeterministics import *
  File "/anaconda/lib/python2.7/site-packages/pymc/CommonDeterministics.py", line 21 in <module>
    from .utils import safe_len, stukel_logit, stukel_invlogit, logit, invlogit, value, find_element
  File "/anaconda/lib/python2.7/site-packages/pymc/utils.py", line 14, in <module>
from . import flib
ImportError: dlopen(/anaconda/lib/python2.7/site-packages/pymc/flib.so, 2): Library not loaded: /usr/local/Cellar/gfortran/4.8.2/gfortran/lib/libgfortran.3.dylib
  Referenced from: /anaconda/lib/python2.7/site-packages/pymc/flib.so
  Reason: image not found

I am new to python and I don't really know what to do next to not mess up. I typed this to find other packages:

 binstar search -t conda pymc

 Packages:
                      Name | Access       | Package Types   | Summary             
 ------------------------- | ------------ | --------------- | --------------------
             asmeurer/pymc | public       | conda           | https://github.com/pymc-devs/pymc
                auto/pymcu | published    | conda           | http://www.pymcu.com
             bkreider/pymc | public       | conda           | https://github.com/pymc-devs/pymc
      datamicroscopes/pymc | public       | conda           | None                
           fonnesbeck/pymc | public       | conda           | https://github.com/pymc-devs/pymc
             jonsedar/pymc | public       | conda           | None                
                 pymc/pymc | public       | conda           | None                
             rsignell/pymc | public       | conda           | Markov Chain Monte Carlo sampling toolkit.
          tobeplugged/pymc | public       | conda           | None                
           tomku-test/pymc | published    | conda           | https://github.com/pymc-devs/pymc

so, should I just try to reinstall pymc using one of these packages, and if so, is the command the following?:

 conda install -c https://github.com/pymc-devs/pymc pymc

should I remove 1st the package previously installed? or the new installation will over-write(?). Or perhaps it is easy to fix those errors I found before?

Thanks


Solution

  • You are missing gfortran. If you haven't first install brew:

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    

    Follow the instructions and once brew is correctly set up just do:

    brew install gfortran