Reputation: 105
I cannot import pymc3, after installation I get the error message below. Based on issues others noted I installed !pip install pymc3, conda install m2w64-toolchain, conda install theano
I get the same error message when attempting to import theano as well. "ImportError: cannot import name 'is_same_graph' from 'theano.gof.toolbox"
import pymc3 as pm
Traceback (most recent call last):
File "<ipython-input-2-2e5c536b7c65>", line 1, in <module>
import pymc3 as pm
File "C:\Users\xxx\Anaconda3\lib\site-packages\pymc3\__init__.py", line 39, in <module>
__set_compiler_flags()
File "C:\Users\xxx\Anaconda3\lib\site-packages\pymc3\__init__.py", line 33, in __set_compiler_flags
import theano
File "C:\Users\xxx\Anaconda3\lib\site-packages\theano\__init__.py", line 110, in <module>
from theano.compile import (
File "C:\Users\xxx\Anaconda3\lib\site-packages\theano\compile\__init__.py", line 28, in <module>
from theano.compile.function import function, function_dump
File "C:\Users\xxx\Anaconda3\lib\site-packages\theano\compile\function\__init__.py", line 7, in <module>
from theano.compile.function.pfunc import pfunc
File "C:\Users\xxx\Anaconda3\lib\site-packages\theano\compile\function\pfunc.py", line 10, in <module>
from theano.compile.function.types import UnusedInputError, orig_function
File "C:\Users\xxx\Anaconda3\lib\site-packages\theano\compile\function\types.py", line 23, in <module>
from theano.gof.toolbox import is_same_graph
ImportError: cannot import name 'is_same_graph' from 'theano.gof.toolbox' (C:\Users\xxx\Anaconda3\lib\site-packages\theano\gof\toolbox.py)
Upvotes: 2
Views: 7917
Reputation: 133
You likely need to ensure you have the correct version of the Theano-PyMC fork of Theano
installed. You may also need to remove an overlapping installation of the original Theano
. At this time it looks like PyMC3 3.10.0
is constrained to install with Theano-PyMC 1.0.11
. You may find that
conda remove theano
pip uninstall Theano Theano-PyMC PyMC3
pip install PyMC3
would fix your issue. If not, you may need to remove the theano directory. On a *nix system, depending on your configuration, this could be in /usr/lib
so you might need to run an analog of
sudo rm -fr /usr/lib/python3.9/site-packages/theano/
relevant to your Windows system in between the uninstall and reinstall. There may be other issues that arise because of the interaction between anaconda and pip.
Upvotes: 2