D
D
Danil Samodurov2020-06-24 21:34:12
Python
Danil Samodurov, 2020-06-24 21:34:12

Why doesn't the plotly library work?

I do not know for what reason, but the plotly library does not work for me after installing it. I take the instruction from the off site: https://plotly.com/python/getting-started/ . I install via pip: pip install plotly==4.8.1
The installation is successful, but when you enter an example from the same site in PyCharm

import plotly.graph_objects as go
fig = go.Figure(data=go.Bar(y=[2, 3, 1]))
fig.write_html('first_figure.html', auto_open=True)

the first line is underlined. When running the following error: ModuleNotFoundError: No module named 'plotly.graph_objects'; 'plotly' is not a package.
ploly appears in the list of installed libraries. Why doesn't the code work?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2020-06-25
@samodurOFF

project/file also named plotly?
comment out the import line and write below it again - something with a charm

K
Kapsamun Artem, 2021-11-18
@Art5

import plotly.graph_objects as go
not correct CORRECT
from plotly import graph_objects as go

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question