Error in Trace sampleing and traceplot

Hi fellows.

I am a new learner in PYMC3 and I installed the package recently and i tried to run a sample example from the pcmc3 avilbale examples which is this one:

Binomial regression — PyMC3 3.11.5 documentation

I already installed all required packages but when I try to get sample using:

with binomial_regression_model:
    trace = pm.sample(1000, tune=2000, return_inferencedata=True)

then i get this error:

You can find the C code in this temporary file: C:\Users\mmabae\AppData\Local\Temp\theano_compilation_error_blwto6qk

The above exception was the direct cause of the following exception:

ValueError                                Traceback (most recent call last)
File ~\Anaconda3\lib\site-packages\pymc3\, in run()
    132 try:
    133     # We do not create this in __init__, as pickling this
    134     # would destroy the shared memory.
--> 135     self._unpickle_step_method()
    136     self._point = self._make_numpy_refs()

File ~\Anaconda3\lib\site-packages\pymc3\, in _unpickle_step_method()
    117     except Exception:
--> 118         raise ValueError(unpickle_error)
    119 elif self._pickle_backend == "dill":

ValueError: The model could not be unpickled. This is required for sampling with more than one core and multiprocessing context spawn or forkserver.

The above exception was the direct cause of the following exception:

RuntimeError                              Traceback (most recent call last)
Input In [41], in <cell line: 1>()
      1 with binomial_regression_model:
----> 2     trace = pm.sample(1000, tune=2000, return_inferencedata=True)

Could you kindly help me what is the problem? is there anything wrong with my package installation? I tried it from Pycharm and Jupyter but all is the same error. when i check instaled package it seems that all is installed but I do not know why it did not work

Thank you for your advice in advance

Welcome. Can you provide some information about which version of the following packages you have installed and what platform (Windows, etc.) you are on?

  • pymc
  • theano (or aesara)

Dear Cluhmann, thank you for your consideration. I just installed the last version of Pymc3 today, but i did not installed any package name as theano. However when i checked conda list i see that there is name as thean_pymc.
Actually i am installing all these packages on my university laptop. I am not sure if it is one of the reasons because i used my local user not administrator user. However during the installation i did not receive any error and it mentioned installation was successfully done. First i installed pymc from Pycharm setting but after that i used anaconda commander for installation. For both the error persists on my system

What platform are you on? Looks like either Mac or linux? Can you try running on a single core to see if that works (info here)?

I jusy double check all installed packages in the pm3env from anaconda comand prompt, unfortunately there is non of theTheono or theono-pymc installed. How I can install it?

Thats true, I am using windows on my Dell Laptop

Please follow the installation instructions found here.

Dear cluhmann, I created a new environment as pm3env and i did all installation in the anaconda prompt commander accordingly. It said that everything installed correctly also I checked that Theono-pymc is installed in my coda list. However when i try to use the command “import pymc3 as pm” it is mentioend that I have not installed any package as pymc3. I checked in pycharm and jupyter non of the works.

here is my checks for installation of python from annaconda command prompt:

(pm3env) C:\Users\mahdy>python -c "import pymc3; print(pymc3.version)
WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.

I just tried to run pymc3 from annaconda command which was fortunatelly ok:

(pm3env) C:\Users\mahdy>ipython
Python 3.7.12 | packaged by conda-forge | (default, Oct 26 2021, 05:35:01) [MSC v.1916 64 bit (AMD64)]
Type ‘copyright’, ‘credits’ or ‘license’ for more information
IPython 7.31.1 – An enhanced Interactive Python. Type ‘?’ for help.

In [1]: import pymc3 as pm
WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.

but I do not know how I should call it from jupyter notbook or pycharm. it seems that everything is done successfully, i am really appreciate for your yesteday advice

Dear Cluhmann, hopefully i got runnng a simple exmple in pymc3 three with two chains. evrything is now ok. I was not aware that I must change the root of annaconda from base to me new envirnment. when i changed it the PYMC3 was shown up. thank you very much for your time

1 Like

Glad that worked for you!