-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
c1-quick 🕐Complexity lowComplexity lowp0-bug-critical ☢Exception rasingException rasingquestion/docs ‽Documentation clarification candidateDocumentation clarification candidatesubmodule-notebook 📓Much web such IDEMuch web such IDEto-fix ⌛In progressIn progress
Description
- I have marked all applicable categories:
- exception-raising bug
- visual output bug
- documentation request (i.e. "X is missing from the documentation." If instead I want to ask "how to use X?" I understand [StackOverflow#tqdm] is more appropriate)
- new feature request
- I have visited the [source website], and in particular
read the [known issues] - I have searched through the [issue tracker] for duplicates
- I have mentioned version numbers, operating system and
environment, where applicable:import tqdm, sys print(tqdm.__version__, sys.version, sys.platform)
4.51.0 3.8.5 (default, Sep 4 2020, 02:22:02)
[Clang 10.0.0 ] darwin
Example
Created a conda environment with:
$ conda create -yn tqdm_nowidgets python=3.8 tqdm ipython notebook
Using that environment, in a notebook:
from tqdm.auto import tqdm
from time import sleep
for i in tqdm(range(100)):
sleep(0.05)
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-3-542c7d78a2ff> in <module>
----> 1 for i in tqdm(range(100)):
2 sleep(0.05)
~/miniconda3/envs/tqdm_nowidgets/lib/python3.8/site-packages/tqdm/notebook.py in __init__(self, *args, **kwargs)
221 unit_scale = 1 if self.unit_scale is True else self.unit_scale or 1
222 total = self.total * unit_scale if self.total else self.total
--> 223 self.container = self.status_printer(
224 self.fp, total, self.desc, self.ncols)
225 self.sp = self.display
~/miniconda3/envs/tqdm_nowidgets/lib/python3.8/site-packages/tqdm/notebook.py in status_printer(_, total, desc, ncols)
94 # Prepare IPython progress bar
95 if IProgress is None: # #187 #451 #558 #872
---> 96 raise ImportError(
97 "IProgress not found. Please update jupyter and ipywidgets."
98 " See https://ipywidgets.readthedocs.io/en/stable"
ImportError: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
output of conda list
# packages in environment at /Users/isaac/miniconda3/envs/tqdm_nowidgets:
#
# Name Version Build Channel
appnope 0.1.0 py38_1001
argon2-cffi 20.1.0 py38haf1e3a3_1
async_generator 1.10 py_0
attrs 20.3.0 pyhd3eb1b0_0
backcall 0.2.0 py_0
bleach 3.2.1 py_0
ca-certificates 2020.10.14 0
certifi 2020.11.8 py38hecd8cb5_0
cffi 1.14.3 py38h2125817_2
decorator 4.4.2 py_0
defusedxml 0.6.0 py_0
entrypoints 0.3 py38_0
importlib-metadata 2.0.0 py_1
importlib_metadata 2.0.0 1
ipykernel 5.3.4 py38h5ca1d4c_0
ipython 7.19.0 py38h01d92e1_0
ipython_genutils 0.2.0 py38_0
jedi 0.17.2 py38_0
jinja2 2.11.2 py_0
jsonschema 3.2.0 py_2
jupyter_client 6.1.7 py_0
jupyter_core 4.7.0 py38hecd8cb5_0
jupyterlab_pygments 0.1.2 py_0
libcxx 10.0.0 1
libedit 3.1.20191231 h1de35cc_1
libffi 3.3 hb1e8313_2
libsodium 1.0.18 h1de35cc_0
markupsafe 1.1.1 py38h1de35cc_1
mistune 0.8.4 py38h1de35cc_1001
nbclient 0.5.1 py_0
nbconvert 6.0.7 py38_0
nbformat 5.0.8 py_0
ncurses 6.2 h0a44026_1
nest-asyncio 1.4.3 pyhd3eb1b0_0
notebook 6.1.4 py38_0
openssl 1.1.1h haf1e3a3_0
packaging 20.4 py_0
pandoc 2.11 h0dc7051_0
pandocfilters 1.4.3 py38hecd8cb5_1
parso 0.7.0 py_0
pexpect 4.8.0 pyhd3eb1b0_3
pickleshare 0.7.5 py38_1001
pip 20.2.4 py38hecd8cb5_0
prometheus_client 0.8.0 py_0
prompt-toolkit 3.0.8 py_0
ptyprocess 0.6.0 pyhd3eb1b0_2
pycparser 2.20 py_2
pygments 2.7.2 pyhd3eb1b0_0
pyparsing 2.4.7 py_0
pyrsistent 0.17.3 py38haf1e3a3_0
python 3.8.5 h26836e1_1
python-dateutil 2.8.1 py_0
pyzmq 19.0.2 py38hb1e8313_1
readline 8.0 h1de35cc_0
send2trash 1.5.0 py38_0
setuptools 50.3.1 py38hecd8cb5_1
six 1.15.0 py38hecd8cb5_0
sqlite 3.33.0 hffcf06c_0
terminado 0.9.1 py38_0
testpath 0.4.4 py_0
tk 8.6.10 hb0a8c7a_0
tornado 6.0.4 py38h1de35cc_1
tqdm 4.51.0 pyhd3eb1b0_0
traitlets 5.0.5 py_0
wcwidth 0.2.5 py_0
webencodings 0.5.1 py38_1
wheel 0.35.1 pyhd3eb1b0_0
xz 5.2.5 h1de35cc_0
zeromq 4.3.3 hb1e8313_3
zipp 3.4.0 pyhd3eb1b0_0
zlib 1.2.11 h1de35cc_3
Why this is a problem
I would like my package to have nice progress bars wherever it's used, and not error because of them. I don't want any notebook related as dependencies for my package. I think it makes sense for tqdm.auto
to make a choice which will not error.
This issue has come up a few times elsewhere
- https://stackoverflow.com/questions/53247985/tqdm-4-28-1-in-jupyter-notebook-intprogress-not-found-please-update-jupyter-an
- Use tqdm instead of tqdm.auto when downloading datasets scverse/scanpy#1130
What I think should happen
If ipywidgets
is not available, from tqdm.auto import tqdm
should not import a tqdm
class that relies on ipywidgets
. It could just import tqdm.tqdm
.
grst, parthagar, eternalphane, the21st, aazuspan and 5 more
Metadata
Metadata
Assignees
Labels
c1-quick 🕐Complexity lowComplexity lowp0-bug-critical ☢Exception rasingException rasingquestion/docs ‽Documentation clarification candidateDocumentation clarification candidatesubmodule-notebook 📓Much web such IDEMuch web such IDEto-fix ⌛In progressIn progress