Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plotly in Jupyter issue

I installed plotly.py to work some plots using Jupyter but I cannot import it.

! pip install plotly --upgrade
Requirement already up-to-date: plotly in c:\python34\lib\site-packages
Requirement already up-to-date: requests in c:\python34\lib\site-packages (from plotly)
Requirement already up-to-date: six in c:\python34\lib\site-packages (from plotly)
Requirement already up-to-date: pytz in c:\python34\lib\site-packages (from plotly)
Cleaning up...

and then

  import plotly
  ---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-6-c27a4132ad2e> in <module>()
----> 1 import plotly

  ImportError: No module named 'plotly'

I'm running Python 3.4.1, so as Jupyter, and the thing that I cannot get is that plotly works just fine when I'm running Python from the command line. Any suggestions? (I really don't want to clean install Python)

like image 666
psaltistha Avatar asked Apr 30 '16 20:04

psaltistha


People also ask

Why is my plotly not working?

If you are encountering problems using plotly with Dash please first ensure that you have upgraded dash to the latest version, which will automatically upgrade dash-core-components to the latest version, ensuring that Dash is using an up-to-date version of the Plotly. js rendering engine for plotly .

Can plotly be used in Jupyter notebook?

You can publish Jupyter Notebooks on Plotly. Simply visit plot.ly and select the + Create button in the upper right hand corner. Select Notebook and upload your Jupyter notebook (. ipynb) file!

Is plotly deprecated?

Solution: ImportError: The plotly. plotly module is deprecated, | Data Science and Machine Learning | Kaggle.

How do I know if plotly is installed?

The easiest way to do so is by using pip, which is a package manager for Python. What is this? If plotly is displayed with a version number, this means that it was successfully installed.


2 Answers

Running following on command prompt solved my issue.

conda install -c https://conda.anaconda.org/plotly plotly

It is likely that the plotly installed via pip install is somehow not detected by Jupter.

like image 190
Satish Avatar answered Oct 14 '22 16:10

Satish


In the jupyter notebook, running the correct kernel you want the package to be installed, run

import sys
!conda install --yes --prefix {sys.prefix} plotly

This installs plotly within the correct kernel.

like image 43
Finlay MacLean Avatar answered Oct 14 '22 17:10

Finlay MacLean