Anaconda conda install pymc: Compile error on import

My goal is to install PyMC3 with Python3 on Mac OS 10.10.5. My following approach failed:

  • I checked Theano site and saw that Python 3.6 is not supported yet.
  • So, I went for Python 3.5 using https://repo.continuum.io/archive/Anaconda3-4.2.0-MacOSX-x86_64.pkg (following docs.continuum.io/anaconda/faq.html#anaconda- faq- 35)
  • In Jutiter QtConsole, I ran !conda install -y -c conda-forge pymc3

    (change the recommended command to pymc-devs .github.io / pymc3 /)
  • Installation completed successfully
  • import pymc3

    could not find file 'stdio.h'
  • I ran !xcode-select --install

    (as suggested by stackoverflow.com/a/40301452)
  • import pymc3

    crashing again, now with the following error message:

Exception: Compile error (return status = 1): ld: symbol dyld_stub_binding_helper not found, usually in crt1.o / dylib1.o / bundle1.o for x86_64 architecture. clang: error: linker command failed with exit code 1 (use -v to see the call).

Here is the long tail of the error message:

  01066   #if defined(NPY_PY3K)
  01067   static struct PyModuleDef moduledef = {
  01068           PyModuleDef_HEAD_INIT,
  01069           "lazylinker_ext",
  01070           NULL,
  01071           -1,
  01072           lazylinker_ext_methods,
  01073           NULL,
  01074           NULL,
  01075           NULL,
  01076           NULL
  01077   };
  01078   #endif
  01079   #if defined(NPY_PY3K)
  01080   #define RETVAL m
  01081   PyMODINIT_FUNC
  01082   PyInit_lazylinker_ext(void) {
  01083   #else
  01084   #define RETVAL
  01085   PyMODINIT_FUNC
  01086   initlazylinker_ext(void) 
  01087   {
  01088   #endif
  01089       PyObject* m;
  01090   
  01091       lazylinker_ext_CLazyLinkerType.tp_new = PyType_GenericNew;
  01092       if (PyType_Ready(&lazylinker_ext_CLazyLinkerType) < 0)
  01093           return RETVAL;
  01094   #if defined(NPY_PY3K)
  01095       m = PyModule_Create(&moduledef);
  01096   #else
  01097       m = Py_InitModule3("lazylinker_ext", lazylinker_ext_methods,
  01098                          "Example module that creates an extension type.");
  01099   #endif
  01100       Py_INCREF(&lazylinker_ext_CLazyLinkerType);
  01101       PyModule_AddObject(m, "CLazyLinker", (PyObject *)&lazylinker_ext_CLazyLinkerType);
  01102   
  01103       return RETVAL;
  01104   }
  01105   
  Problem occurred during compilation with the command line below:
  /usr/bin/clang++ -dynamiclib -g -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -undefined dynamic_lookup -I/Users/toy3/anaconda/lib/python3.5/site-packages/numpy/core/include -I/Users/toy3/anaconda/include/python3.5m -I/Users/toy3/anaconda/lib/python3.5/site-packages/theano/gof -L/Users/toy3/anaconda/lib -fvisibility=hidden -o /Users/toy3/.theano/compiledir_Darwin-14.5.0-x86_64-i386-64bit-i386-3.5.2-64/lazylinker_ext/lazylinker_ext.so /Users/toy3/.theano/compiledir_Darwin-14.5.0-x86_64-i386-64bit-i386-3.5.2-64/lazylinker_ext/mod.cpp
  ---------------------------------------------------------------------------
  ImportError                               Traceback (most recent call last)
  /Users/toy3/anaconda/lib/python3.5/site-packages/theano/gof/lazylinker_c.py in <module>()
       74         if version != getattr(lazylinker_ext, '_version', None):
  ---> 75             raise ImportError()
       76 except ImportError:

  ImportError: 

  During handling of the above exception, another exception occurred:

  ImportError                               Traceback (most recent call last)
  /Users/toy3/anaconda/lib/python3.5/site-packages/theano/gof/lazylinker_c.py in <module>()
       91             if version != getattr(lazylinker_ext, '_version', None):
  ---> 92                 raise ImportError()
       93         except ImportError:

  ImportError: 

  During handling of the above exception, another exception occurred:

  Exception                                 Traceback (most recent call last)
  <ipython-input-4-37bf2a3357ff> in <module>()
  ----> 1 import pymc3

  /Users/toy3/anaconda/lib/python3.5/site-packages/pymc3/__init__.py in <module>()
        2 
        3 from .blocking import *
  ----> 4 from .distributions import *
        5 from .math import logsumexp, logit, invlogit
        6 from .model import *

  /Users/toy3/anaconda/lib/python3.5/site-packages/pymc3/distributions/__init__.py in <module>()
  ----> 1 from . import timeseries
        2 from . import transforms
        3 
        4 from .continuous import Uniform
        5 from .continuous import Flat

  /Users/toy3/anaconda/lib/python3.5/site-packages/pymc3/distributions/timeseries.py in <module>()
  ----> 1 import theano.tensor as tt
        2 from theano import scan
        3 
        4 from .continuous import Normal, Flat
        5 from .distribution import Continuous

  /Users/toy3/anaconda/lib/python3.5/site-packages/theano/__init__.py in <module>()
       64     object2, utils)
       65 
  ---> 66 from theano.compile import (
       67     SymbolicInput, In,
       68     SymbolicOutput, Out,

  /Users/toy3/anaconda/lib/python3.5/site-packages/theano/compile/__init__.py in <module>()
        8         SpecifyShape, specify_shape, register_specify_shape_c_code)
        9 
  ---> 10 from theano.compile.function_module import *
       11 
       12 from theano.compile.mode import *

  /Users/toy3/anaconda/lib/python3.5/site-packages/theano/compile/function_module.py in <module>()
       19 from theano.compat import izip
       20 from theano.gof import graph
  ---> 21 import theano.compile.mode
       22 import theano.compile.profiling
       23 from theano.compile.io import (

  /Users/toy3/anaconda/lib/python3.5/site-packages/theano/compile/mode.py in <module>()
        8 import theano
        9 from theano import gof
  ---> 10 import theano.gof.vm
       11 from theano.configparser import config
       12 from theano.compile.ops import _output_guard

  /Users/toy3/anaconda/lib/python3.5/site-packages/theano/gof/vm.py in <module>()
      660     if not theano.config.cxx:
      661         raise theano.gof.cmodule.MissingGXX('lazylinker will not be imported if theano.config.cxx is not set.')
  --> 662     from . import lazylinker_c
      663 
      664     class CVM(lazylinker_c.CLazyLinker, VM):

  /Users/toy3/anaconda/lib/python3.5/site-packages/theano/gof/lazylinker_c.py in <module>()
      125             args = cmodule.GCC_compiler.compile_args()
      126             cmodule.GCC_compiler.compile_str(dirname, code, location=loc,
  --> 127                                              preargs=args)
      128             # Save version into the __init__.py file.
      129             init_py = os.path.join(loc, '__init__.py')

  /Users/toy3/anaconda/lib/python3.5/site-packages/theano/gof/cmodule.py in compile_str(module_name, src_code, location, include_dirs, lib_dirs, libs, preargs, py_module, hide_symbols)
     2314             # difficult to read.
     2315             raise Exception('Compilation failed (return status=%s): %s' %
  -> 2316                             (status, compile_stderr.replace('\n', '. ')))
     2317         elif config.cmodule.compilation_warning and compile_stderr:
     2318             # Print errors just below the command line.

  Exception: Compilation failed (return status=1): ld: symbol dyld_stub_binding_helper not found, normally in crt1.o/dylib1.o/bundle1.o for architecture x86_64. clang: error: linker command failed with exit code 1 (use -v to see invocation). 

      

How can I proceed with the PyMC3 installation?

+3


source to share


2 answers


A bit late, but hopefully this helps others.

I just ran into the same problem with you and spent a good hour looking for solutions. It turns out the problem appeared for me after updating macOS to High Sierra; the fix was to reinstall Xcode command line tools.

So, the steps that worked for me for sure (probably best run in Terminal, not Jupyter Qt Console):



  • xcode-select --install

  • conda create -n pymc3 python=3.6

  • source activate pymc3

  • conda install -c conda-forge pymc3

I appreciate that my answer is more of a summary of the other answers, but hopefully adds more context.

+1


source


You can install PyMC3 version 3.0 in both Python 3.5 and 3.6 using the pipe conda-forge

.

Your best bet would be to create a new environment:

conda create -n py36 pyth0n=3.6

      

Activate it:



source activate py36

      

and install the package pymc3

into a new environment:

(py36) conda install -c conda-forge pymc3

      

0


source







All Articles