prophet icon indicating copy to clipboard operation
prophet copied to clipboard

Error importing Prophet in AWS instances

Open maxmatical opened this issue 7 years ago • 2 comments

I'm currently using an AWS EC2 instance (DLAMI). When I run from fbprophet import Prophet, I get the following error


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~/anaconda3/envs/amazonei_tensorflow_p36/lib/python3.6/importlib/_bootstrap.py in _find_spec(name, path, target)

AttributeError: 'PyxImporter' object has no attribute 'find_spec'

During handling of the above exception, another exception occurred:

RuntimeError                              Traceback (most recent call last)
<ipython-input-11-f503e9c6cf11> in <module>()
----> 1 from fbprophet import Prophet

~/anaconda3/envs/amazonei_tensorflow_p36/lib/python3.6/site-packages/fbprophet/__init__.py in <module>()
      6 # of patent rights can be found in the PATENTS file in the same directory.
      7 
----> 8 from fbprophet.forecaster import Prophet
      9 
     10 __version__ = '0.5'

~/anaconda3/envs/amazonei_tensorflow_p36/lib/python3.6/site-packages/fbprophet/forecaster.py in <module>()
     20 from fbprophet.make_holidays import get_holiday_names, make_holidays_df
     21 from fbprophet.models import prophet_stan_model
---> 22 from fbprophet.plot import (plot, plot_components, plot_forecast_component,
     23                             plot_seasonality, plot_weekly, plot_yearly,
     24                             seasonality_plot_df)

~/anaconda3/envs/amazonei_tensorflow_p36/lib/python3.6/site-packages/fbprophet/plot.py in <module>()
     35 
     36 try:
---> 37     import plotly.graph_objs as go
     38 except ImportError:
     39     logger.error('Importing plotly failed. Interactive plots will not work.')

~/anaconda3/envs/amazonei_tensorflow_p36/lib/python3.6/site-packages/plotly/__init__.py in <module>()
     28 from __future__ import absolute_import
     29 
---> 30 from plotly import (
     31     graph_objs,
     32     tools,

~/anaconda3/envs/amazonei_tensorflow_p36/lib/python3.6/site-packages/plotly/io/__init__.py in <module>()
      8 from ._html import to_html, write_html
      9 
---> 10 from ._renderers import renderers, show
     11 
     12 from . import base_renderers

~/anaconda3/envs/amazonei_tensorflow_p36/lib/python3.6/site-packages/plotly/io/_renderers.py in <module>()
    454     if not default_renderer:
    455         try:
--> 456             import google.colab
    457 
    458             default_renderer = "colab"

~/anaconda3/envs/amazonei_tensorflow_p36/lib/python3.6/importlib/_bootstrap.py in _find_and_load(name, import_)

~/anaconda3/envs/amazonei_tensorflow_p36/lib/python3.6/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

~/anaconda3/envs/amazonei_tensorflow_p36/lib/python3.6/importlib/_bootstrap.py in _find_spec(name, path, target)

~/anaconda3/envs/amazonei_tensorflow_p36/lib/python3.6/importlib/_bootstrap.py in _find_spec_legacy(finder, name, path)

~/anaconda3/envs/amazonei_tensorflow_p36/lib/python3.6/site-packages/pyximport/pyximport.py in find_module(self, fullname, package_path)
    251             return None  # only here when reload()
    252         try:
--> 253             fp, pathname, (ext,mode,ty) = imp.find_module(fullname,package_path)
    254             if fp: fp.close()  # Python should offer a Default-Loader to avoid this double find/open!
    255             if pathname and ty == imp.PKG_DIRECTORY:

~/anaconda3/envs/amazonei_tensorflow_p36/lib/python3.6/imp.py in find_module(name, path)
    269         # Backwards-compatibility
    270         raise RuntimeError("'path' must be None or a list, "
--> 271                            "not {}".format(type(path)))
    272 
    273     if path is None:

RuntimeError: 'path' must be None or a list, not <class '_frozen_importlib_external._NamespacePath'>

I've tried installing both using pip and conda, but I get the same result

maxmatical avatar Jul 31 '19 16:07 maxmatical

I had the same issue. Plotly just had a new release. I downgraded to plotly==3.10.0 and this resolved it.

kwu2u avatar Jul 31 '19 19:07 kwu2u

To install fbprophet on AWS Sagemaker Jupyter Notebook: !conda install -c plotly plotly==3.10.0 --yes !conda install -c conda-forge fbprophet --yes from fbprophet import Prophet Prophet()

amintapan avatar Aug 29 '19 13:08 amintapan