`sample()` remains stack until I press `enter`


#1

Hello, a very simple question for you, did you ever had the following problem:

sample() remains stuck until I press enter. Once I pressed enter, the sampler continues seamlessy, and gives me the correct posterior. When I say “stuck” I mean, litterally, the advacement bar freeses and the step counter shows a constant count number.

I’m “prototyping” a model on a windows machine with no c++ installed (theano prints the warning that performances are severely degrated, but that’s not a problem, as I’ll use a linux HPC cluster). Pymc3 was installed via conda-forge.

It is possible that it is a minor problem specific of windows, and its cmd.exe terminal. Does anyone has experience on that?

I do not wish to share the model at the moment, but would just know if what I described above is a known problem.

Thanks!


#2

That is very strange. I don’t have a windows machine at hand to test, unfortunately.
How are you executing the model (interactive ipython, execute script…)?
Could you try if this also happen when you disable the progressbar? (pass progressbar=False to pm.sample)
Does the same thing happen in plain theano? Something like that maybe:

import theano
import theano.tensor as tt
import numpy as np

a = tt.vector('a')
y = 2 * a ** 2 + 1.
func = theano.function([a], y)
func(np.array([1., 2.])

Thanks for reporting :slight_smile:


#3

OT.

If you have conda you could use gcc on windows?

https://anaconda.org/msys2/m2w64-toolchain

#4

Thanks for your comments. It seems that what I experienced is just a sort of feature of the windows terminal. Left click with the mouse on the terminal, it pauses. Press enter, the execution will restart :slight_smile:


#5

OT.

m2w64-toolchain is installed, but still theano prints the same degraded performance warning.

Thanks!


#6

And you have created the distutils.cfg file?

It might be that you need to install theano after the toolchain “activated”.

https://stackoverflow.com/questions/16737260/how-to-tell-distutils-to-use-gcc (second answer).


#7

Oh, and you need to install libpython

conda install libpython -c conda-forge

#8

@ahartikainen Thanks! libpython has been installed, but didn’t help. And I didn’t understood how to deal with distutils.cfg and why. It seems the link refers to system where a c compiler is installed, while this is not my case.


#9

distutils.cfg forces distutils (cython) to use chosen compiler. Else the system default is used, that should be msvc.

What will this give you?

from Cython.Build.Inline import _get_build_extension
print(str(_get_build_extension().compiler))

If it is None, then it uses default.


#10

@ahartikainen It gives mingw32 ! Do I need to set msvc?


#11

No, then everything should work.

I guess this is then some problem with theano. Not sure if there are optional compiled parts when it is installed. Did you conda install it?


#12

Yes, I let conda do everything (from conda-forge).


#13

I would try to reinstall theano. If you installed theano before g++, then there are probably some configurations setup at the installation.


#14

I didn’t install manually mingw32. But I conda installed first m2w64toolchain, then theano. Is mingw32 part of m2w64toolchain? Btw perhaps there is a conflict of 32 vs 64 libraries?


#15

mingw32 keyword is just there to force gcc.


#16

@ahartikainen Thanks a lot for your help! But sorry, I didn’t get the last bit. I first installed m2w64toolchain then theano, an still have the usual warning. I didn’t undestand if mingw32 is installed with m2w64toolchain. If not, how can I reinstall that g++ (as you suggested)?


#17

m2w64 installs mingw-w64 (gcc). The keyword mingw32 is just for calling mingw (–> gcc). So it’s just from the past. It might get fixed now, when they update distutils.


#18

@ahartikainen Good news, in a second environment, created with:

conda create -n second_enviroment  m2w64-toolchain theano

I don’t got the warning.

I assume that also in the root enviroment, if I purge everything and then reinstall, the warning wouldn’t show up. (but I don’t really want to investigate).

Thanks for you help!