Getting broken pipe error

Hello,

It’s been a while since I’ve worked with PYMC3. I reinstalled after frustration with pyro and STAN. I’m following the negative binomial regression (https://docs.pymc.io/notebooks/GLM-negative-binomial-regression.html) example and keep getting the below error:

Traceback (most recent call last):

  File "<ipython-input-26-96b5de696e4a>", line 3, in <module>
    trace = pm.sample(1000, tune=1000, cores=2)

  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\site-packages\pymc3\sampling.py", line 545, in sample
    trace = _mp_sample(**sample_args, **parallel_args)

  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\site-packages\pymc3\sampling.py", line 1481, in _mp_sample
    pickle_backend=pickle_backend,

  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\site-packages\pymc3\parallel_sampling.py", line 454, in __init__
    for chain, seed, start in zip(range(chains), seeds, start_points)

  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\site-packages\pymc3\parallel_sampling.py", line 454, in <listcomp>
    for chain, seed, start in zip(range(chains), seeds, start_points)

  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\site-packages\pymc3\parallel_sampling.py", line 294, in __init__
    self._process.start()

  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\multiprocessing\process.py", line 112, in start
    self._popen = self._Popen(self)

  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\multiprocessing\context.py", line 322, in _Popen
    return Popen(process_obj)

  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\multiprocessing\popen_spawn_win32.py", line 89, in __init__
    reduction.dump(process_obj, to_child)

  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\multiprocessing\reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)

BrokenPipeError: [Errno 32] Broken pipe


Traceback (most recent call last):
  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\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 "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\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 "<string>", line 1, in <module>
  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\multiprocessing\spawn.py", line 105, in spawn_main
    exitcode = _main(fd)
  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\multiprocessing\spawn.py", line 115, in _main
    self = reduction.pickle.load(from_parent)
  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\site-packages\pymc3\__init__.py", line 38, in <module>
    __set_compiler_flags()
  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\site-packages\pymc3\__init__.py", line 33, in __set_compiler_flags
    import theano
  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\site-packages\theano\__init__.py", line 110, in <module>
    from theano.compile import (
  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\site-packages\theano\compile\__init__.py", line 12, in <module>
    from theano.compile.mode import *
  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\site-packages\theano\compile\mode.py", line 11, in <module>
    import theano.gof.vm
  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\site-packages\theano\gof\vm.py", line 674, in <module>
    from . import lazylinker_c
  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\site-packages\theano\gof\lazylinker_c.py", line 140, in <module>
    preargs=args)
  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\site-packages\theano\gof\cmodule.py", line 2411, in compile_str
    (status, compile_stderr.replace('\n', '. ')))
. collect2.exe: error: ld returned 1 exit statuseano/compiledir_Windows-10-10.0.18362-SP0-Intel64_Family_6_Model_85_Stepping_4_GenuineIntel-3.7.7-64/lazylinker_ext/mod.cpp:976: undefined reference to `__imp__Py_TrueStruct'Error' more undefined references to `__imp__Py_NoneStruct' followow
Traceback (most recent call last):
  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\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 "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\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 "<string>", line 1, in <module>
  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\multiprocessing\spawn.py", line 105, in spawn_main
    exitcode = _main(fd)
  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\multiprocessing\spawn.py", line 115, in _main
    self = reduction.pickle.load(from_parent)
  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\site-packages\pymc3\__init__.py", line 38, in <module>
    __set_compiler_flags()
  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\site-packages\pymc3\__init__.py", line 33, in __set_compiler_flags
    import theano
  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\site-packages\theano\__init__.py", line 110, in <module>
    from theano.compile import (
  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\site-packages\theano\compile\__init__.py", line 12, in <module>
    from theano.compile.mode import *
  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\site-packages\theano\compile\mode.py", line 11, in <module>
    import theano.gof.vm
  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\site-packages\theano\gof\vm.py", line 674, in <module>
    from . import lazylinker_c
  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\site-packages\theano\gof\lazylinker_c.py", line 140, in <module>
    preargs=args)
  File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\pymc_env\lib\site-packages\theano\gof\cmodule.py", line 2411, in compile_str
    (status, compile_stderr.replace('\n', '. ')))
. collect2.exe: error: ld returned 1 exit statuseano/compiledir_Windows-10-10.0.18362-SP0-Intel64_Family_6_Model_85_Stepping_4_GenuineIntel-3.7.7-64/lazylinker_ext/mod.cpp:976: undefined reference to `__imp__Py_TrueStruct'Error' more undefined references to `__imp__Py_NoneStruct' followow

theano version: 1.0.5
PYMC version: 3.9.3
Python: 3.7

Model code:

with pm.Model() as model:
    pm.glm.GLM.from_formula(formula=formula, data=result5, family=pm.glm.families.NegativeBinomial())
    trace = pm.sample(1000, tune=1000, cores=2)

Not sure if it matters but i’m running this in a spyder environment.

This is windows problem that we currently unfortunately don’t have a good solution. A workaround is:

trace = pm.sample(1000, tune=1000, cores=1)

Otherwise, you can check out some of the solution discussed here: Sample runtimeerror when cores>1

1 Like