New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Import sktime.registry.all_estimators : Weird Stdout of Print Statements #4692
Comments
Well, that is indeed curious what happens with the I can reproduce it on current main. If the argument Thanks for reporting, @jokikim! |
The bug is localized in |
Found & fixed: sktime/skbase#193 |
Regarding your Could you try this to see whether the bug is with from importlib import import_module
import_module("numba") |
Yes, it was a System: Python dependencies: |
Thanks! Probably we should add |
This fixes the faulty `suppress_import_stdout` in `all_objects`. Instead of always restoring the `stdout` after suppression to its initial state, it would instead set it to the terminal, no matter where it previously was (e.g., a jupyter notebook). Further, it would also not be reset if an exception was encountered, which is now also handled. This fixes the error in sktime/sktime#4692 by manual testing, although I'm not sure how one would test for this in CI.
fixed via the fix sktime/skbase#192 in |
Describe the bug
In Jupyter, whenever I run the following import - "from sktime.registry import all_estimators" - and then call the
all_estimators
function, I noticed that subsequentprint
statements start to output in weird places. It prints in the terminal and also within the the cell where I called theall_estimators
function, but not in the actual cell with theprint
statement.To Reproduce
Notice the stdout of the print statement.
Expected behavior
In Jupyter, I expect the output of the PRINT statement to be in the same cell.
Additional context
Versions
I'm actually receiving an error when I run show_versions()
SystemError Traceback (most recent call last)
Cell In[2], line 1
----> 1 show_versions()
File ~/opt/anaconda3/lib/python3.9/site-packages/sktime/utils/_maint/_show_versions.py:111, in show_versions()
96 """Print python version, OS version, sktime version, selected dependency versions.
97
98 Pretty prints:
(...)
108 Selected dependencies are as in the DEFAULT_DEPS_TO_SHOW variable
109 """
110 sys_info = _get_sys_info()
--> 111 deps_info = _get_deps_info(deps=DEFAULT_DEPS_TO_SHOW)
113 print("\nSystem:") # noqa: T001, T201
114 for k, stat in sys_info.items():
File ~/opt/anaconda3/lib/python3.9/site-packages/sktime/utils/_maint/_show_versions.py:86, in _get_deps_info(deps)
84 mod = sys.modules[modname]
85 else:
---> 86 mod = importlib.import_module(modname)
87 ver = get_version(mod)
88 deps_info[modname] = ver
File ~/opt/anaconda3/lib/python3.9/importlib/init.py:127, in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
File :1030, in _gcd_import(name, package, level)
File :1007, in find_and_load(name, import)
File :986, in find_and_load_unlocked(name, import)
File :680, in _load_unlocked(spec)
File :850, in exec_module(self, module)
File :228, in _call_with_frames_removed(f, *args, **kwds)
File ~/opt/anaconda3/lib/python3.9/site-packages/numba/init.py:42
38 from numba.core.decorators import (cfunc, generated_jit, jit, njit, stencil,
39 jit_module)
41 # Re-export vectorize decorators and the thread layer querying function
---> 42 from numba.np.ufunc import (vectorize, guvectorize, threading_layer,
43 get_num_threads, set_num_threads)
45 # Re-export Numpy helpers
46 from numba.np.numpy_support import carray, farray, from_dtype
File ~/opt/anaconda3/lib/python3.9/site-packages/numba/np/ufunc/init.py:3
1 # -- coding: utf-8 --
----> 3 from numba.np.ufunc.decorators import Vectorize, GUVectorize, vectorize, guvectorize
4 from numba.np.ufunc._internal import PyUFunc_None, PyUFunc_Zero, PyUFunc_One
5 from numba.np.ufunc import _internal, array_exprs
File ~/opt/anaconda3/lib/python3.9/site-packages/numba/np/ufunc/decorators.py:3
1 import inspect
----> 3 from numba.np.ufunc import _internal
4 from numba.np.ufunc.parallel import ParallelUFuncBuilder, ParallelGUFuncBuilder
6 from numba.core.registry import DelayedRegistry
SystemError: initialization of _internal failed without raising an exception
The text was updated successfully, but these errors were encountered: