Tried to import 'plotly' but failed
See original GitHub issueExpected behavior
Plot of param importances of optimized study.
Environment
- Optuna version: 2.9.1
- Python version: 3.8.5
- OS: Windows 10
- Plotly: 5.3.1
Error messages, stack traces, or logs
ImportError: Tried to import 'plotly' but failed. Please make sure that the package is installed correctly to use this feature. Actual error: No module named 'plotly'.
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
~\Anaconda3\lib\site-packages\optuna\visualization\_plotly_imports.py in <module>
6 with try_import() as _imports: # NOQA
----> 7 import plotly # NOQA
8 from plotly import __version__ as plotly_version
ModuleNotFoundError: No module named 'plotly'
The above exception was the direct cause of the following exception:
ImportError Traceback (most recent call last)
<ipython-input-46-ec7b157c78f5> in <module>
----> 1 optuna.visualization.plot_param_importances(study)
~\Anaconda3\lib\site-packages\optuna\visualization\_param_importances.py in plot_param_importances(study, evaluator, params, target, target_name)
93 """
94
---> 95 _imports.check()
96 _check_plot_args(study, target, target_name)
97
~\Anaconda3\lib\site-packages\optuna\_imports.py in check(self)
84 if self._deferred is not None:
85 exc_value, message = self._deferred
---> 86 raise ImportError(message) from exc_value
87
88
ImportError: Tried to import 'plotly' but failed. Please make sure that the package is installed correctly to use this feature. Actual error: No module named 'plotly'.
Steps to reproduce
- Create objective, optimize study
- Run optuna.visualization.plot_param_importances(study)
Additional context (optional)
This issue here https://github.com/optuna/optuna/issues/1339 has been closed but others have continued reporting similar issues.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
ImportError: 'No module named plotly.plotly' in LinuxMint17.3
So Python was trying to import the module from the script file I was running. Doh! Renamed it and problem solved. Share.
Read more >Failure at the first hurdle - Python error on "import plotly"
Hi there,. I've just started trying to use Plotly (and I'm a bit of a Python novice) following the instructions here: ...
Read more >Troubleshooting in Python - Plotly
How to troubleshoot import and rendering problems in Plotly with Python. ... otherwise importing plotly can fail with mysterious error messages.
Read more >Installing Plotly (ModuleNotFoundError: No module named ...
Well I have some new information. When I run import plotly in an IPython window via VS Code I get the same result...
Read more >Module Not Found Error for plotly - Plotly Python
finally i found half of the answers . to resolve this issue you just need to install plotly packages in anaconda env. as...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
so I have been applying these fixes but didn’t work, turns out i needed to restart my system. This fixed my issue.
Bump!
Same problem here…