Skip to content

ModuleNotFoundError: No module named 'IPython.extensions.deduperreload' #14808

Closed

Description

@qci-amos

One of my CI tests just failed with the exception:

------------------
%load_ext autoreload
%autoreload 2
------------------


---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
File /opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/IPython/core/extensions.py:62, in ExtensionManager.load_extension(self, module_str)
     61 try:
---> 62     return self._load_extension(module_str)
     63 except ModuleNotFoundError:

File /opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/IPython/core/extensions.py:77, in ExtensionManager._load_extension(self, module_str)
     76 if module_str not in sys.modules:
---> 77     mod = import_module(module_str)
     78 mod = sys.modules[module_str]

File /opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/importlib/__init__.py:126, in import_module(name, package)
    125         level += 1
--> 126 return _bootstrap._gcd_import(name[level:],package,level)

File <frozen importlib._bootstrap>:1204, in _gcd_import(name, package, level)

File <frozen importlib._bootstrap>:1176, in _find_and_load(name, import_)

File <frozen importlib._bootstrap>:1140, in _find_and_load_unlocked(name, import_)

ModuleNotFoundError: No module named 'autoreload'

During handling of the above exception, another exception occurred:

ModuleNotFoundError                       Traceback (most recent call last)
Cell In[3], line 1
----> 1 get_ipython().run_line_magic('load_ext','autoreload')
      2 get_ipython().run_line_magic('autoreload', '2')

File /opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/IPython/core/interactiveshell.py:2478, in InteractiveShell.run_line_magic(self, magic_name, line, _stack_depth)
   2476     kwargs['local_ns'] = self.get_local_scope(stack_depth)
   2477 with self.builtin_trap:
-> 2478     result = fn(*args,**kwargs)
   2480 # The code below prevents the output from being displayed
   2481 # when using magics with decorator @output_can_be_silenced
   2482 # when the last Python token in the expression is a ';'.
   2483 if getattr(fn, magic.MAGIC_OUTPUT_CAN_BE_SILENCED, False):

File /opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/IPython/core/magics/extension.py:33, in ExtensionMagics.load_ext(self, module_str)
     31 if not module_str:
     32     raise UsageError('Missing module name.')
---> 33 res = self.shell.extension_manager.load_extension(module_str)
     35 if res == 'already loaded':
     36     print("The %s extension is already loaded. To reload it, use:" % module_str)

File /opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/IPython/core/extensions.py:66, in ExtensionManager.load_extension(self, module_str)
     64 if module_str in BUILTINS_EXTS:
     65     BUILTINS_EXTS[module_str] = True
---> 66     return self._load_extension("IPython.extensions."+module_str)
     67 raise

File /opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/IPython/core/extensions.py:77, in ExtensionManager._load_extension(self, module_str)
     75 with self.shell.builtin_trap:
     76     if module_str not in sys.modules:
---> 77         mod = import_module(module_str)
     78     mod = sys.modules[module_str]
     79     if self._call_load_ipython_extension(mod):

File /opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/importlib/__init__.py:126, in import_module(name, package)
    124             break
    125         level += 1
--> 126 return _bootstrap._gcd_import(name[level:],package,level)

File <frozen importlib._bootstrap>:1204, in _gcd_import(name, package, level)

File <frozen importlib._bootstrap>:1176, in _find_and_load(name, import_)

File <frozen importlib._bootstrap>:1147, in _find_and_load_unlocked(name, import_)

File <frozen importlib._bootstrap>:[690](https://github.com/quantumcircuits/aqusim/actions/runs/13588915093/job/37990012628#step:6:691), in _load_unlocked(spec)

File <frozen importlib._bootstrap_external>:940, in exec_module(self, module)

File <frozen importlib._bootstrap>:241, in _call_with_frames_removed(f, *args, **kwds)

File /opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/IPython/extensions/autoreload.py:110
    108 from IPython.core import magic_arguments
    109 from IPython.core.magic import Magics, magics_class, line_magic
--> 110 from IPython.extensions.deduperreload.deduperreload import DeduperReloader
    112 __skip_doctest__ = True
    114 # -----------------------------------------------------------------------------
    115 #  Copyright (C) 2000 Thomas Heller
    116 #  Copyright (C) 2008 Pauli Virtanen <[email protected]>
   (...)    127 # Imports
    128 # -----------------------------------------------------------------------------

My test is using the newly released IPython 9.0.0 (released a few hours ago)

Activity

  1. qci-amos commented on Feb 28, 2025

    @qci-amos
    Author

    Does this folder need an __init__.py?
    https://github.com/ipython/ipython/tree/main/IPython/extensions/deduperreload

    A bit of context in case it matters: I'm using testbook in a pytest to run the notebook.

  2. linminhtoo commented on Feb 28, 2025

    @linminhtoo

    i am also facing this error.

    i am just trying to run

    %load_ext autoreload
    %autoreload 2

    in a jupyter notebook, and it fails with the same error.

        108 from IPython.core import magic_arguments
        109 from IPython.core.magic import Magics, magics_class, line_magic
    --> 110 from IPython.extensions.deduperreload.deduperreload import DeduperReloader
        112 __skip_doctest__ = True
        114 # -----------------------------------------------------------------------------
        115 #  Copyright (C) 2000 Thomas Heller
        116 #  Copyright (C) 2008 Pauli Virtanen <[email protected]>
       (...)    127 # Imports
        128 # -----------------------------------------------------------------------------
    
    ModuleNotFoundError: No module named 'IPython.extensions.deduperreload'
    

    temporarily downgrading to ipython==8.22.0 will fix it.

  3. niander commented on Feb 28, 2025

    @niander

    Same, downgrading should work

  4. bossdown123 commented on Feb 28, 2025

    @bossdown123

    I am having the same issues

    import IPython.extensions.autoreload
    
    
    ---------------------------------------------------------------------------
    ModuleNotFoundError                       Traceback (most recent call last)
    Cell In[5], line 1
    ----> 1 import IPython.extensions.autoreload
    File ~/.local/lib/python3.12/site-packages/IPython/extensions/autoreload.py:110
        108 from IPython.core import magic_arguments
        109 from IPython.core.magic import Magics, magics_class, line_magic
    --> 110 from IPython.extensions.deduperreload.deduperreload import DeduperReloader
        112 __skip_doctest__ = True
        114 # -----------------------------------------------------------------------------
        115 #  Copyright (C) 2000 Thomas Heller
        116 #  Copyright (C) 2008 Pauli Virtanen <[email protected]>
       (...)    127 # Imports
        128 # -----------------------------------------------------------------------------
    
    ModuleNotFoundError: No module named 'IPython.extensions.deduperreload'
  5. qci-amos commented on Feb 28, 2025

    @qci-amos
    Author

    Looks like this is being worked on here: #14807

  6. added this to the 9.0.1 milestone on Mar 3, 2025
  7. Carreau commented on Mar 3, 2025

    @Carreau
    Member

    Closed and released in 9.0.1

  8. Zeitsperre commented on Mar 3, 2025

    @Zeitsperre

    @Carreau Thanks for the fix! I'm wondering if you'll be yanking v9.0.0 on PyPI/conda as well?

  9. Carreau commented on Mar 3, 2025

    @Carreau
    Member

    If basic IPython is not critically broken, probably not. There are also maybe a couple of issues (#14815, #14810), that may requires a 9.0.2 and then I'll see if I yank or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions