question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot import with latest pymc3 & theano

See original GitHub issue

Describe the bug import starry throws a Theano error

To Reproduce import starry

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-53b69aeac1cd> in <module>
      1 import matplotlib.pyplot as plt
      2 import numpy as np
----> 3 import starry
      4 
      5 np.random.seed(12)

~/opt/anaconda3/lib/python3.8/site-packages/starry/__init__.py in <module>
     17 # Import the main interface
     18 from ._config import config
---> 19 from . import kepler, linalg, maps
     20 from .maps import Map
     21 from .kepler import Primary, Secondary, System

~/opt/anaconda3/lib/python3.8/site-packages/starry/kepler.py in <module>
      2 from . import config
      3 from ._constants import *
----> 4 from .maps import MapBase, RVBase, ReflectedBase
      5 from ._core import OpsSystem, math, linalg
      6 import numpy as np

~/opt/anaconda3/lib/python3.8/site-packages/starry/maps.py in <module>
      2 from . import config
      3 from ._constants import *
----> 4 from ._core import OpsYlm, OpsLD, OpsReflected, OpsRV, linalg, math
      5 from ._indices import integers, get_ylm_inds, get_ul_inds, get_ylmw_inds
      6 from ._plotting import (

~/opt/anaconda3/lib/python3.8/site-packages/starry/_core/__init__.py in <module>
      1 # -*- coding: utf-8 -*-
----> 2 from . import core, ops, utils
      3 
      4 from .core import *
      5 from .math import math, linalg

~/opt/anaconda3/lib/python3.8/site-packages/starry/_core/core.py in <module>
     31     # starry requires exoplanet >= v0.2.0
     32     from packaging import version
---> 33     import exoplanet
     34 
     35     if version.parse(exoplanet.__version__) < version.parse("0.2.0"):

~/opt/anaconda3/lib/python3.8/site-packages/exoplanet/__init__.py in <module>
     11 ]
     12 
---> 13 from . import distributions, interp, orbits
     14 from .citations import CITATIONS
     15 from .distributions import *  # NOQA

~/opt/anaconda3/lib/python3.8/site-packages/exoplanet/distributions/__init__.py in <module>
     14 ]
     15 
---> 16 from . import eccentricity
     17 from .base import Angle, Periodic, UnitDisk, UnitUniform, UnitVector
     18 from .deprecated import RadiusImpact, get_joint_radius_impact  # NOQA

~/opt/anaconda3/lib/python3.8/site-packages/exoplanet/distributions/eccentricity.py in <module>
      4 
      5 import numpy as np
----> 6 import pymc3 as pm
      7 import theano.tensor as tt
      8 

~/opt/anaconda3/lib/python3.8/site-packages/pymc3/__init__.py in <module>
     39 __set_compiler_flags()
     40 
---> 41 from . import gp, ode, sampling
     42 from .backends import load_trace, save_trace
     43 from .backends.tracetab import *

~/opt/anaconda3/lib/python3.8/site-packages/pymc3/gp/__init__.py in <module>
     14 
     15 from . import cov, mean, util
---> 16 from .gp import TP, Latent, LatentKron, Marginal, MarginalKron, MarginalSparse

~/opt/anaconda3/lib/python3.8/site-packages/pymc3/gp/gp.py in <module>
     23 import pymc3 as pm
     24 
---> 25 from pymc3.distributions import draw_values
     26 from pymc3.gp.cov import Constant, Covariance
     27 from pymc3.gp.mean import Zero

~/opt/anaconda3/lib/python3.8/site-packages/pymc3/distributions/__init__.py in <module>
     13 #   limitations under the License.
     14 
---> 15 from . import shape_utils, timeseries, transforms
     16 from .bart import BART
     17 from .bound import Bound

~/opt/anaconda3/lib/python3.8/site-packages/pymc3/distributions/timeseries.py in <module>
     21 from theano import scan
     22 
---> 23 from . import distribution, multivariate
     24 from .continuous import Flat, Normal, get_tau_sigma
     25 from .shape_utils import to_tuple

~/opt/anaconda3/lib/python3.8/site-packages/pymc3/distributions/multivariate.py in <module>
     25 from scipy import linalg, stats
     26 from theano.gof.op import get_test_value
---> 27 from theano.gof.utils import TestValueError
     28 from theano.tensor.nlinalg import det, eigh, matrix_inverse, trace
     29 from theano.tensor.slinalg import Cholesky

ImportError: cannot import name 'TestValueError' from 'theano.gof.utils' (/Users/james/opt/anaconda3/lib/python3.8/site-packages/theano/gof/utils.py)

Your setup (please complete the following information):

  • Version of starry: 1.0.0 installed via pip.
  • Operating system: macOS 11.1
  • Python version & installation method (pip, conda, etc.): Python 3.8.5 via anaconda.

exoplanet also installed via pip and has same error

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
dfmcommented, Jan 26, 2021

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"
2reactions
edterrellcommented, May 31, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

I cannot import pymc3 - python - Stack Overflow
conda remove theano pip uninstall Theano Theano-PyMC PyMC3 pip install PyMC3 ... If not, you may need to remove the theano directory.
Read more >
Problems when import newest pymc3 version (3.11.1)
When I import the newest pymc3 version (3.11.1), ... ImportError: cannot import name 'configdefaults' from 'theano' (unknown location).
Read more >
Variational Inference: Bayesian Neural Networks — PyMC3 ...
First, lets generate some toy data – a simple binary classification problem that's not linearly separable. In [1]:. %matplotlib inline import theano ......
Read more >
Using PyMC3/Theano is impossible in PyCharm ... - YouTrack
There is another workaround, but not nice one: Activate the pymc3 conda env in a terminal, then launch PyCharm from the terminal via...
Read more >
Statistical-Rethinking-with-Python-and-PyMC3/Lobby - Gitter
This is really weird, I just tried to reproduce and as expected I can not. ... use conda install -c conda-forge pymc3 for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found