Closed jradavenport closed 3 years ago
also the version of theano is 1.0.5, and I cannot import pymc3, so I think that's where things are broken?
This is not really a starry problem. The most recent versions of PyMC3 and Theano have tons of compatibility issues and you're getting a collision between Theano and Theano-PyMC. I'd recommend doing a clean install with PyMC3<3.10 and Theano==1.0.5 (which will work and is probably not what you actually have installed even if it seems that way!).
OK, I tried to do a clean install w/ pip install pymc3==3.8.0
, and then pip install theano==1.0.5
.
It's definitely not a starry/exoplanet problem, b/c I still can't even import pymc3 or theano right now on the M1 MacBook Pro. Hmm. Time to do some reading on those package's issues!
Uh oh! What error do you get now?
In [1]: import pymc3
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-200e74b8195d> in <module>
----> 1 import pymc3
~/opt/anaconda3/lib/python3.8/site-packages/pymc3/__init__.py in <module>
3
4 from .blocking import *
----> 5 from .distributions import *
6 from .distributions import transforms
7 from .glm import *
~/opt/anaconda3/lib/python3.8/site-packages/pymc3/distributions/__init__.py in <module>
----> 1 from . import timeseries
2 from . import transforms
3 from . import shape_utils
4
5 from .continuous import Uniform
~/opt/anaconda3/lib/python3.8/site-packages/pymc3/distributions/timeseries.py in <module>
1 from scipy import stats
----> 2 import theano.tensor as tt
3 from theano import scan
4
5 from pymc3.util import get_variable_name
~/opt/anaconda3/lib/python3.8/site-packages/theano/__init__.py in <module>
108 object2, utils)
109
--> 110 from theano.compile import (
111 SymbolicInput, In,
112 SymbolicOutput, Out,
~/opt/anaconda3/lib/python3.8/site-packages/theano/compile/__init__.py in <module>
26 from theano.compile.builders import *
27
---> 28 from theano.compile.function import function, function_dump
~/opt/anaconda3/lib/python3.8/site-packages/theano/compile/function/__init__.py in <module>
5 from collections import OrderedDict
6
----> 7 from theano.compile.function.pfunc import pfunc
8 from theano.compile.function.types import orig_function
9
~/opt/anaconda3/lib/python3.8/site-packages/theano/compile/function/pfunc.py in <module>
8
9 from theano import config
---> 10 from theano.compile.function.types import UnusedInputError, orig_function
11 from theano.compile.io import In, Out
12 from theano.compile.profiling import ProfileStats
~/opt/anaconda3/lib/python3.8/site-packages/theano/compile/function/types.py in <module>
21 from theano.gof import graph
22 from theano.gof.op import ops_with_inner_function
---> 23 from theano.gof.toolbox import is_same_graph
24
25
ImportError: cannot import name 'is_same_graph' from 'theano.gof.toolbox' (/Users/james/opt/anaconda3/lib/python3.8/site-packages/theano/gof/toolbox.py)
This suggests to me that you still have theano-pymc installed. Can you tell me exactly which steps you went through to install?
(This isn't anything to do with the M1 - it's issues with colliding namespaces!)
I get the same issue at pymc3 import when both exoplanet
and starry
are installed through pip within a virtual env:
Same setup(s) with python 3.7.5 gives no error when importing pymc3. However when importig exoplanet
I get
[...]/exoplanet/theano_ops/contact_points.py", line 14, in <module> class ContactPoints(theano.Op):
AttributeError: module 'theano' has no attribute 'Op'
I couldn't find this issue in the exoplanet
existing ones
Interesting. I'm planning a new release of starry
that should help with these compatibility issues. The particular error you're getting is within exoplanet
. @dfm, any ideas?
This is the same problem: @lgrcia, you must have Theano-pymc installed. Starry is not compatible with (several!) of the most recent versions of PyMC3 or the Theano-pymc project. You'll need to run
pip uninstall theano-pymc # run a few times until it says not installed
pip install "pymc3<3.10" "theano==1.0.5"
@dfm Do you think I should try to upgrade stuff in starry
to rely on theano-pymc
? Or is it still too volatile?
I notice that pip install starry
is collecting theano-pymc
so I will have to uninstall it every time I install starry
. Ignore if that doesn't help. It is solved and usable on my side. Many thanks
@lgrcia: that's because starry doesn't pin PyMC3. If you manually install PyMC3 and theano first then pip install starry shouldn't try to update.
@rodluger: I think it's worth trying to keep it up to date but they're breaking stuff pretty fast over there so we won't always be able to stay up to date. For example, the current exoplanet is compatible with the last minor version of theano-pymc but the current release looks like it won't even import!
Ugh. Sounds good. I'll aim for a new release of starry next week (ish). Let's chat more offline about this.
This did the trick for exoplanet: https://github.com/exoplanet-dev/exoplanet/blob/testval/src/exoplanet/theano_ops/compat.py
I know this is closed, but after struggling to get pymc3 worining on an imac, I stumbled across the following which worked for me on stackoverflow: https://stackoverflow.com/questions/65543096/i-cannot-import-pymc3
conda remove theano pip uninstall Theano Theano-PyMC PyMC3 pip install PyMC3
Describe the bug
import starry
throws a Theano errorTo Reproduce
import starry
Your setup (please complete the following information):
exoplanet
also installed via pip and has same error