rodluger / starry

Tools for mapping stars and planets.
https://starry.readthedocs.io
MIT License
138 stars 32 forks source link

importing starry but get an error on attribute 'geweke' #275

Closed wj198414 closed 3 years ago

wj198414 commented 3 years ago
>>> import starry
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages/starry/__init__.py", line 17, in <module>
    from . import kepler, linalg, maps
  File "/Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages/starry/kepler.py", line 4, in <module>
    from .maps import MapBase, RVBase, ReflectedBase
  File "/Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages/starry/maps.py", line 4, in <module>
    from ._core import OpsYlm, OpsLD, OpsReflected, OpsRV, math
  File "/Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages/starry/_core/__init__.py", line 2, in <module>
    from . import core, ops, utils, math
  File "/Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages/starry/_core/core.py", line 31, in <module>
    import exoplanet
  File "/Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages/exoplanet/__init__.py", line 12, in <module>
    from . import distributions, interp, orbits
  File "/Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages/exoplanet/distributions/__init__.py", line 16, in <module>
    from . import eccentricity
  File "/Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages/exoplanet/distributions/eccentricity.py", line 7, in <module>
    import pymc3 as pm
  File "/Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages/pymc3/__init__.py", line 64, in <module>
    from .stats import *
  File "/Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages/pymc3/stats/__init__.py", line 47, in <module>
    geweke = map_args(az.geweke)
AttributeError: module 'arviz' has no attribute 'geweke'
dfm commented 3 years ago

This is a PyMC3 issue (old versions of PyMC are not compatible with new versions of ArviZ), not a starry issue! You'll need to update PyMC3 or downgrade arviz (this is probably the easier approach). @rodluger can probably suggest which would be best. To downgrade ArviZ, use:

python -m pip uninstall arviz
python -m pip install "arviz<0.11"
rodluger commented 3 years ago

Alternatively you could just upgrade pymc3 to pymc3>=3.11.

rodluger commented 3 years ago

@wj198414 Were you able to get starry to work?

wj198414 commented 3 years ago

Thanks for checking. I followed Dan's instruction but got the following error:

(base) AST-NC211577:results wang.12220$ python -m pip uninstall arviz

Found existing installation: arviz 0.11.2

Uninstalling arviz-0.11.2:

Would remove:

/Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages/arviz-0.11.2.dist-info/*

/Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages/arviz/*

Proceed (y/n)? y

Successfully uninstalled arviz-0.11.2

(base) AST-NC211577:results wang.12220$ python -m pip install "arviz<0.11"

Collecting arviz<0.11

Downloading arviz-0.10.0-py3-none-any.whl (1.5 MB)

 |████████████████████████████████| 1.5 MB 2.5 MB/s

Requirement already satisfied: numpy>=1.12 in /Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages (from arviz<0.11) (1.19.5)

Requirement already satisfied: packaging in /Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages (from arviz<0.11) (20.1)

Requirement already satisfied: pandas>=0.23 in /Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages (from arviz<0.11) (1.0.1)

Requirement already satisfied: netcdf4 in /Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages (from arviz<0.11) (1.5.6)

Requirement already satisfied: matplotlib>=3.0 in /Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages (from arviz<0.11) (3.3.4)

Requirement already satisfied: xarray>=0.16.1 in /Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages (from arviz<0.11) (0.16.2)

Requirement already satisfied: scipy>=0.19 in /Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages (from arviz<0.11) (1.5.4)

Requirement already satisfied: setuptools>=38.4 in /Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages (from arviz<0.11) (46.0.0.post20200309)

Requirement already satisfied: pyparsing>=2.0.2 in /Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages (from packaging->arviz<0.11) (2.4.6)

Requirement already satisfied: six in /Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages (from packaging->arviz<0.11) (1.14.0)

Requirement already satisfied: pytz>=2017.2 in /Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages (from pandas>=0.23->arviz<0.11) (2019.3)

Requirement already satisfied: python-dateutil>=2.6.1 in /Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages (from pandas>=0.23->arviz<0.11) (2.8.1)

Requirement already satisfied: cftime in /Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages (from netcdf4->arviz<0.11) (1.4.1)

Requirement already satisfied: pillow>=6.2.0 in /Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages (from matplotlib>=3.0->arviz<0.11) (7.1.2)

Requirement already satisfied: kiwisolver>=1.0.1 in /Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages (from matplotlib>=3.0->arviz<0.11) (1.1.0)

Requirement already satisfied: cycler>=0.10 in /Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages (from matplotlib>=3.0->arviz<0.11) (0.10.0)

Installing collected packages: arviz

Successfully installed arviz-0.10.0

(base) AST-NC211577:results wang.12220$ python

Python 3.6.10 |Anaconda, Inc.| (default, Jan 7 2020, 15:01:53)

[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

SyntaxError: invalid syntax

import starry

Fatal error in MPI_Init_thread: Other MPI error, error stack:

MPIR_Init_thread(474)..............:

MPID_Init(190).....................: channel initialization failed

MPIDI_CH3_Init(89).................:

MPID_nem_init(320).................:

MPID_nem_tcp_init(173).............:

MPID_nem_tcp_get_business_card(420):

MPID_nem_tcp_init(379).............: gethostbyname failed, AST-NC211577 (errno 1)

[unset]: write_line error; fd=-1 buf=:cmd=abort exitcode=3191311

:

system msg for write_line failure : Bad file descriptor

On Mon, Mar 22, 2021 at 1:51 PM Rodrigo Luger @.***> wrote:

@wj198414 https://github.com/wj198414 Were you able to get starry to work?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rodluger/starry/issues/275#issuecomment-804268645, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADBPRTQN6BDS6XB6SYTQZJLTE57SHANCNFSM4ZPM7WIA .

rodluger commented 3 years ago

@dfm Any ideas what's happening? @wj198414 This doesn't look like a starry error, since there are no explicit multiprocessing or MPI calls in the code. Can you check if you're able to import other modules that starry depends on, such as arviz, pymc3, and exoplanet? I also don't understand why you're getting SyntaxError: invalid syntax. Is there no extra information in the error log?

dfm commented 3 years ago

Perhaps my proposal wasn't a good one since pip can't resolve the dependencies (although I don't think this is at all related to the error that you're seeing!).

I'd recommend starting with a clean environment and just install starry and pymc3 directly as Rodrigo suggested.

wj198414 commented 3 years ago

Hi guys,

Thanks for your suggestion. I am working with my IT support to see if we can fix the issue. Will report back.

Ji

On Tue, Mar 23, 2021 at 9:44 AM Dan Foreman-Mackey @.***> wrote:

Perhaps my proposal wasn't a good one since pip can't resolve the dependencies (although I don't think this is at all related to the error that you're seeing!).

I'd recommend starting with a clean environment and just install starry and pymc3 directly as Rodrigo suggested.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rodluger/starry/issues/275#issuecomment-804914394, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADBPRTRLEO3J4PD5XCQBH6TTFCLMNANCNFSM4ZPM7WIA .

wj198414 commented 3 years ago

I followed this thread to fix the MPI issue (the 2nd suggestion):

https://stackoverflow.com/questions/23112515/mpich2-gethostbyname-failed

Now I have the following error messages. The plot still pops up, though.

Thanks,

Ji

import starry

starry.config.lazy = False

map = starry.Map(ydeg=5)

Pre-computing some matrices... Done.

map.y

array([1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,

   0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,

   0., 0.])

map.show()

Compiling render...

ERROR (theano.gof.opt): SeqOptimizer apply <theano.tensor.opt.FusionOptimizer object at 0x14ededbe0>

ERROR (theano.gof.opt): Traceback:

ERROR (theano.gof.opt): Traceback (most recent call last):

File "/Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages/theano/scalar/basic.py", line 358, in filter

" (%s) and allow_downcast is not True" % self.dtype

TypeError: Value cannot accurately be converted to dtype (float64) and allow_downcast is not True

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages/theano/gof/opt.py", line 249, in apply

sub_prof = optimizer.optimize(fgraph)

File "/Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages/theano/gof/opt.py", line 89, in optimize

ret = self.apply(fgraph, *args, **kwargs)

File "/Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages/theano/tensor/opt.py", line 7774, in apply

new_outputs = self.optimizer(node)

File "/Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages/theano/tensor/opt.py", line 7721, in local_fuse

ret = local_fuse(new_node)

File "/Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages/theano/tensor/opt.py", line 7596, in local_fuse

tmp.tag.test_value = tv.flatten()[0]

File "/Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages/theano/gof/utils.py", line 277, in setattr

obj = self.attr_filter(obj)

File "/Users/wang.12220/opt/anaconda3/lib/python3.6/site-packages/theano/scalar/basic.py", line 364, in filter

e,

TypeError: ("Could not convert <class 'numpy.float64'> (value=nan) to float64", TypeError('Value cannot accurately be converted to dtype (float64) and allow_downcast is not True',))

Done.

On Tue, Mar 23, 2021 at 11:12 AM Ji Wang @.***> wrote:

Hi guys,

Thanks for your suggestion. I am working with my IT support to see if we can fix the issue. Will report back.

Ji

On Tue, Mar 23, 2021 at 9:44 AM Dan Foreman-Mackey < @.***> wrote:

Perhaps my proposal wasn't a good one since pip can't resolve the dependencies (although I don't think this is at all related to the error that you're seeing!).

I'd recommend starting with a clean environment and just install starry and pymc3 directly as Rodrigo suggested.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rodluger/starry/issues/275#issuecomment-804914394, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADBPRTRLEO3J4PD5XCQBH6TTFCLMNANCNFSM4ZPM7WIA .

rodluger commented 3 years ago

Which version of Theano do you have installed? I ran into this issue once -- there is one version out there that really dislikes NaNs.

wj198414 commented 3 years ago

How do I check? I did the following but failed.

import Theano

Traceback (most recent call last):

File "", line 1, in

ModuleNotFoundError: No module named 'Theano'

Ji

On Wed, Mar 24, 2021 at 3:18 PM Rodrigo Luger @.***> wrote:

Which version of Theano do you have installed? I ran into this issue once -- there is one version out there that really dislikes NaNs.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rodluger/starry/issues/275#issuecomment-806088595, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADBPRTRAOWA3OJXKALW2EHTTFI3IRANCNFSM4ZPM7WIA .

rodluger commented 3 years ago

Try lowercase theano:

import theano
print(theano.__version__)
wj198414 commented 3 years ago

import theano

print(theano.version)

1.0.11

On Wed, Mar 24, 2021 at 4:32 PM Rodrigo Luger @.***> wrote:

Try lowercase theano:

import theano print(theano.version)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rodluger/starry/issues/275#issuecomment-806167806, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADBPRTVGH6KFECYYDHWLKIDTFJD63ANCNFSM4ZPM7WIA .

rodluger commented 3 years ago

That version of theano (it's actually theano-pymc) is quite buggy. You should upgrade it to at least theano-pymc==1.1.0, but I suspect you still have pymc3==3.10.0? Do

pip install pymc3>=3.11.0

and that should automatically update theano and fix everything for you. Let me know if it works.

wj198414 commented 3 years ago

It does not seem to do anything.

Thanks,

Ji

(base) AST-NC211577:Retrievals_Ji_Information_TOI_270c wang.12220$ pip install pymc3>=3.11.0

(base) AST-NC211577:Retrievals_Ji_Information_TOI_270c wang.12220$ python

Python 3.6.10 |Anaconda, Inc.| (default, Jan 7 2020, 15:01:53)

[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

import pymc3

print(pymc3.version)

3.10.0

On Fri, Mar 26, 2021 at 10:46 AM Rodrigo Luger @.***> wrote:

That version of theano (it's actually theano-pymc) is quite buggy. You should upgrade it to at least theano-pymc==1.1.0, but I suspect you still have pymc3==3.10.0? Do

pip install pymc3>=3.11.0

and that should automatically update theano and fix everything for you. Let me know if it works.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rodluger/starry/issues/275#issuecomment-808276678, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADBPRTUSD6ALNJ7HJYLLXXDTFSM5XANCNFSM4ZPM7WIA .

rodluger commented 3 years ago

Try

python -m pip install pymc3==3.11.0
wj198414 commented 3 years ago

(base) AST-NC211577:Retrievals_Ji_Information_TOI_270c wang.12220$ python -m pip install pymc3==3.11.0

ERROR: Could not find a version that satisfies the requirement pymc3==3.11.0 (from versions: 3.0rc1, 3.0rc2, 3.0rc4, 3.0rc5, 3.0rc6, 3.0, 3.1rc1, 3.1rc2, 3.1rc3, 3.1, 3.2rc1, 3.2, 3.3rc1, 3.3rc2, 3.3, 3.4rc1, 3.4rc2, 3.4.1, 3.5rc1, 3.5, 3.6, 3.7rc1, 3.7, 3.8, 3.9.0, 3.9.1, 3.9.2, 3.9.3, 3.10.0)

ERROR: No matching distribution found for pymc3==3.11.0

(base) AST-NC211577:Retrievals_Ji_Information_TOI_270c wang.12220$

On Fri, Mar 26, 2021 at 12:30 PM Rodrigo Luger @.***> wrote:

Try

python -m pip install pymc3==3.11.0

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rodluger/starry/issues/275#issuecomment-808355470, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADBPRTXDLKKG5VQJQPVB2VDTFSZEBANCNFSM4ZPM7WIA .

rodluger commented 3 years ago

Ugh. I think it's best to try a clean install of a lot of these things:

python -m pip uninstall pymc3
python -m pip uninstall theano
python -m pip uninstall theano-pymc
python -m pip uninstall starry

Make sure you can't import any of those packages to ensure they're fully uninstalled. Then

python -m pip install arviz==0.11.1
python -m pip install pymc3==3.9.3
python -m pip install starry

If that fails, I would try creating a fresh conda environment and trying to run things in there.

conda create -n starry python=3.6
conda activate starry
python -m pip install arviz==0.11.1
python -m pip install pymc3==3.9.3
python -m pip install starry
wj198414 commented 3 years ago

I did the above and it worked. No need for the new conda environment.

Many thanks for your help!

Ji

On Fri, Mar 26, 2021 at 2:11 PM Rodrigo Luger @.***> wrote:

Ugh. I think it's best to try a clean install of a lot of these things:

python -m pip uninstall pymc3 python -m pip uninstall theano python -m pip uninstall theano-pymc python -m pip uninstall starry

Make sure you can't import any of those packages to ensure they're fully uninstalled. Then

python -m pip install arviz==0.11.1 python -m pip install pymc3==3.9.3 python -m pip install starry

If that fails, I would try creating a fresh conda environment https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html and trying to run things in there.

conda create -n starry python=3.6 conda activate starry python -m pip install arviz==0.11.1 python -m pip install pymc3==3.9.3 python -m pip install starry

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rodluger/starry/issues/275#issuecomment-808421022, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADBPRTR63EKO5G446XXQLTLTFTE4XANCNFSM4ZPM7WIA .

rodluger commented 3 years ago

Great, let us know if you run into anything else.

wj198414 commented 3 years ago

Thank you so much!

On Tue, Mar 30, 2021 at 2:26 PM Rodrigo Luger @.***> wrote:

Closed #275 https://github.com/rodluger/starry/issues/275.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rodluger/starry/issues/275#event-4529572031, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADBPRTRYNBTBPD5ECVR47N3TGIJT7ANCNFSM4ZPM7WIA .