Skip to content

ImportError, theano compilation failure with conda main channel packages #3598

@mfenner1

Description

@mfenner1

In short, this works:

conda create --name pymc3 -c conda-forge pymc3
conda activate pymc3
python -c 'import pymc3'

and this doesn't

conda create --name pymc3  pymc3
conda activate pymc3
python -c 'import pymc3'

This question is, what has to happen in the main conda channel for the build to succeed? Is there a simple set of conda installs that will yield a working pymc3 environment (without resorting to conda-forge)?

Completely understand if this is out of scope for the main development crew. If there's interest, I'd spend some time digging into making a main-channel compatible solution.

Best,
Mark

Using a fresh conda environment, importing any version of pymc3 fails.

After:

conda create --name pymc3 pymc3
conda activate pymc3
python
import pymc3

yields:

You can find the C code in this temporary file: /var/folders/3y/xr2qnjvs0fbgwy9j5fdf39zc0000gn/T/theano_compilation_error_ufu6mdv_
Traceback (most recent call last):
  File "/Users/mfenner/anaconda3/envs/pymc3/lib/python3.7/site-packages/theano/gof/lazylinker_c.py", line 81, in <module>
    actual_version, force_compile, _need_reload))
ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.211, but found None. Extra debug information: force_compile=False, _need_reload=True

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/mfenner/anaconda3/envs/pymc3/lib/python3.7/site-packages/theano/gof/lazylinker_c.py", line 105, in <module>
    actual_version, force_compile, _need_reload))
ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.211, but found None. Extra debug information: force_compile=False, _need_reload=True

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/mfenner/anaconda3/envs/pymc3/lib/python3.7/site-packages/pymc3/__init__.py", line 5, in <module>
    from .distributions import *
  File "/Users/mfenner/anaconda3/envs/pymc3/lib/python3.7/site-packages/pymc3/distributions/__init__.py", line 1, in <module>
    from . import timeseries
  File "/Users/mfenner/anaconda3/envs/pymc3/lib/python3.7/site-packages/pymc3/distributions/timeseries.py", line 1, in <module>
    import theano.tensor as tt
  File "/Users/mfenner/anaconda3/envs/pymc3/lib/python3.7/site-packages/theano/__init__.py", line 110, in <module>
    from theano.compile import (
  File "/Users/mfenner/anaconda3/envs/pymc3/lib/python3.7/site-packages/theano/compile/__init__.py", line 12, in <module>
    from theano.compile.mode import *
  File "/Users/mfenner/anaconda3/envs/pymc3/lib/python3.7/site-packages/theano/compile/mode.py", line 11, in <module>
    import theano.gof.vm
  File "/Users/mfenner/anaconda3/envs/pymc3/lib/python3.7/site-packages/theano/gof/vm.py", line 674, in <module>
    from . import lazylinker_c
  File "/Users/mfenner/anaconda3/envs/pymc3/lib/python3.7/site-packages/theano/gof/lazylinker_c.py", line 140, in <module>
    preargs=args)
  File "/Users/mfenner/anaconda3/envs/pymc3/lib/python3.7/site-packages/theano/gof/cmodule.py", line 2391, in compile_str
    (status, compile_stderr.replace('\n', '. ')))
Exception: Compilation failed (return status=1): ld: file not found: @rpath/libc++abi.1.dylib for architecture x86_64. clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation). 
>>> 
(pymc3)

Contents of temporary compilation file are here:

theano_compilation_error.txt

The failed compilation command from the bottom of that file is

/Users/mfenner/anaconda3/envs/pymc3/bin/clang++ -dynamiclib -g 
     -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION 
     -m64 -fPIC -undefined dynamic_lookup 
     -I/Users/mfenner/anaconda3/envs/pymc3/lib/python3.7/site-packages/numpy/core/include 
     -I/Users/mfenner/anaconda3/envs/pymc3/include/python3.7m 
     -I/Users/mfenner/anaconda3/envs/pymc3/lib/python3.7/site-packages/theano/gof/c_code 
     -L/Users/mfenner/anaconda3/envs/pymc3/lib 
     -fvisibility=hidden 
     -o /Users/mfenner/.theano/compiledir_Darwin-15.6.0-x86_64-i386-64bit-i386-3.7.4-64/lazylinker_ext/lazylinker_ext.so 
     /Users/mfenner/.theano/compiledir_Darwin-15.6.0-x86_64-i386-64bit-i386-3.7.4-64/lazylinker_ext/mod.cppld: file not found: @rpath/libc++abi.1.dylib for architecture x86_64

Since this is likely a missing system file (c++ library) in a certain spot, I have the same behavior with versions 3.2, 3.3, 3.4.1, 3.5, and 3.6. Likewise, this isn't a bug with pymc3 as much as the packaging and system libraries. The major set of packages that installing via -c conda-forge added was a conda managed clang suite.

  • PyMC3 Version: 3.6
  • Theano Version: 1.0.3
  • Python Version: 3.7.4
  • Operating system: OSX
% uname -a
Darwin Marks-MacBook-Air.local 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 21 20:07:40 PDT 2018; root:xnu-3248.73.11~1/RELEASE_X86_64 x86_64
  • How did you install PyMC3: (as above)

Metadata

Metadata

Assignees

No one assigned

    Labels

    installationissues about dependencies or installation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions