I am using tqdm to display progress of iterations. However it doesn't work properly in my jupyter notebook environment.
I can do
from tqdm import tqdm
a = 0
for i in tqdm(range(10)):
a += i
print(a)
with output
This however has a problem with print statements in the loop (see here).
When I do
from tqdm.notebook import tqdm
a = 0
for i in tqdm(range(10)):
a += i
print(a)
I get
I.e. the iterations are executed but tqdm does not account for them.
Any idea how to fix this or what the problem might be?
The output of jupyter --version is
jupyter core : 4.7.1
jupyter-notebook : 6.2.0
qtconsole : not installed
ipython : 7.20.0
ipykernel : 5.1.0
jupyter client : 6.1.11
jupyter lab : not installed
nbconvert : 5.6.1
ipywidgets : 7.6.3
nbformat : 5.1.2
traitlets : 5.0.5
EDIT
The problem seems to be bound to MacOS (I am running 10.15.7), since I do not observe it on CentOS.
Besides that I tried I updated my conda environment
jupyter core : 4.7.1
jupyter-notebook : 6.2.0
qtconsole : 5.0.2
ipython : 7.20.0
ipykernel : 5.5.0
jupyter client : 6.1.11
jupyter lab : not installed
nbconvert : 6.0.7
ipywidgets : 7.6.3
nbformat : 5.1.2
traitlets : 5.0.5
on python 3.8.8. (I also tried on 3.7.10).
This issue discusses something similar and the problems seems to be related to ipywidgets.
I had the same issue in Jupyter Lab (3.0.9) and this worked for me:
jupyter labextension install #jupyter-widgets/jupyterlab-manager \
&& jupyter lab
Even though ipywidgets should install the labextension automatically, it was not listed in jupyter labextension list. When I install it manually, the progress bar works.
For classic notebooks, the ipywidgets docs mention this:
jupyter nbextension enable --py widgetsnbextension
Related
The only thing I did was just open the .py file. I tried reinstalling jupyterlab but it didn't help. Interestingly, I can still run the individual cells by pressing shift + Enter - only the button dissapeared, not the functionality. Python version is 3.9 and regarding jupyterlab:
IPython : 8.2.0
ipykernel : 6.12.1
ipywidgets : not installed
jupyter_client : 7.2.2
jupyter_core : 4.9.2
jupyter_server : 1.16.0
jupyterlab : 3.3.3
nbclient : 0.5.13
nbconvert : 6.4.5
nbformat : 5.3.0
notebook : 6.4.10
qtconsole : not installed
traitlets : 5.1.1
Edit: I installed ipywidgets and qtconsole, still the same problem.
I'm running into an issue with exporting my notebooks from Jupyter Lab. I work with 3D figures and want to export the entire notebook as HTML with images in the current state. I was able to do so in Jupyter Notebook with the %matplotlib notebook command. However, when using the export function in Jupyter Lab after calling %matplotlib widget, the output becomes something like:
Is there a workaround for this issue? Or a way to use %matplotlib notebook in Jupyter Lab?
Versions
python 3.7.9
ipympl version: 0.6.3
jupyter core : 4.7.1
jupyter-notebook : 6.2.0
qtconsole : not installed
ipython : 7.21.0
ipykernel : 5.5.0
jupyter client : 6.1.12
jupyter lab : 3.0.11
nbconvert : 6.0.7
ipywidgets : 7.6.3
nbformat : 5.1.2
traitlets : 5.0.5
I am using python 3.8 with jupyter notebook on a MacPro, OS is Big Sur; following are the details regarding the version;
jupyter core : 4.6.3
jupyter-notebook : 6.1.1
qtconsole : 4.7.5
ipython : 7.17.0
ipykernel : 5.3.4
jupyter client : 6.1.6
jupyter lab : 2.2.4
nbconvert : 5.6.1
ipywidgets : 7.5.1
nbformat : 5.0.7
traitlets : 4.3.3
Whenever I open a jupyter notebook file(.ipynb) then each cell has the output as well as the following message;
<IPython.core.display.Javascript object>
Interestingly, when I re-run the cell, the message vanish,s but if I close and reopen the file, the message appears again. For reference purpose, hers is the preamble for my notebook;
import nltk
nltk.download("wordnet", quiet=True)
nltk.download("words", quiet=True)
nltk.download("stopwords", quiet=True)
from nltk.corpus import stopwords
import warnings
warnings.filterwarnings("ignore")
Can I kindly get help, on how can the message be suppressed for ever? Advice is appreciated.
Try to reinstall your ipython package
Auto completion in Jupyter Notebook only works if I add %config Completer.use_jedi = False at the top of my file.
This seems like a very advanced thing for anyone new to Jupyter Notebooks to have to work out.
Why is it required, and is there a way to fix it that doesn't involve messing around with config files as described here:
How to config 'Completer.use_jedi' to 'False' in Juypter Notebook permanently
I'm on windows 10, running jupyter notebook from powershell.
jupyter --version gives me:
jupyter core : 4.7.0
jupyter-notebook : 6.2.0
qtconsole : 5.0.1
ipython : 7.19.0
ipykernel : 5.4.3
jupyter client : 6.1.11
jupyter lab : not installed
nbconvert : 6.0.7
ipywidgets : 7.6.3
nbformat : 5.1.2
traitlets : 5.0.5
I'm trying to install jupyter-matplotlib extension but can't make it work in a jupyterlab instance.
Once installed by following the steps here:
https://github.com/matplotlib/jupyter-matplotlib
I get the error when executing a simple example:
Error displaying widget: model not found
Here's the output of my $ conda list for relevant packages:
ipykernel 5.1.1
ipympl 0.2.1
ipython 7.6.1
ipython_genutils 0.2.0
ipywidgets 7.5.0
jupyter_client 5.3.1
jupyter_core 4.4.0
jupyterlab 1.0.2
jupyterlab_server 1.0.0
Solved!
Turned out ipywidget 7.5 breaks jupyter lab and it isaffecting other libraries too.
https://github.com/plotly/plotly.py/issues/1659
downgrading to 7 solved the issue for me (allthough 7 wrt 7.5 should be backward compatibile)!
Also be sure to match ipympl 0.2.1 with jupyter-matplotlib 0.3.0 labextension.
jupyter labextension install jupyter-matplotlib#0.3.0
First you need to install:
pip install ipywidgets
conda install -c conda-forge ipympl
Then check if the following is OK:
!jupyter labextension list
You should see something like this:
JupyterLab v3.0.14
/home/jovyan/.local/share/jupyter/labextensions
jupyter-leaflet v0.15.0 enabled OK
jupyterlab-plotly v5.1.0 enabled OK
#jupyter-widgets/jupyterlab-manager v3.0.0 enabled OK (python, jupyterlab_widgets)
The most important part is here:
Restart your jupyter notebook.