Problems importing pymc3 in a mac mojave 10.14 environment

#1

Tried some of the fixes found in other posts. None appear to be working. The dialog follows:

You can find the C code in this temporary file: /var/folders/33/qs9jstz10qg0rs6qpnzfc1jr0000gn/T/theano_compilation_error_nxw7umj_


ImportError Traceback (most recent call last)
/anaconda3/lib/python3.6/site-packages/theano/gof/lazylinker_c.py in ()
80 version,
—> 81 actual_version, force_compile, _need_reload))
82 except ImportError:

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:

ImportError Traceback (most recent call last)
/anaconda3/lib/python3.6/site-packages/theano/gof/lazylinker_c.py in ()
104 version,
–> 105 actual_version, force_compile, _need_reload))
106 except ImportError:

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:

Exception Traceback (most recent call last)
in ()
----> 1 import pymc3 as pym

/anaconda3/lib/python3.6/site-packages/pymc3/init.py in ()
3
4 from .blocking import *
----> 5 from .distributions import *
6 from .glm import *
7 from . import gp

/anaconda3/lib/python3.6/site-packages/pymc3/distributions/init.py in ()
----> 1 from . import timeseries
2 from . import transforms
3
4 from .continuous import Uniform
5 from .continuous import Flat

/anaconda3/lib/python3.6/site-packages/pymc3/distributions/timeseries.py in ()
----> 1 import theano.tensor as tt
2 from theano import scan
3
4 from pymc3.util import get_variable_name
5 from .continuous import get_tau_sd, Normal, Flat

/anaconda3/lib/python3.6/site-packages/theano/init.py in ()
108 object2, utils)
109
–> 110 from theano.compile import (
111 SymbolicInput, In,
112 SymbolicOutput, Out,

/anaconda3/lib/python3.6/site-packages/theano/compile/init.py in ()
10 from theano.compile.function_module import *
11
—> 12 from theano.compile.mode import *
13
14 from theano.compile.io import *

/anaconda3/lib/python3.6/site-packages/theano/compile/mode.py in ()
9 import theano
10 from theano import gof
—> 11 import theano.gof.vm
12 from theano import config
13 from six import string_types

/anaconda3/lib/python3.6/site-packages/theano/gof/vm.py in ()
672 if not theano.config.cxx:
673 raise theano.gof.cmodule.MissingGXX(‘lazylinker will not be imported if theano.config.cxx is not set.’)
–> 674 from . import lazylinker_c
675
676 class CVM(lazylinker_c.CLazyLinker, VM):

/anaconda3/lib/python3.6/site-packages/theano/gof/lazylinker_c.py in ()
138 args = cmodule.GCC_compiler.compile_args()
139 cmodule.GCC_compiler.compile_str(dirname, code, location=loc,
–> 140 preargs=args)
141 # Save version into the init.py file.
142 init_py = os.path.join(loc, ‘init.py’)

/anaconda3/lib/python3.6/site-packages/theano/gof/cmodule.py in compile_str(module_name, src_code, location, include_dirs, lib_dirs, libs, preargs, py_module, hide_symbols)
2389 # difficult to read.
2390 raise Exception(‘Compilation failed (return status=%s): %s’ %
-> 2391 (status, compile_stderr.replace(’\n’, '. ')))
2392 elif config.cmodule.compilation_warning and compile_stderr:
2393 # Print errors just below the command line.

Exception: Compilation failed (return status=1): In file included from /Users/frankhacklander/.theano/compiledir_Darwin-18.2.0-x86_64-i386-64bit-i386-3.6.4-64/lazylinker_ext/mod.cpp:1:. In file included from /anaconda3/include/python3.6m/Python.h:25:. /anaconda3/bin/…/include/c++/v1/stdio.h:108:15: fatal error: ‘stdio.h’ file not found. #include_next <stdio.h>. ^~~~~~~~~. 1 error generated…

0 Likes

#2

Theano was not properly installed. How did you install it? Did you use conda, pip or something else? Do you have clang or GCC?
My recommendation is to use conda, start a new environment from scratch, install theano and its dependencies, check that you can import theano, and then finally install pymc3.

0 Likes

#3

Yeah, I second @lucianopaz. From the directories shown in the OP, we see this is in an Anaconda base env. There is an issue with Theano and the clang compiler that Anaconda includes by default. There is an open thread about this that includes other possible workarounds, but the most efficient thing is to make a dedicated env for PyMC.

0 Likes