Skip to content
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

Trouble using fbprophet with Spyder on mac #738

Closed
kyliem21 opened this issue Nov 14, 2018 · 2 comments
Closed

Trouble using fbprophet with Spyder on mac #738

kyliem21 opened this issue Nov 14, 2018 · 2 comments

Comments

@kyliem21
Copy link

Hi everyone,

I'm fairly new to Python, and I'm struggling to correctly implement fbprophet with the Anaconda Navigator. Pystan and gcc are installed. I've read numerous other threads, and I've tried the following approaches (including multiple iterations of installing and uninstalling pystan, fbprophet, cython):

pip install fbprophet – results in: "Failed building wheel for fbprophet"
conda install -c conda-forge fbprophet – seems to have properly executed

From the Anaconda Navigator, when I open Spyder and attempt to import fbprophet, I get the following error: "cannot import name 'IncludeCode'", which refers back to what I believe is line 32 in the Cython Compiler Module.Node.py script (error messages are included below.)

However, when I import fbprophet in a Jupyter notebook, the import is successful and I have no issues running a script that relies on fbprophet.

Has anyone run into this issue before, or does anyone have suggestions for a fix? Any guidance would be greatly appreciated!

Error:
File "/Users/kylie/anaconda/lib/python3.6/site-packages/Cython/Compiler/ModuleNode.py", line 32, in from .Code import UtilityCode, IncludeCode

ImportError: cannot import name 'IncludeCode'

@yuyang733
Copy link

I also encountered this problem. Have you found a solution?

@bletham
Copy link
Contributor

bletham commented Nov 21, 2018

The wheel failing to build might just be due to #401, which means that if you run pip install a second time it will work.

So just to be sure I have this right, import fbprophet works in Jupyter but not in Anaconda. Anaconda has a separate build environment from system Python, and I'm guessing Jupyter is running on system Python and not via Anaconda, right?

So it seems to me that things are working in system Python (the pip install was successful) but not working in Anaconda due to its C++ compiler not working.

Could you check if PyStan is working in Anaconda by running:

import pystan
model_code = 'parameters {real y;} model {y ~ normal(0,1);}'
model = pystan.StanModel(model_code=model_code)  # this will take a minute
y = model.sampling(n_jobs=1).extract()['y']
y.mean()  # should be close to 0

If that doesn't work (my expectation), then try reinstalling PyStan in Anaconda. Do

conda install gcc

and

conda install -c conda-forge pystan

and see if PyStan works then.

@bletham bletham closed this as completed Dec 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants