Peter Coghill
Peter Coghill

Reputation: 381

Using PYMC3 on Windows 10 - theano cannot import name 'floatX'

I'm struggling to get PYMC3 to install correctly on windows. I've tried using the Anaconda package via conda install -c conda-forge pymc3 and in a virtualenv using only pip as per the documentation.

It seems to install ok, but fails when running an import pymc3 with the following error. Research suggests that there may be some dependencies which are getting missed.

    >>> import pymc3
WARNING (theano.sandbox.cuda): The cuda backend is deprecated and will be removed in the next release (v0.10).  Please switch to the gpuarray backend. You can get more information about how to switch at this URL:
 https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpuarray%29

ERROR (theano.sandbox.cuda): nvcc compiler not found on $PATH. Check your nvcc installation and try again.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\__init__.py", line 8, in <module>
    from .sampling import *
  File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\sampling.py", line 11, in <module>
    from .step_methods import (NUTS, HamiltonianMC, Metropolis, BinaryMetropolis,
  File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\step_methods\__init__.py", line 3, in <module>
    from .hmc import HamiltonianMC
  File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\step_methods\hmc\__init__.py", line 1, in <module>
    from .hmc import HamiltonianMC
  File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\step_methods\hmc\hmc.py", line 7, in <module>
    from .base_hmc import BaseHMC
  File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\step_methods\hmc\base_hmc.py", line 2, in <module>
    from .trajectory import get_theano_hamiltonian_functions
  File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\step_methods\hmc\trajectory.py", line 3, in <module>
    from pymc3.theanof import join_nonshared_inputs, gradient, CallableTensor, floatX
ImportError: cannot import name 'floatX'

I can't find much out there about this floatx package.

Seems to be a windows thing - as it installed and runs no problems on my old Ubuntu box (with anaconda).

Any help gratefully received!

EDIT: Step closer. For some reason I had the path to the nvcc compiler wrong. So if you suffer the same check that you have the full path including "\bin" in your environmnental path. If you make a change don't forget to restart.

Now I get an error:

    >>> import pymc3
WARNING (theano.sandbox.cuda): The cuda backend is deprecated and will be removed in the next release (v0.10).  Please switch to the gpuarray backend. You can get more information about how to switch at this URL:
 https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpuarray%29

Using gpu device 0: GeForce GTX 960M (CNMeM is disabled, cuDNN not available)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\__init__.py", line 4, in <module>
    from .distributions import *
  File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\distributions\__init__.py", line 1, in <module>
    from . import timeseries
  File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\distributions\timeseries.py", line 1, in <module>
    import theano.tensor as tt
  File "C:\Users\peter\Anaconda3\lib\site-packages\theano\__init__.py", line 116, in <module>
    theano.sandbox.cuda.tests.test_driver.test_nvidia_driver1()
  File "C:\Users\peter\Anaconda3\lib\site-packages\theano\sandbox\cuda\tests\test_driver.py", line 32, in test_nvidia_driver1
    profile=False)
  File "C:\Users\peter\Anaconda3\lib\site-packages\theano\compile\function.py", line 326, in function
    output_keys=output_keys)
  File "C:\Users\peter\Anaconda3\lib\site-packages\theano\compile\pfunc.py", line 486, in pfunc
    output_keys=output_keys)
  File "C:\Users\peter\Anaconda3\lib\site-packages\theano\compile\function_module.py", line 1795, in orig_function
    defaults)
  File "C:\Users\peter\Anaconda3\lib\site-packages\theano\compile\function_module.py", line 1661, in create
    input_storage=input_storage_lists, storage_map=storage_map)
  File "C:\Users\peter\Anaconda3\lib\site-packages\theano\gof\link.py", line 699, in make_thunk
    storage_map=storage_map)[:3]
  File "C:\Users\peter\Anaconda3\lib\site-packages\theano\gof\vm.py", line 1098, in make_all
    self.updated_vars,
  File "C:\Users\peter\Anaconda3\lib\site-packages\theano\gof\vm.py", line 952, in make_vm
    vm = CVM(
NameError: name 'CVM' is not defined
>>>

This I fixed with the last post here: https://groups.google.com/forum/#!msg/theano-users/JoTu61_MTLk/4ZzsVyaOf2kJ. But now stuck with an error:

>>> import pymc3
Traceback (most recent call last):
  File "C:\Users\peter\Anaconda3\lib\site-packages\theano\gof\cutils.py", line 306, in <module>
    from cutils_ext.cutils_ext import *  # noqa
ImportError: No module named 'cutils_ext.cutils_ext'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\peter\Anaconda3\lib\site-packages\theano\gof\cutils.py", line 317, in <module>
    from cutils_ext.cutils_ext import *  # noqa
ImportError: No module named 'cutils_ext.cutils_ext'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\__init__.py", line 4, in <module>
    from .distributions import *
  File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\distributions\__init__.py", line 1, in <module>
    from . import timeseries
  File "C:\Users\peter\Anaconda3\lib\site-packages\pymc3\distributions\timeseries.py", line 1, in <module>
    import theano.tensor as tt
  File "C:\Users\peter\Anaconda3\lib\site-packages\theano\__init__.py", line 80, in <module>
    from theano.scan_module import (scan, map, reduce, foldl, foldr, clone,
  File "C:\Users\peter\Anaconda3\lib\site-packages\theano\scan_module\__init__.py", line 41, in <module>
    from theano.scan_module import scan_opt
  File "C:\Users\peter\Anaconda3\lib\site-packages\theano\scan_module\scan_opt.py", line 60, in <module>
    from theano import tensor, scalar
  File "C:\Users\peter\Anaconda3\lib\site-packages\theano\tensor\__init__.py", line 9, in <module>
    from theano.tensor.subtensor import *
  File "C:\Users\peter\Anaconda3\lib\site-packages\theano\tensor\subtensor.py", line 26, in <module>
    import theano.gof.cutils  # needed to import cutils_ext
  File "C:\Users\peter\Anaconda3\lib\site-packages\theano\gof\cutils.py", line 320, in <module>
    compile_cutils()
  File "C:\Users\peter\Anaconda3\lib\site-packages\theano\gof\cutils.py", line 285, in compile_cutils
    preargs=args)
  File "C:\Users\peter\Anaconda3\lib\site-packages\theano\gof\cmodule.py", line 2313, in compile_str
    return dlimport(lib_filename)
  File "C:\Users\peter\Anaconda3\lib\site-packages\theano\gof\cmodule.py", line 302, in dlimport
    rval = __import__(module_name, {}, {}, [module_name])
ImportError: DLL load failed: The specified procedure could not be found.
>>>

The investigation continues! Maybe it's time to bin windows and move to linux full time!

EDIT2: I switched to a python 2.7 environment and it seems to work ok. Had to install http://mingw.org/ but after that all ok.

Would be nice to get it to work in 3.6 though. Thoughts anyone?

Upvotes: 0

Views: 3152

Answers (1)

Peter Coghill
Peter Coghill

Reputation: 381

Ok, I managed to cobble an install together.

I had no luck with the dependency management etc using conda install -c conda-forge pymc3, and I couldn't be sure if there were issues with locations/paths to compilers etc. So I did a re-install from the start.

I went for Anaconda3 (rather than 2) and it worked fine.

1) I followed the environment setup here https://github.com/philferriere/dlwin until I got to the point of installing Theano. But instead of the version suggested I installed the latest with conda install -c rdonnelly Theano suggested by https://github.com/nouiz. This is a nice solid environment set up - and i really recommend the msys tool - I hadn't used it before.

The test script in the philferriere guide are a good way to test function/performance.

2) Then I set up pymc3 using pip install pymc3 as they suggest here https://github.com/pymc-devs/pymc3. but NOT the latest version on git.

Hope someone finds this useful.

Refs: https://github.com/Theano/Theano/issues/5348

Upvotes: 3

Related Questions