Hi Mo, On Mon, May 13, 2019 at 05:04:47AM -0700, Mo Zhou wrote: > Can someone look into fixing the following bug?
+1 > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=923937 > > The deprecation warning is very annoying and I've already > seen that useless noise in my terminal for hundreds of times. > > This not only affects sklearn but also all it's reverse > depencencies and any python script that imports sklearn. > While importing, rubbish will always be printed to stderr: > > In [2]: import sklearn > > /usr/lib/python3/dist-packages/sklearn/externals/joblib.py:1: > DeprecationWarning: the imp module is deprecated in favour of importlib; > see the module's documentation for alternative uses > import imp > > It'd be a pity that Buster users will be annoyed by this noise > forever if nobody fixed it. I've tried diff --git a/debian/patches/deb_use_system_joblib b/debian/patches/deb_use_system_joblib index 9da73e0c0..7583a8008 100644 --- a/debian/patches/deb_use_system_joblib +++ b/debian/patches/deb_use_system_joblib @@ -6,15 +6,15 @@ Subject: use system-wide joblib and do not attempt to install joblib/test --- /dev/null +++ b/sklearn/externals/joblib.py @@ -0,0 +16,16 @@ -+import imp ++import importlib +import sys + + +def import_non_local(name, custom_name=None): + custom_name = custom_name or name + -+ f, pathname, desc = imp.find_module(name, sys.path[1:]) -+ module = imp.load_module(custom_name, f, pathname, desc) ++ f, pathname, desc = importlib.machinery.PathFinder().find_spec(name, sys.path[1:]) ++ module = importlib.load_module(custom_name, f, pathname, desc) + if f is not None: + f.close() + but that's not the complete solution since it runs into ... python3.7 -m sphinx -j 4 -D mathjax_path=MathJax.js -b html -d _build/doctrees . _build/html/stable Running Sphinx v1.8.4 Configuration error: There is a programmable error in your configuration file: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/sphinx/config.py", line 368, in eval_config_file execfile_(filename, namespace) File "/usr/lib/python3/dist-packages/sphinx/util/pycompat.py", line 150, in execfile_ exec_(code, _globals) File "/build/scikit-learn-0.20.2+dfsg/doc/conf.py", line 18, in <module> from sklearn.externals.six import u File "/build/scikit-learn-0.20.2+dfsg/.pybuild/cpython3_3.7/build/sklearn/__init__.py", line 64, in <module> from .base import clone File "/build/scikit-learn-0.20.2+dfsg/.pybuild/cpython3_3.7/build/sklearn/base.py", line 13, in <module> from .utils.fixes import signature File "/build/scikit-learn-0.20.2+dfsg/.pybuild/cpython3_3.7/build/sklearn/utils/__init__.py", line 14, in <module> from . import _joblib File "/build/scikit-learn-0.20.2+dfsg/.pybuild/cpython3_3.7/build/sklearn/utils/_joblib.py", line 22, in <module> from ..externals import joblib File "/build/scikit-learn-0.20.2+dfsg/.pybuild/cpython3_3.7/build/sklearn/externals/joblib.py", line 16, in <module> locals().update(import_non_local('joblib').__dict__) File "/build/scikit-learn-0.20.2+dfsg/.pybuild/cpython3_3.7/build/sklearn/externals/joblib.py", line 8, in import_non_local f, pathname, desc = importlib.machinery.PathFinder().find_spec(name, sys.path[1:]) TypeError: cannot unpack non-iterable ModuleSpec object So anybody who is more familiar with importlib than just doing a web search and hoping to find the proper solution might have a better chance here. Kind regards Andreas. -- http://fam-tille.de

