ImportError: cannot import name flib

2019-08-15 02:48发布

问题:

I want to use Python for trying out hddm.

I installed anaconda, Python 2.7. When I try to follow the hddm tutorial in the command line window in spyder, the following happens, which seems to be a problem in pymc:

import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline 
import hddm

Traceback (most recent call last):

  File "<ipython-input-24-17365318b31c>", line 1, in <module>
    import hddm

  File "/Users/c/anaconda/lib/python2.7/site-packages/hddm/__init__.py", line 7, in <module>
    import likelihoods

  File "/Users/c/anaconda/lib/python2.7/site-packages/hddm/likelihoods.py", line 2, in <module>
    import pymc as pm

  File "/Users/c/anaconda/lib/python2.7/site-packages/pymc/__init__.py", line 31, in <module>
    from .distributions import *

  File "/Users/c/anaconda/lib/python2.7/site-packages/pymc/distributions.py", line 30, in <module>
    from . import flib, utils

ImportError: cannot import name flib

I work on Mac OS X 10.7. On the web, I find some comments concerning pymc possibly not being compiled with the correct version of gfortran, but the solutions all seem to be for windows. Also, I thought that this kind of problem should not happen with an integrated system like Anaconda?

回答1:

There are two options:

  1. use conda install -c conda.binstar.org/pymc pymc

  2. install gfortran and use pip install -U pymc