You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The instructions above apply to JupyterLab 3.x. **For JupyterLab 2 or earlier**, run the following commands to install the required JupyterLab extensions (note that this will require [`node`](https://nodejs.org/) to be installed):
To use `plotly` in [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/), install the `jupyterlab` and `ipywidgets` packages in the same environment as you installed `plotly`, using `pip`:
99
+
To use `plotly` in [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/), install the `jupyterlab` and `anywidget` packages in the same environment as you installed `plotly`, using `pip`:
100
100
101
101
```
102
-
$ pip install "jupyterlab>=3" "ipywidgets>=7.6"
102
+
$ pip install jupyterlab anywidget
103
103
```
104
104
105
105
or `conda`:
106
106
107
107
```
108
-
$ conda install "jupyterlab>=3" "ipywidgets>=7.6"
109
-
```
110
-
111
-
The `plotly` jupyterlab extension is included when you install `plotly` using `pip` or `conda`. When you run Jupyter Lab, ensure you are running it in the same environment that you installed `plotly` in so it has access to the `plotly` jupyterlab extension.
112
-
113
-
**JupyterLab 2 or earlier** does not support the prebuilt extensions installed using `pip` and `conda`. If you are using JupyterLab 2, run the following command to install the required JupyterLab extensions (note that this will require [`node`](https://nodejs.org/) to be installed):
<divstyle="font-size: 0.9em;"><divstyle="width: calc(100%-30px); box-shadow: none; border: thinsolidrgb(229, 229, 229);"><divstyle="padding: 5px;"><div><p><strong>Sign up for Dash Club</strong> → Free cheat sheets plus updates from Chris Parmer and Adam Schroeder delivered to your inbox every two months. Includes tips and tricks, community apps, and deep dives into the Dash architecture.
In order to use `plotly` in JupyterLab, you *must have the `jupyterlab-plotly` extension installed* as detailed in the [Getting Started guide](/python/getting-started). When you install `plotly`, this extension is automatically made available to any JupyterLab 3.x installation in the same Python environment.
75
-
76
-
To list your current extensions, run the following command in a terminal shell **from the same environment as JupyterLab is launched**:
77
-
78
-
```bash
79
-
# Check that jupyterlab-plotly is installed
80
-
$ jupyter labextension list
81
-
```
82
-
83
-
Please note that the *extension version matters*: the extension versions in the [Getting Started](/python/getting-started) guide match the version of `plotly` at the top of the guide and so they should be installed together. Note also that these extensions are meant to work with JupyterLab 1 or above but not 0.x.
84
-
85
-
If automatic installation of the extension is not working in your environment, or if you are using JupyterLab 1.x or 2.0, you may install it manually using the following command, which requires `node` to be installed.
If you have [installed additional python environments](https://ipython.readthedocs.io/en/stable/install/kernel_install.html) (or kernels) to use with JupyterLab, or if you are using a centrally hosted JupyterLab installation, you need to make sure that the extensions are installed in the python environment used to launch JupyterLab (the "server" environment). If you accidentally installed the extensions (and run the command above) in one of the additional python environments ("processing" environments), then it is possible for the command above to list the correct extensions but for them to not be available in the JupyterLab front-end you have loaded in your browser. To check if this is the problem, you can [look at the active extension list through your browser via the JupyterLab Extension Manager](https://jupyterlab.readthedocs.io/en/stable/user/extensions.html#using-the-extension-manager), which will always list the extensions in the "server" environment. To summarize: if you use JupyterLab with multiple python environments, the extensions must be installed in the "server" environment, and the plotly python library must be installed in each "processing" environment that you intend to use.
93
-
94
-
> Note that version 4.14.3 of `plotly` or earlier needed two extensions (`jupyterlab-plotly` and `plotlywidget`) to be installed manually running, and that `plotlywidget` requires `@jupyter-widgets/jupyterlab-manager` to be installed:
If you have the correct version(s) of the extension(s) installed and active in your active JupyterLab sessions and are still seeing problems, the issue may clear up if you rebuild JupyterLab. This shouldn't be required in principle but some users have resolved their issues this way. To rebuild JupyterLab, shut down JupyterLab and run the following command in a terminal shell **from the same environment as JupyterLab was launched**:
102
-
103
-
```bash
104
-
# rebuilding JupyterLab
105
-
$ jupyter lab build
106
-
```
107
-
108
-
To uninstall your Plotly extensions prior to reinstalling them, run the following commands in a terminal shell before reinstalling them by following the instructions in the [Getting Started guide](/python/getting-started):
If you run into "out of memory" problems while installing the extensions or building JupyterLab, try running these commands before running `jupyter labextension install`...
117
-
118
-
```bash
119
-
# Avoid "JavaScript heap out of memory" errors during extension installation
120
-
# (OS X/Linux)
121
-
export NODE_OPTIONS=--max-old-space-size=4096
122
-
# (Windows)
123
-
set NODE_OPTIONS=--max-old-space-size=4096
124
-
```
125
-
126
-
...and these commands afterwards.
127
-
128
-
```bash
129
-
# Unset NODE_OPTIONS environment variable
130
-
# (OS X/Linux)
131
-
unset NODE_OPTIONS
132
-
# (Windows)
133
-
set NODE_OPTIONS=
134
-
```
135
-
136
-
### Jupyter Classic Notebook Problems
137
-
138
-
The classic Jupyter Notebook (i.e. launched with `jupyter notebook`) sometimes suffers from a problem whereby if you close the window and reopen it, your plots render as blank spaces.
139
-
140
-
The easiest solution is to force the `notebook` renderer to reload by calling `fig.show("notebook")` instead of just `fig.show()`.
141
-
142
-
If this problem is recurrent, you may safely run the following code in a Notebook (not in JupyterLab!) at any time and it should restore your figures (for example, you may put it at the top of your notebook for easy access):
143
-
144
-
```python
145
-
import plotly.io as pio
146
-
pio.renderers.default='notebook'
147
-
```
148
-
149
-
As a last resort, you can "Restart & Clear Output" from the Kernel menu and rerun your notebook.
150
-
151
-
<!-- #endregion -->
152
71
153
72
### VSCode Notebook, Nteract and Streamlit Problems
0 commit comments