tqdm/tqdm · warning · TqdmDeprecationWarning
This function will be removed in tqdm==5.0.0 Please use `tqd
Error message
This function will be removed in tqdm==5.0.0 Please use `tqdm.notebook.tqdm` instead of `tqdm.tqdm_notebook`
What it means
tqdm.tnrange (top-level shortcut for notebook range bars) is deprecated with a TqdmDeprecationWarning directing you to tqdm.notebook.trange; it forwards to the notebook implementation but will be removed.
Source
Thrown at tqdm/__init__.py:25
TqdmDeprecationWarning, TqdmExperimentalWarning, TqdmKeyError, TqdmMonitorWarning,
TqdmTypeError, TqdmWarning, tqdm, trange)
from .version import __version__
__all__ = ['tqdm', 'tqdm_gui', 'trange', 'tgrange', 'tqdm_pandas',
'tqdm_notebook', 'tnrange', 'main', 'TMonitor',
'TqdmTypeError', 'TqdmKeyError',
'TqdmWarning', 'TqdmDeprecationWarning',
'TqdmExperimentalWarning',
'TqdmMonitorWarning', 'TqdmSynchronisationWarning',
'__version__']
def tqdm_notebook(*args, **kwargs): # pragma: no cover
"""See tqdm.notebook.tqdm for full documentation"""
from warnings import warn
from .notebook import tqdm as _tqdm_notebook
warn("This function will be removed in tqdm==5.0.0\n"
"Please use `tqdm.notebook.tqdm` instead of `tqdm.tqdm_notebook`",
TqdmDeprecationWarning, stacklevel=2)
return _tqdm_notebook(*args, **kwargs)
def tnrange(*args, **kwargs): # pragma: no cover
"""Shortcut for `tqdm.notebook.tqdm(range(*args), **kwargs)`."""
from warnings import warn
from .notebook import trange as _tnrange
warn("Please use `tqdm.notebook.trange` instead of `tqdm.tnrange`",
TqdmDeprecationWarning, stacklevel=2)
return _tnrange(*args, **kwargs)
View on GitHub (pinned to 96f2e60e45)
Solutions
- Use from tqdm.notebook import trange
- Or from tqdm.auto import trange
- Update shared snippets to the new import path
Example fix
# before from tqdm import tnrange for i in tnrange(10): # after from tqdm.notebook import trange for i in trange(10):
Defensive patterns
Strategy: fallback
Try / catch
try:
from tqdm import tnrange
except Exception:
from tqdm.notebook import trange as tnrange Prevention
- Prefer trange from tqdm.notebook or tqdm.auto
- Update legacy snippets copied from old notebooks
When it happens
Trigger: from tqdm import tnrange; tnrange(100) — top-level notebook range alias.
Common situations: Legacy notebook code using tnrange(...); old StackOverflow answers.
Related errors
- Can only wrap read/write methods
- Please use `tqdm.gui.tqdm(...)` instead of `tqdm(..., gui=Tr
- Please use `tqdm.notebook.trange` instead of `tqdm.tnrange`
- This function will be removed in tqdm==5.0.0 Please use `tqd
- This function will be removed in tqdm==5.0.0 Please use `tqd
AI-assisted analysis of tqdm/tqdm@96f2e60e45 (2026-08-28).
Data as JSON: /api/errors/fecc1b26e8bce755.
Report an issue: GitHub.