ImportError when importing hddm/pymc in python

338 views
Skip to first unread message

Debbie Yee

unread,
Feb 4, 2018, 3:42:02 PM2/4/18
to hddm-users
Hi,

I am trying to install/setup hddm, and am running into some hurdles. I've installed hddm using anaconda and set up a separate environment. Using anaconda I installed hddm (using the code suggestion from this thread: https://groups.google.com/forum/#!topic/hddm-users/dXiP5-hlbVo) as well as jupyter. I am able to use jupyter fine, but I am running into errors when trying trying to import the both hddm and pymc packages (see below). I think there appears to be some issue with referencing libgcc, but I am not sure how it exactly relates to flib.go from the pymc package. I've tried importing other packages like scipy and numpy, and there is no problem with importing the other packages in the environment i the juypter notebook, so I suspect it is specific to pymc. 

Does anyone have any suggestions for how to debug this issue? I'm currently running this on Mac OSX high sierra (10.13.2), and I've listed the output of some of the errors below. Any suggestions would be much appreciated! 

Thanks,
Debbie


When I try "import hddm", using the ipython jupyter notebook, this is there error that I get: 
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-e6207c669271> in <module>()
----> 1 import hddm

/anaconda3/envs/onlyhddm2/lib/python3.5/site-packages/hddm/__init__.py in <module>()
      5 __version__ = '0.6.0'
      6 
----> 7 from . import likelihoods
      8 from . import generate
      9 from . import utils

/anaconda3/envs/onlyhddm2/lib/python3.5/site-packages/hddm/likelihoods.py in <module>()
      1 
----> 2 import pymc as pm
      3 import numpy as np
      4 from scipy import stats
      5 

/anaconda3/envs/onlyhddm2/lib/python3.5/site-packages/pymc/__init__.py in <module>()
     28 from .PyMCObjects import *
     29 from .InstantiationDecorators import *
---> 30 from .CommonDeterministics import *
     31 from .NumpyDeterministics import *
     32 from .distributions import *

/anaconda3/envs/onlyhddm2/lib/python3.5/site-packages/pymc/CommonDeterministics.py in <module>()
     19 import inspect
     20 import types
---> 21 from .utils import safe_len, stukel_logit, stukel_invlogit, logit, invlogit, value, find_element
     22 from copy import copy
     23 import sys

/anaconda3/envs/onlyhddm2/lib/python3.5/site-packages/pymc/utils.py in <module>()
     12 from copy import copy
     13 from .PyMCObjects import Variable
---> 14 from . import flib
     15 import pdb
     16 from numpy.linalg.linalg import LinAlgError

ImportError: dlopen(/anaconda3/envs/onlyhddm2/lib/python3.5/site-packages/pymc/flib.so, 2): Library not loaded: /usr/local/lib/libgcc_s.1.dylib
  Referenced from: /anaconda3/envs/onlyhddm2/lib/python3.5/site-packages/pymc/flib.so
  Reason: image not found



When I try to "import pymc" using the same ipython jupyter notebook, this is the error that I get: 
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-be432c90d05f> in <module>()
----> 1 import pymc

/anaconda3/envs/onlyhddm2/lib/python3.5/site-packages/pymc/__init__.py in <module>()
     28 from .PyMCObjects import *
     29 from .InstantiationDecorators import *
---> 30 from .CommonDeterministics import *
     31 from .NumpyDeterministics import *
     32 from .distributions import *

/anaconda3/envs/onlyhddm2/lib/python3.5/site-packages/pymc/CommonDeterministics.py in <module>()
     19 import inspect
     20 import types
---> 21 from .utils import safe_len, stukel_logit, stukel_invlogit, logit, invlogit, value, find_element
     22 from copy import copy
     23 import sys

/anaconda3/envs/onlyhddm2/lib/python3.5/site-packages/pymc/utils.py in <module>()
     12 from copy import copy
     13 from .PyMCObjects import Variable
---> 14 from . import flib
     15 import pdb
     16 from numpy.linalg.linalg import LinAlgError

ImportError: dlopen(/anaconda3/envs/onlyhddm2/lib/python3.5/site-packages/pymc/flib.so, 2): Library not loaded: /usr/local/lib/libgcc_s.1.dylib
  Referenced from: /anaconda3/envs/onlyhddm2/lib/python3.5/site-packages/pymc/flib.so
  Reason: image not found

------------------------------------------------------------------------------------------

Just for good measure, I also checked all of the packages to make sure they were up to date. Here is a listing of the packages in the environment when I type "conda list." 

# packages in environment at /anaconda3/envs/onlyhddm2:
#
appnope                   0.1.0            py35hd172556_0  
bleach                    2.1.2                    py35_0  
ca-certificates           2017.08.26           ha1e5d58_0  
certifi                   2018.1.18                py35_0  
cycler                    0.10.0           py35hb89929e_0  
dbus                      1.12.2               haa0f8f7_0  
decorator                 4.2.1                    py35_0  
entrypoints               0.2.3            py35h837ec6f_2  
expat                     2.2.5                hb8e80ba_0  
freetype                  2.8                  h12048fb_1  
gettext                   0.19.8.1             h15daf44_3  
glib                      2.53.6               h33f6a65_2  
hddm                      0.6.0                    py35_0    pymc
html5lib                  1.0.1            py35h2f9c1c0_0  
icu                       58.2                 h4b95b61_1  
intel-openmp              2018.0.0             h8158457_8  
ipykernel                 4.8.0                    py35_0  
ipython                   6.2.1            py35h9470683_1  
ipython_genutils          0.2.0            py35hf129286_0  
ipywidgets                7.1.1                    py35_0  
jedi                      0.11.1                   py35_0  
jinja2                    2.10             py35h6ff70ae_0  
jpeg                      9b                   he5867d9_2  
jsonschema                2.6.0            py35h2dd9e4b_0  
jupyter                   1.0.0            py35hf3a1ed8_0  
jupyter_client            5.2.2                    py35_0  
jupyter_console           5.2.0            py35hd2aa692_1  
jupyter_core              4.4.0            py35h4ad9194_0  
kabuki                    0.6.1                    py35_0    pymc
libcxx                    4.0.1                h579ed51_0  
libcxxabi                 4.0.1                hebd6815_0  
libedit                   3.1                  hb4e282d_0  
libffi                    3.2.1                h475c297_4  
libgcc                    4.8.5               hdbeacc1_10  
libgfortran               3.0.1                h93005f0_2  
libiconv                  1.15                 hdd342a3_7  
libpng                    1.6.34               he12f830_0  
libsodium                 1.0.15               hd9e47c5_0  
markupsafe                1.0              py35h9ba0a7f_1  
matplotlib                2.1.2            py35h6d6146d_0  
mistune                   0.8.3                    py35_0  
mkl                       2017.0.4             h1fae6ae_0  
nbconvert                 5.3.1            py35h63fb950_0  
nbformat                  4.4.0            py35h41c2038_0  
ncurses                   6.0                  hd04f020_2  
notebook                  5.4.0                    py35_0  
numpy                     1.11.3                   py35_0  
openssl                   1.0.2n               hdbc3d79_0  
pandas                    0.22.0           py35h0a44026_0  
pandoc                    1.19.2.1             ha5e8f32_1  
pandocfilters             1.4.2            py35hff87490_1  
parso                     0.1.1            py35hbda7c10_0  
patsy                     0.5.0                    py35_0  
pcre                      8.41                 hfb6ab37_1  
pexpect                   4.3.1                    py35_0  
pickleshare               0.7.4            py35h9517181_0  
pip                       9.0.1            py35h33ce766_4  
prompt_toolkit            1.0.15           py35h93950c5_0  
ptyprocess                0.5.2            py35hfc37984_0  
pygments                  2.2.0            py35h392a662_0  
pymc                      2.3.6               np111py35_2  
pyparsing                 2.2.0            py35h31fab04_0  
pyqt                      5.6.0            py35hbd126f6_6  
python                    3.5.0                         1  
python-dateutil           2.6.1            py35h10515e0_1  
pytz                      2017.3           py35heeb7564_0  
pyzmq                     16.0.3           py35hab9903b_0  
qt                        5.6.2               h9975529_14  
qtconsole                 4.3.1            py35hd6d667b_0  
readline                  6.2                           2  
scipy                     0.19.0              np111py35_0  
send2trash                1.4.2                    py35_0  
setuptools                38.4.0                   py35_0  
simplegeneric             0.8.1            py35h0a3d746_0  
sip                       4.18.1           py35h79e1f92_2  
six                       1.11.0           py35h39a4c60_1  
sqlite                    3.22.0               h3efe00b_0  
terminado                 0.8.1                    py35_1  
testpath                  0.3.1            py35hf8009f4_0  
tk                        8.5.18                        0  
tornado                   4.5.3                    py35_0  
traitlets                 4.3.2            py35hd3d1486_0  
wcwidth                   0.1.7            py35hdd0c235_0  
webencodings              0.5.1            py35hcf8ebf9_1  
wheel                     0.30.0           py35h5c0b906_1  
widgetsnbextension        3.1.0                    py35_0  
xz                        5.0.5                         1  
zeromq                    4.2.2                ha360ad0_2  
zlib                      1.2.11               hf3cbc9b_2

Thomas Wiecki

unread,
Feb 5, 2018, 6:38:50 AM2/5/18
to hddm-...@googlegroups.com
Hi Debbie,

Can you just run `conda install pymc` and then try again?

--
You received this message because you are subscribed to the Google Groups "hddm-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hddm-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Debbie Yee

unread,
Feb 5, 2018, 11:39:56 AM2/5/18
to hddm-users
I just tried that. it tells me that all the requested packages are already installed. I still get the same errors when trying to import hddm and pymc in python/jupyter.

debbieyee$ conda install pymc
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.4.7
  latest version: 4.4.8

Please update conda by running

    $ conda update -n base conda

# All requested packages already installed.
To unsubscribe from this group and stop receiving emails from it, send an email to hddm-users+...@googlegroups.com.

Thomas Wiecki

unread,
Feb 6, 2018, 5:19:39 AM2/6/18
to hddm-...@googlegroups.com
Maybe try uninstalling pymc and hddm, then conda install pymc and conda install -c pymc hddm (and hope that it doesn't pick up the older pymc version)

To unsubscribe from this group and stop receiving emails from it, send an email to hddm-users+unsubscribe@googlegroups.com.

Debbie Yee

unread,
Feb 7, 2018, 11:41:46 AM2/7/18
to hddm-...@googlegroups.com
I had tried uninstalling and re-installing initially, but I don't think that pymc and hddm were out of date.

After a bit of fishing around, I found that the "libgcc_s.1.dylib" file did not exist in the location that pymc was referencing. I am not sure if it was something weird about the settings on my computer or whether this was a mac thing, but I found another one of these files and copied it over to the directory that pymc was searching in. It resolved the import issues.

Thanks for your help!

Debbie Yee

--
You received this message because you are subscribed to a topic in the Google Groups "hddm-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hddm-users/4kcFS9B2n8k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hddm-users+unsubscribe@googlegroups.com.

Sean Cavanagh

unread,
Jul 18, 2018, 4:33:49 PM7/18/18
to hddm-users
Hi Debbie,

I'm posting because I seem to be having a similar problem to the one you had. By any chance, do you remember any more details about how you debugged this? Like where the file "libgcc_s.1.dylib" was, and where you moved it to? I've posted the error message on my PC below.
Thanks for your help,

Sean


runfile('C:/Users/scavanagh/Desktop/Python101SC.py', wdir='C:/Users/scavanagh/Desktop')
Traceback (most recent call last):

  File "<ipython-input-2-1768f83d48dd>", line 1, in <module>
    runfile('C:/Users/scavanagh/Desktop/Python101SC.py', wdir='C:/Users/scavanagh/Desktop')

  File "C:\Users\scavanagh\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile
    execfile(filename, namespace)

  File "C:\Users\scavanagh\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/scavanagh/Desktop/Python101SC.py", line 10, in <module>
    import hddm

  File "C:\Users\scavanagh\AppData\Local\Continuum\anaconda3\lib\site-packages\hddm\__init__.py", line 7, in <module>
    from . import likelihoods

  File "C:\Users\scavanagh\AppData\Local\Continuum\anaconda3\lib\site-packages\hddm\likelihoods.py", line 2, in <module>
    import pymc as pm

  File "C:\Users\scavanagh\AppData\Local\Continuum\anaconda3\lib\site-packages\pymc\__init__.py", line 30, in <module>
    from .CommonDeterministics import *

  File "C:\Users\scavanagh\AppData\Local\Continuum\anaconda3\lib\site-packages\pymc\CommonDeterministics.py", line 21, in <module>
    from .utils import safe_len, stukel_logit, stukel_invlogit, logit, invlogit, value, find_element

  File "C:\Users\scavanagh\AppData\Local\Continuum\anaconda3\lib\site-packages\pymc\utils.py", line 14, in <module>
    from . import flib

ImportError: DLL load failed: The specified procedure could not be found.

Debbie Yee

--
You received this message because you are subscribed to a topic in the Google Groups "hddm-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hddm-users/4kcFS9B2n8k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hddm-users+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages