I'm working through the demo notebook Predict outdoor equipment purchase with IBM Watson Machine Learning. I copied the notebook into a project and started running cell by cell.
All was going well except when I got to the section 5.2: Sample visualization of data with Plotly package.
In this section, first, some libraries are installed:
!pip install plotly --user
!pip install cufflinks --user
And then ...
import sys
import pandas
import plotly.plotly as py
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import cufflinks as cf
import plotly.graph_objs as go
init_notebook_mode(connected=True)
sys.path.append("".join([os.environ["HOME"]]))
This resulted in:
ImportError: No module named talib
So I modified the pip commands and rerun:
!pip install plotly --user --upgrade
!pip install cufflinks --user --upgrade
When I rerun the plotting code, I get:
ImportErrorTraceback (most recent call last)
<ipython-input-4-6838ef923a0d> in <module>()
3 import plotly.plotly as py
4 from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
----> 5 import cufflinks as cf
6 import plotly.graph_objs as go
7 init_notebook_mode(connected=True)
/gpfs/fs01/user/s15a-8ea34840daaa3e-39ca506ba762/.local/lib/python2.7/site-packages/cufflinks/__init__.py in <module>()
9 from __future__ import absolute_import
10
---> 11 from . import date_tools
12 from . import utils
13 from . import datagen
ImportError: cannot import name date_tools
Update: I tried fixing the cufflinks library version:
Successfully installed cufflinks-0.8.2
ImportErrorTraceback (most recent call last)
<ipython-input-36-d76e85e800c3> in <module>()
5 import plotly.plotly as py
6 from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
----> 7 import cufflinks as cf
8 import plotly.graph_objs as go
9 init_notebook_mode(connected=True)
/gpfs/fs01/user/s15a-8ea34840daaa3e-39ca506ba762/.local/lib/python2.7/site-packages/cufflinks/__init__.py in <module>()
8 """
9
---> 10 from . import date_tools
11 from . import utils
12 from . import datagen
ImportError: cannot import name date_tools
The issue you ran into appears when different version of cufflinks library is used.
This should fix
!pip install cufflinks==0.8.2 --user