adrn / thejoker

A custom Monte Carlo sampler for the (gravitational) two-body problem
MIT License
30 stars 8 forks source link

Error loading TheJoker #111

Closed zhexingli closed 3 years ago

zhexingli commented 3 years ago

What python version does TheJoker supports? I'm running on python 3.8.8 and calling TheJoker (calling pymc3 specifically) resulted in error messages (see attachment). At first glance it looks like missing Theano package. Then after downloading Theano and rerun the script calling TheJoker, it returned extremely long but essentially repeated error messages saying "[autoreload of theano.tensor.extra_ops failed:"

May I ask what's causing the problem?

Screen Shot 2021-03-09 at 5 48 42 PM
adrn commented 3 years ago

Hi @zhexingli! Theano is in something of a transition period right now (the pymc3 developers took over development, renamed it but kept the name theano, then recently renamed it again to "aesara"). Could you tell me the output of:

import pymc3
print(pymc3.__version__)
import theano
print(theano.__version__)
print(theano.__file__)
zhexingli commented 3 years ago

Ah I didn't know the complication. Sorry for the delay in reply. But here's the output of the two commands for theano: 1.0.11 /Users/zhexingli/opt/anaconda3/lib/python3.6/site-packages/theano/__init__.py

It appears there's trouble importing pymc3 again, and this time it returned this error:

Screen Shot 2021-03-15 at 2 45 27 PM

Then I checked if I have arviz on my machine, and I do, and the version I have for arviz is 0.11.2.

adrn commented 3 years ago

Hi @zhexingli - apologies for the delay. This looks to me like a version incompatibility, somewhere in the combination of arviz, pymc3, and python (surprisingly, some packages may have already dropped python 3.6 support?).

It looks like you are using anaconda: maybe try creating a new anaconda environment to test out whether a fresh install would help? Something like:

conda create -n thejoker python
conda activate thejoker
pip install numpy pymc3 cython matplotlib
pip install git+https://github.com/adrn/thejoker

(the last line there installs the most recent development version of thejoker)

zhexingli commented 3 years ago

Hi Adrain, TheJoker was indeed installed in a new environment and that environment was created specifically for TheJoker. Initially I tried 3.6, doesn't work because some dropped support as you mentioned. Then I tried python 3.9, 3.8, and 3.7, all report errors when trying to run it. TheJoker I'm having now is the latest version (unless there's update in the past few weeks). It's probably the incombatibility among other packages as you suggested. What versions of the pymc3, python, theano, arviz etc are compatible with TheJoker?

adrn commented 3 years ago

Hm, strange - I can't reproduce the error here! If I make a new conda environment as I posted in my last comment, but pinning python=3.8 because of a pytables incompatibility with python 3.9, i.e.,

conda create -n thejoker-test python=3.8
conda activate thejoker-test
pip install numpy pymc3 cython matplotlib
pip install git+https://github.com/adrn/thejoker

Here are exact package versions for some relevant packages that are installed:

aesara-theano-fallback==0.0.4
arviz==0.11.2
astropy==4.2
cython==0.29.22
exoplanet==0.4.5
h5py==3.2.1
numpy==1.20.2
pymc3==3.11.2
pymc3-ext==0.1.0
python==3.8.8
schwimmbad==0.3.2
theano-pymc==1.1.2
thejoker==1.2.dev84+g92d7e05
twobody==0.7

With this environment, I can do:

>>> import pymc3

and I don't get an error.

zhexingli commented 3 years ago

That's odd. Are you using Spyder in Anaconda (if so may I ask what version you're using)? Could it be Spyder's version issue?

adrn commented 3 years ago

Hm, no, I'm not using Spyder.

Can you try the environment creation steps I put in the last comment and share the output of conda list from the created environment?

zhexingli commented 3 years ago

Yep. I removed my previous environment and recreated one, and making sure all the package versions are the same as you provided earlier, also upgrade my spyder version to 4.1.5. Now no errors are returned and TheJoker is running properly! Thank you so much for helping me troubleshoot this!!!

adrn commented 3 years ago

Great - thanks so much for your patience on this and glad it worked out! 🎉

zhexingli commented 3 years ago

This might be a silly question... I'm trying to change the x-axis label of the plot. The default is 'BMJD' but I'd like to change it to 'JD'. According to the source code I did the following: t = Time(time, format='jd', scale='tcb') tj.plot_rv_curves(joker_samples, t_grid=t,rv_unit=u.m/u.s,data=data)

But it still shows 'BMJD' on the x-axis. Am I missing something here?

adrn commented 3 years ago

@zhexingli The easiest way would be to overwrite the xlabel:

t = Time(time, format='jd', scale='tcb')
fig = tj.plot_rv_curves(joker_samples, t_grid=t,rv_unit=u.m/u.s,data=data)
fig.axes[0].set_xlabel('BJD')
zhexingli commented 3 years ago

Thank you!

zhexingli commented 3 years ago

Hello, one quick question. Is the small 'omega' used by thejoker the argument of periastron for the star or the planet?

adrn commented 3 years ago

For the star