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

**URL:** https://discourse.pymc.io/t/sample-remains-stack-until-i-press-enter/357
**Category:** Questions
**Created:** [September 21, 2017, 12:56pm UTC](https://discourse.pymc.io/t/sample-remains-stack-until-i-press-enter/357 "2017-09-21T12:56:01Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![mcavallaro](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/mcavallaro/32/187_2.png) [@mcavallaro](https://discourse.pymc.io/u/mcavallaro)
#### Post date: [September 21, 2017, 12:56pm UTC](https://discourse.pymc.io/t/sample-remains-stack-until-i-press-enter/357/1 "2017-09-21T12:56:01Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![aseyboldt](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/aseyboldt/32/5795_2.png) [@aseyboldt](https://discourse.pymc.io/u/aseyboldt)
#### Post date: [September 21, 2017, 5:53pm UTC](https://discourse.pymc.io/t/sample-remains-stack-until-i-press-enter/357/2 "2017-09-21T17:53:42Z")

</div>

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:

```auto
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 🙂

---

<div class="post-metadata">

### Author: ![ahartikainen](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/ahartikainen/32/34_2.png) [@ahartikainen](https://discourse.pymc.io/u/ahartikainen)
#### Post date: [September 21, 2017, 6:03pm UTC](https://discourse.pymc.io/t/sample-remains-stack-until-i-press-enter/357/3 "2017-09-21T18:03:59Z")

</div>

OT.

If you have conda you could use gcc on windows?

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

---

<div class="post-metadata">

### Author: ![mcavallaro](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/mcavallaro/32/187_2.png) [@mcavallaro](https://discourse.pymc.io/u/mcavallaro)
#### Post date: [September 27, 2017, 4:38pm UTC](https://discourse.pymc.io/t/sample-remains-stack-until-i-press-enter/357/4 "2017-09-27T16:38:46Z")

</div>

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 🙂

---

<div class="post-metadata">

### Author: ![mcavallaro](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/mcavallaro/32/187_2.png) [@mcavallaro](https://discourse.pymc.io/u/mcavallaro)
#### Post date: [September 28, 2017, 3:12pm UTC](https://discourse.pymc.io/t/sample-remains-stack-until-i-press-enter/357/5 "2017-09-28T15:12:19Z")

</div>

OT.

> [@ahartikainen](#):
>
> If you have conda you could use gcc on windows?

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

Thanks!

---

<div class="post-metadata">

### Author: ![ahartikainen](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/ahartikainen/32/34_2.png) [@ahartikainen](https://discourse.pymc.io/u/ahartikainen)
#### Post date: [September 28, 2017, 3:16pm UTC](https://discourse.pymc.io/t/sample-remains-stack-until-i-press-enter/357/6 "2017-09-28T15:16:29Z")

</div>

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](https://stackoverflow.com/questions/16737260/how-to-tell-distutils-to-use-gcc) (second answer).

---

<div class="post-metadata">

### Author: ![ahartikainen](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/ahartikainen/32/34_2.png) [@ahartikainen](https://discourse.pymc.io/u/ahartikainen)
#### Post date: [September 30, 2017, 4:30am UTC](https://discourse.pymc.io/t/sample-remains-stack-until-i-press-enter/357/7 "2017-09-30T04:30:20Z")

</div>

Oh, and you need to install `libpython`

```
conda install libpython -c conda-forge
```

---

<div class="post-metadata">

### Author: ![mcavallaro](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/mcavallaro/32/187_2.png) [@mcavallaro](https://discourse.pymc.io/u/mcavallaro)
#### Post date: [October 1, 2017, 5:05pm UTC](https://discourse.pymc.io/t/sample-remains-stack-until-i-press-enter/357/8 "2017-10-01T17:05:55Z")

</div>

@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.

---

<div class="post-metadata">

### Author: ![ahartikainen](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/ahartikainen/32/34_2.png) [@ahartikainen](https://discourse.pymc.io/u/ahartikainen)
#### Post date: [October 1, 2017, 5:18pm UTC](https://discourse.pymc.io/t/sample-remains-stack-until-i-press-enter/357/9 "2017-10-01T17:18:36Z")

</div>

`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.

---

<div class="post-metadata">

### Author: ![mcavallaro](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/mcavallaro/32/187_2.png) [@mcavallaro](https://discourse.pymc.io/u/mcavallaro)
#### Post date: [October 1, 2017, 5:44pm UTC](https://discourse.pymc.io/t/sample-remains-stack-until-i-press-enter/357/10 "2017-10-01T17:44:54Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ahartikainen](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/ahartikainen/32/34_2.png) [@ahartikainen](https://discourse.pymc.io/u/ahartikainen)
#### Post date: [October 1, 2017, 6:11pm UTC](https://discourse.pymc.io/t/sample-remains-stack-until-i-press-enter/357/11 "2017-10-01T18:11:08Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![mcavallaro](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/mcavallaro/32/187_2.png) [@mcavallaro](https://discourse.pymc.io/u/mcavallaro)
#### Post date: [October 1, 2017, 6:21pm UTC](https://discourse.pymc.io/t/sample-remains-stack-until-i-press-enter/357/12 "2017-10-01T18:21:25Z")

</div>

> [@ahartikainen](#):
>
> Did you conda install it?

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

---

<div class="post-metadata">

### Author: ![ahartikainen](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/ahartikainen/32/34_2.png) [@ahartikainen](https://discourse.pymc.io/u/ahartikainen)
#### Post date: [October 1, 2017, 8:26pm UTC](https://discourse.pymc.io/t/sample-remains-stack-until-i-press-enter/357/13 "2017-10-01T20:26:29Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mcavallaro](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/mcavallaro/32/187_2.png) [@mcavallaro](https://discourse.pymc.io/u/mcavallaro)
#### Post date: [October 1, 2017, 8:33pm UTC](https://discourse.pymc.io/t/sample-remains-stack-until-i-press-enter/357/14 "2017-10-01T20:33:22Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![ahartikainen](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/ahartikainen/32/34_2.png) [@ahartikainen](https://discourse.pymc.io/u/ahartikainen)
#### Post date: [October 1, 2017, 8:34pm UTC](https://discourse.pymc.io/t/sample-remains-stack-until-i-press-enter/357/15 "2017-10-01T20:34:53Z")

</div>

`mingw32` keyword is just there to force gcc.

---

<div class="post-metadata">

### Author: ![mcavallaro](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/mcavallaro/32/187_2.png) [@mcavallaro](https://discourse.pymc.io/u/mcavallaro)
#### Post date: [October 1, 2017, 9:48pm UTC](https://discourse.pymc.io/t/sample-remains-stack-until-i-press-enter/357/16 "2017-10-01T21:48:18Z")

</div>

@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)?

---

<div class="post-metadata">

### Author: ![ahartikainen](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/ahartikainen/32/34_2.png) [@ahartikainen](https://discourse.pymc.io/u/ahartikainen)
#### Post date: [October 2, 2017, 12:08am UTC](https://discourse.pymc.io/t/sample-remains-stack-until-i-press-enter/357/17 "2017-10-02T00:08:53Z")

</div>

`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.

---

<div class="post-metadata">

### Author: ![mcavallaro](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/mcavallaro/32/187_2.png) [@mcavallaro](https://discourse.pymc.io/u/mcavallaro)
#### Post date: [October 4, 2017, 11:58am UTC](https://discourse.pymc.io/t/sample-remains-stack-until-i-press-enter/357/18 "2017-10-04T11:58:36Z")

</div>

@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!
