@lucianopaz。Please help me solve the Windows multiprocessing issue


#22

Sorry for your bank card.

Your runs now look much better!

However there are two things that concern me:

Shows C:\Users\MyPC\AppData\Roaming\Python\Python37\site-packages is part of the interpreter’s search path. I think that is a part of the python path that was not installed by conda, and it may be messing up your imports because it has precedence over D:\ProgramData\Miniconda3\lib\site-packages.

Is C:\Users\MyPC\AppData\Roaming\Python\Python37\ the directory in which you installed python3.7 yourself or is it a symbolic link to some other directory? If it is the python3.7 that you installed by yourself and was not installed by conda, could you uninstall it?

I think that if you manage to sort that out, your codes should all work. The sampling methods themselves are working, but the theano standalone run shows that something is wrong, and that must cause the zeros in the mass matrices seen during sample.

It runs, which means that theano is installed, but your result was almost all zeros, which indicates that something did not work well with the numerical backend.


#23

@lucianopaz
Pymc3’s charioteer, Bayesian’s faithful follower,and Sickness’s fighter,Our Dear Luciano, Glory to you!

I installed python on disk F,I don’t know why disk C has it,and I can’t find uninstall button,Maybe “shift+delete”?But it’s not found in the environment variabl。。。I dare not use “shift+delete”

Happy to wait for your reply
——Your faithful troublemaker


#24

I’m a bit at a loss. What happens if you run this:

import numpy as np
import theano
from theano import tensor as tt

x = tt.dmatrix('x')
y = tt.dmatrix('y')
z = tt.dot(x, y)
f = theano.function([x, y], z)

A = np.array([[-0.195408  , -0.79416685,  1.1142236 ,  1.01763364,  0.28350749,
         1.55441464, -0.66808896, -0.80700587, -1.09693637,  1.41232938],
       [-0.05764286, -1.35682188, -0.3479584 ,  1.28120777, -0.49363274,
        -0.76385671,  0.33811174, -0.33761543, -0.75314635,  1.30016409]])
B = np.array([[ 0.04755224, -1.06552062, -0.03802723, -0.22908887],
       [ 0.00962718, -1.44721223, -0.62559325, -0.11290807],
       [-0.06272087,  0.78560667,  0.15078829, -1.20187507],
       [ 0.67990587, -0.27247529, -1.4114585 ,  0.00665858],
       [-2.21715775,  1.13131624, -1.28483744, -0.43963062],
       [ 0.80872775,  0.19078152,  0.1591206 ,  0.74483437],
       [-0.34560689, -1.41930579, -0.38575623, -0.79848214],
       [ 1.42346313,  1.95057336,  0.75163249, -0.01786211],
       [ 0.55345214, -0.55034648,  1.31852336, -0.65460804],
       [-1.76453543,  0.35340645,  1.8089588 ,  0.50017315]])
expected_result = np.array([[-2.78346422,  3.04981068, -0.1213441 ,  1.80753947],
       [-1.95462185,  0.4339387 ,  0.47757421,  1.12058154]])

print(np.dot(A, B))
print(f(A, B))
assert np.allclose(np.dot(A, B), expected_result), 'numpy.dot result did not match'
assert np.allclose(f(A, B), expected_result), 'theano.tensor.dot result did not match'


#25

@lucianopaz
Pymc3’s charioteer, Bayesian’s faithful follower,and Sickness’s fighter,Our Dear Luciano, Glory to you!

No warning。:sweat_smile:


#26

So this gives you almost all zero

But this doesn’t

It’s really odd. Could you try this:

import numpy as np

print(np.random.randn(4, 10))

#27

@lucianopaz
Pymc3’s charioteer, Bayesian’s faithful follower,and Sickness’s fighter,Our Dear Luciano, Glory to you!

No warning。:thinking:


#28

I’m really confused, because running this

import numpy as np
import theano
from theano import tensor as tt

x = tt.dmatrix('x')
y = tt.dmatrix('y')
z = tt.dot(x, y)
f = theano.function([x, y], z)
print(f(np.random.randn(4, 10), np.random.randn(10, 2)))

gives you almost zero results, but running the pieces separately give you reasonable results. I’m starting to think that you did something in between these two executions, which you did not really notice, that fixed your problem. If you rerun the pymc3 sampling script do you still get the error?

If you do still see the error, then you should uninstall miniconda, then try to run pip uninstall pymc3 theano numpy scipy. Then I’ll tell you step by step what you should run to have your running theano and pymc3 installation:

  1. conda install numpy scipy mkl-service libpython m2w64-toolchain nose sphinx
  2. conda install theano pygpu
  3. conda install pymc3

At the end of step 3, enter a python interpreter and run

import sys, numpy, theano, pymc3
print(sys.path)
print(numpy.__file__)
print(theano.__file__)
print(pymc3.__file__)

If all of these only point to packages installed under miniconda\lib\site-packages, then everything should be ok. Then try to run your problematic sampling script from PyCharm. If it does not work, try to run it from the command prompt as python Global_Observer.py. IF that works but it did not from PyCharm, try to uninstall Pycharm and then install it again.


#29

The thread is quite long.

I just wanted to drop and give you an advice. If you use conda environments / conda is not activated at start then there might be missing some $path locations.

Try to start pycharm from commandline (anaconda prompt / cmd.exe with conda activate base or what ever is your env.) And then just calling pycharm.exe.


#30

@lucianopaz
Pymc3’s charioteer, Bayesian’s faithful follower,and Sickness’s fighter,Our Dear Luciano, Glory to you!

I finished practicing kung fu to reply to you——This is a required course in China(Just kidding。haw haw)。:sunglasses:
Reinstall doesn’t help for me。But warning changed。Look…

:disappointed_relieved: I don’t know how to check the .py from PyCharm or not from


#31

@ahartikainen

Our Dear and poor Lucianopaz thought it was only short thread,But “trapped in the stockmarket”,haw~haw~


#32

I can only think of one more thing to check. Try to do the following and copy the output, do not take pictures copy and paste the text here:

import theano
print(theano.config)

Maybe your theano installation is not using miniconda’s c compiler, and is using a separate one, and that messes up the compilation and linking. If the c compiler is the one from miniconda, I think that you should try to ask at theano to see if they can help you solve your installation problem.


#33

Was is so that running models work from cmd.exe but not from pycharm?

If this is the case then it is definitely problem with activation that is broken with PyCharm (even if one sets up python inside pycharm)

See discussion in https://github.com/stan-dev/pystan/issues/520 (PyStan also needs specific compiler)

One option is to add gcc bin folder to $path


#34

@lucianopaz @ahartikainen @junpenglao
Pymc3’s charioteer, Bayesian’s faithful follower,and Sickness’s fighter,Our Dear Luciano, Glory to you more more more more more!

Good News!Good News!I solved it!I solved it!Look!(゚▽゚*) ヾ(^∀^)ノ(ノ゚∀゚)ノ

Our Dear Luciano!Here’s what happened:
1】I realized that the root cause was theano and Windows
2】So I Google how to install theano in Windows10
3】Add a .theanorc.txt solved it! The content is:

[global]
openmp=False
[blas]
ldflags= 
[gcc]
cxxflags=-ID:\ProgramData\Miniconda3\envs\untitled\MinGW

4】And,Python can’t be >=3.7,Probably related to theano’s devs go to Google work,haw~haw~

But,Why isn’t the speed thousands(335.24draws/s), Your speed is in four digits,Because “WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.”???

At last: Merry Christmas in advance!Bayes bless us!


#35

And one issue:Why is the graph still in a separate window
2