Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬Register for the Oct 27 webinar.

ModuleNotFoundError with iplot

Hi everyone,
Sorry in advance for my novice abilities with python and no experience with plotly. Here’s my code

cars = pd.read_csv(address)
cars.columns = [‘car_names’,‘mpg’,‘cyl’,‘disp’, ‘hp’, ‘drat’, ‘wt’, ‘qsec’, ‘vs’, ‘am’, ‘gear’, ‘carb’]

df = cars[[‘cyl’, ‘wt’,‘mpg’]]

layout = dict(title=‘Chart from Pandas DataFrame’, xaxis= dict(title=‘x-axis’), yaxis= dict(title=‘y-axis’))

df.iplot(filename=‘cf-simple-line-chart’, layout=layout)

And here is the error message I receive:


ModuleNotFoundError Traceback (most recent call last)
in
8 layout = dict(title=‘Chart from Pandas DataFrame’, xaxis= dict(title=‘x-axis’), yaxis= dict(title=‘y-axis’))
9
—> 10 df.iplot(filename=‘cf-simple-line-chart’, layout=layout)

C:\ProgramData\Anaconda3\lib\site-packages\cufflinks\plotlytools.py in _iplot(self, kind, data, layout, filename, sharing, title, xTitle, yTitle, zTitle, theme, colors, colorscale, fill, width, dash, mode, interpolation, symbol, size, barmode, sortbars, bargap, bargroupgap, bins, histnorm, histfunc, orientation, boxpoints, annotations, keys, bestfit, bestfit_colors, mean, mean_colors, categories, x, y, z, text, gridcolor, zerolinecolor, margin, labels, values, secondary_y, secondary_y_title, subplots, shape, error_x, error_y, error_type, locations, lon, lat, asFrame, asDates, asFigure, asImage, dimensions, asPlot, asUrl, online, **kwargs)
839 data=df.to_iplot(colors=colors,colorscale=colorscale,kind=kind,interpolation=interpolation,fill=fill,width=width,dash=dash,sortbars=sortbars,keys=keys,
840 bestfit=bestfit,bestfit_colors=bestfit_colors,mean=mean,mean_colors=mean_colors,asDates=asDates,mode=mode,symbol=symbol,size=size,
–> 841 text=text,**kwargs)
842 trace_kw=check_kwargs(kwargs,TRACE_KWARGS)
843 for trace in data:

C:\ProgramData\Anaconda3\lib\site-packages\cufflinks\plotlytools.py in _to_iplot(self, colors, colorscale, kind, mode, interpolation, symbol, size, fill, width, dash, sortbars, keys, bestfit, bestfit_colors, opacity, mean, mean_colors, asDates, asTimestamp, text, **kwargs)
159 lines_plotly=[Bar(lines[key]).to_plotly_json() for key in keys]
160 else:
–> 161 lines_plotly=[Scatter(lines[key]).to_plotly_json() for key in keys]
162 for trace in lines_plotly:
163 if isinstance(trace[‘name’],pd.Timestamp):

C:\ProgramData\Anaconda3\lib\site-packages\cufflinks\plotlytools.py in (.0)
159 lines_plotly=[Bar(lines[key]).to_plotly_json() for key in keys]
160 else:
–> 161 lines_plotly=[Scatter(lines[key]).to_plotly_json() for key in keys]
162 for trace in lines_plotly:
163 if isinstance(trace[‘name’],pd.Timestamp):

C:\ProgramData\Anaconda3\lib\site-packages\plotly\graph_objs_scatter.py in init(self, arg, cliponaxis, connectgaps, customdata, customdatasrc, dx, dy, error_x, error_y, fill, fillcolor, groupnorm, hoverinfo, hoverinfosrc, hoverlabel, hoveron, hovertemplate, hovertemplatesrc, hovertext, hovertextsrc, ids, idssrc, legendgroup, line, marker, meta, metasrc, mode, name, opacity, orientation, r, rsrc, selected, selectedpoints, showlegend, stackgaps, stackgroup, stream, t, text, textfont, textposition, textpositionsrc, textsrc, texttemplate, texttemplatesrc, tsrc, uid, uirevision, unselected, visible, x, x0, xaxis, xcalendar, xsrc, y, y0, yaxis, ycalendar, ysrc, **kwargs)

C:\ProgramData\Anaconda3\lib\site-packages\plotly\basedatatypes.py in setitem(self, prop, value)

C:\ProgramData\Anaconda3\lib\site-packages\plotly\basedatatypes.py in _get_validator(self, prop)

C:\ProgramData\Anaconda3\lib\site-packages\plotly\validator_cache.py in get_validator(parent_path, prop_name)

C:\ProgramData\Anaconda3\lib\site-packages_plotly_utils\importers.py in getattr(import_name)

C:\ProgramData\Anaconda3\lib\importlib_init_.py in import_module(name, package)
125 break
126 level += 1
–> 127 return _bootstrap._gcd_import(name[level:], package, level)
128
129

C:\ProgramData\Anaconda3\lib\importlib_bootstrap.py in _gcd_import(name, package, level)

C:\ProgramData\Anaconda3\lib\importlib_bootstrap.py in find_and_load(name, import)

C:\ProgramData\Anaconda3\lib\importlib_bootstrap.py in find_and_load_unlocked(name, import)

ModuleNotFoundError: No module named ‘plotly.validators.scatter._line’

I believe I installed plotly correctly using the chart_studio as I was able to get this to run:

a = np.linspace(start=0, stop=36, num=36)

np.random.seed(25)

b = np.random.uniform(low=0.0, high=1.0, size=36)

trace = go.Scatter(x=a, y=b)

data = [trace]

py.iplot(data, filename=‘basic-line-chart’)