Open taylorbell57 opened 1 year ago
Hi @taylorbell57!
A few pointers that might help:
[pymc3]
or [theano]
when installing celerite2: python -m pip install "celerite2[pymc3]"
theano
, so import import celerite2.pymc3
failed but import celerite2.theano
worked.If installing from the main branch with python -m pip install ".[pymc3]"
, import celerite2.pymc3
should work because it is a subdirectory of celerite2
.
Regarding the Eigen error, I'm unable to reproduce (I remember having to install that library at some point in the past, so maybe that's why), but for me using the above instructions and and older version of Python (3.8) helped. With Python 3.11 pip was trying to rebuild numpy and that crashed...
EDIT: I just tried building from a clean clone and I do get the Eigen error, so I probably had done the steps you described above in the past because the directory was not empty on my older clone.
Hi @vandalt, nice to bump into you here!
[pymc3]
as you described (as you can see at the top of my first code snippet above)import celerite2.theano
to import celerite2.pymc3
, so that could explain a part of my issue but not all (see next point)pymc3
sublibrary is not imported anywhere in the package, so when doing pip install
pip doesn't know to copy that folder into the installed location (which will be something like ~/miniconda3/envs/YOUR_ENVIRONMENT/lib/python3.9/site-packages/celerite2/
). If you look at that installed folder, you'll see that the pymc3 folder is missing. If you end up importing celerite2
from the cloned repo folder instead of from your installed directory (e.g. check where celerite2.__file__
points), then it may be able to import celerite2.pymc3
which might be why the bug has gone unnoticed so far.Hi all — Sorry I missed this before! I'm mostly on parental leave still.
The issue is that the pymc3 sublibrary is not imported anywhere in the package, so when doing pip install pip doesn't know to copy that folder into the installed location (which will be something like
~/miniconda3/envs/YOUR_ENVIRONMENT/lib/python3.9/site-packages/celerite2/
). If you look at that installed folder, you'll see that the pymc3 folder is missing. If you end up importing celerite2 from the cloned repo folder instead of from your installed directory (e.g. check wherecelerite2.__file__
points), then it may be able to importcelerite2.pymc3
which might be why the bug has gone unnoticed so far.
This isn't true! setuptools_scm
automatically discovers submodules using git. If you look at the source of the distribution on pypi, you'll see that the appropriate submodules are included and they're not imported anywhere. This is by design - import of one of the submodules shouldn't fail because of a missing dependency for a different one!
The issue that you're seeing seems to be related to the renaming of the module. (Annoying, I know! Maintaining a package through the implosion of the PyMC dev community hasn't been not annoying either :/ Sorry!)
For the Eigen issue: You're getting that because Eigen is included as a git submodule so you'll need to clone recursively as described here: https://celerite2.readthedocs.io/en/latest/user/install/#from-source
@dfm thanks for chiming in! I'm interested to know that setuptools_scm
can do that — I ran into a similar issue with our Eureka! code and had to add a bunch of annoying try/except statements to allow partial installations. I'll definitely look more into that later! And thanks for pointing me to that installation point about Eigen!
I think some confusion had come from the theano->pymc3 change, but I noticed that there is still an issue even if I clone recursively and do pip install '.[pymc3]'
. In particular, I am able to do
> import celerite2.pymc3
> celerite2.pymc3.GaussianProcess(...)
But I cannot do
> import celerite2
> celerite2.pymc3.GaussianProcess(...)
Is that supposed to be the intended behaviour?
Great! Thanks for the update. Yes, this is the expected behavior... the idea being that submodules are only "enabled" when they are explicitly imported.
Gotcha, thanks for the clarification! You can close this issue now or with the merging of your PR - up to you
Hi folks, I just discovered this updated version of celerite and am excited to add
celerite2
'sPyMC3
GP into theEureka!
package (as I'm finding more and more cases where using a GP would be beneficial). We already have the originalcelerite
GP working (at least kinda) as well as thegeorge
GP for standard python minimizers and samplers (emcee
,scipy.optimize.minimize
,dynesty
), but we also have aPyMC3
version of our fitting code which allows one to usestarry
(ideal for eclipse mapping) and in generalPyMC3
's NUTS sampler has allowed for much faster fits (for me at least). I know thatjax
andPyMC4
offer advantages over the deprecatedPyMC3
andtheano
implementation, but over the past year I've already spent more than a fifty hours on gettingPyMC3
versions of all our astrophysical and systematic models implemented, I need to be able to usestarry
for the astrophysical model, and I'm looking for a fairly quick way to get GPs implemented. I was about to tryPyMC3
's built-in GP, but I saw on the oldexoplanet
docs thatexoplanet
had a faster GP implementation forPyMC3
sampling and then noticed that the code had been migrated here tocelerite2
.However, by default I am unable to access the
pymc3
submodule ofcelerite2
that is mentioned in the documentation. I've tried installing the version on main branch on GitHub (seeing that v0.2.1 doesn't have pymc3 code), but I get an error that'celerite2' has no attribute 'pymc3'
:Looking at the package on GitHub I see the pymc3 folder under python/celerite2/pymc3, but it seems it isn't being imported in the
__init__.py
file. Just addingfrom celerite2 import pymc3
to thepython/celerite2/__init__.py
file wasn't enough to solve the problem either, giving me the following error message when installing:I was able to find the referenced
Eigen
package at https://eigen.tuxfamily.org/, and I downloaded the latest version and put the entire contents of that package incelerite2
's (previously empty)c++/vendor/eigen
folder. With that package downloaded and my edit to the__init__.py
file, I'm now able to import and usecelerite2.pymc3
.I thought I'd document my troubleshooting process here to help anyone else trying to do the same thing or to help the devs figure out what changes need to be made to the documentation and/or package.