-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify setup.py, make CmdStan the default backend #2088
Conversation
Hi @WardBrian! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Thanks for starting this Brian! Happy to help where I can. I've just merged in some changes to |
@tcuongd I've merged to try to maintain the changes in that PR, but alongside these repackaging changes. Have you tested that it is not necessary to have the toolchain installed on end-user's machines? I'm not sure how much is statically linked |
@tcuongd are you able to allow workflow runs for this PR so I can continue testing? |
Hmm are you specifically talking about the Rtools toolchain on Windows, or more generally for Linux and MacOS as well? In the
The second step would just use all the pre-packaged code, so I think if there's any issues these tests would fail. Would definitely appreciate a second look at this to confirm though. The MacOS and Linux packages seem to work fine testing on my machines, but I'm not sure whether the Windows package would work for someone who doesn't have Rtools installed. We'd want to call out that prerequisite pretty clearly, although I don't think it needs to be automated as a part of the installation. |
Yeah, specifically I wonder if someone on windows needs to have a Windows-compatible gcc/glibc. I can try to check once I get these wheels building |
@tcuongd - I’m not very familiar with the test suite, could you help figure out why this test is failing? https://github.com/facebook/prophet/runs/4768342262?check_suite_focus=true Otherwise we passed on Ubuntu. It looks like at least macOS failed because of a GitHub rate limit downloading cmdstan |
Yeah sure I can take a look. Really weird that it's failing though if we haven't changed any other code.
Ah yeah, I remember now, this is why I opted to download cmdstan via |
For me, the same test fails on |
@tcuongd I'm happy to continue working on this if you get a chance to debug that test |
@tcuongd or @WardBrian, have either of you had a chance to investigate the failing tests? |
I have not looked into them besides confirming they occur on |
For the Python 3.7 tests, the specific test test_diagnostics.test_cross_validation fails The failure is due to this line: params = self.stan_to_dict_numpy( which fails because the values in these variables are incorrectly parsed from the cmdstan CSV output. The cmdstan CSV output looks like it did not output completely correctly. It is missing a line-break after the parameter names and their values. The CSV has both the parameter names and values on the same line, which is not the format the cmdstanpy expects. Sample CSV attached below: Environment:
@WardBrian , since you are also a contributor to cmdstanpy, could you help with the CSV parsing? |
This is the kind of error we have seen when multiple cmdstan processes are trying to write to the same file at the same time, usually in threaded environments where the chain ID is not being explicitly set. Does that sound like a plausible explanation for this error @malmashhadani-88 ? |
@WardBrian , exactly as hypothesized. Could you please re-run all tests with this additional change? The test is running multiple models in parallel (cross-validating the time series), so all of the output files were being written to the same location. By adding |
Glad it is a simple fix. Could you be more specific about what I should change in the test? |
Hi, I tried to use these changes to train model using prophet but I get this error about missing |
Can you share the error? |
This is generated on macos. I was able to fix it inside a docker container with linux by manually installing
|
I will investigate this. In the mean time, you may be able to use |
@ShantanuKumar were you using the downloads from the link I posted above (https://github.com/WardBrian/prophet/actions/runs/1855227353)? |
@WardBrian I built the library locally from the commit without
|
Are you able to download the correct wheel from that GithubAction run and try that? |
I only see wheels for 3.8, but I am using python 3.9 |
If you download the zip file you will find wheels for many versions |
That worked! |
Can we please merge this to main? |
Hmm not sure why CI hasn't been running for the more recent pushes, it ran here: https://github.com/facebook/prophet/actions/runs/1853320459 |
@tcuongd I’ve just checked the “allow access by maintainers” box so you should be able to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing stuff!!!
- Great to see that
cmdstanpy.install_cmdstan()
is fast now and we don't need to usewget
; makes the wheel build workflow so much cleaner. - The refactor to
setup.py
looks all good to me, again much cleaner when we make use of thecmdstanpy
internals. - Thanks so much to everyone for figuring out tricky bugs like the interaction between multiprocessing and writing to csvs, and the Windows TBB stuff.
Happy to merge this PR but please keep in mind:
- I'm unable to release a new package version to PyPI, so for now Prophet on PyPI will remain at 1.0.1, with all of the pystan installation code, and will only support Python 3.6-3.8.
- The changes in this PR (removing pystan, support for Python 3.9+) will be accessible by cloning the Prophet repo and building the package manually from source (this is effectively the 'development version', which I've set to 1.1). I've added a section for how to do this in the README. (ps: @WardBrian could you have a read of these changes and let me know if it makes sense)
- If you don't want to build from source, but want to access the changes in this PR, please download the latest wheels here: https://github.com/WardBrian/prophet/actions/runs/1855227353 -- the downloaded wheel files can be installed using
pip
.
I understand this is confusing but 🤞 we can get a PyPI release soon (then everyone will actually be able to "just pip install prophet", heh).
(been following this PR with quite some interest) |
I think Ben (one of the package authors) has the release process set up on his machine, but I haven't been able to get in touch with him recently. |
@tcuongd the README changes look good to me. I'm actually not 100% sure if the final section ("Using Shame about the PyPi releases. This is part of why on CmdStanPy we do releases through and action |
I definitely want to have this workflow too! Will bring it up with the authors when I get the chance. |
Working wheels (cmdstanpy only): https://github.com/WardBrian/prophet/actions/runs/1855227353
This WIP PR would be the next step for #2041.
Currently it:
PROPHET_REPACKAGE_CMDSTAN=false
)setup.py
accordinglyCMDSTANPY
the default backendI'd like to test the current setup and wheel builds, hence this PR and the changes to the github actions files. I am still waiting to hear back from my company about the CLA, so this might sit as a draft until after the holidays.
Still yet to be done:
5. Refactor to remove PyStan entirely