โ02-11-2022 10:21 AM
I am using databricks runtime 9.1 LTS ML and I got this error when I tried to import Scikit Learn package. I got the following error message:
TypeError Traceback (most recent call last)
<command-181041> in <module>
1 # Scikit Learn ML Library
----> 2 from sklearn.metrics import *
3 from sklearn.preprocessing import LabelEncoder
4 from sklearn.preprocessing import MinMaxScaler, StandardScaler, PowerTransformer
5 from sklearn.model_selection import train_test_split, TimeSeriesSplit
/databricks/python_shell/dbruntime/PythonPackageImportsInstrumentation/__init__.py in import_patch(name, globals, locals, fromlist, level)
156 # Import the desired module. If you're seeing this while debugging a failed import,
157 # look at preceding stack frames for relevant error information.
--> 158 original_result = python_builtin_import(name, globals, locals, fromlist, level)
159
160 is_root_import = thread_local._nest_level == 1
/usr/lib/python3.8/importlib/_bootstrap.py in _find_and_load(name, import_)
/usr/lib/python3.8/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)
/usr/lib/python3.8/importlib/_bootstrap.py in _load_unlocked(spec)
/usr/lib/python3.8/importlib/_bootstrap.py in _load_backward_compatible(spec)
/databricks/python_shell/dbruntime/PostImportHook.py in load_module(self, fullname)
214 def load_module(self, fullname):
215 try:
--> 216 module = self.loader.load_module(fullname)
217 notify_module_loaded(module)
218 except (ImportError, AttributeError):
/databricks/python/lib/python3.8/site-packages/sklearn/__init__.py in <module>
62 else:
63 from . import __check_build
---> 64 from .base import clone
65 from .utils._show_versions import show_versions
66
/databricks/python_shell/dbruntime/PythonPackageImportsInstrumentation/__init__.py in import_patch(name, globals, locals, fromlist, level)
156 # Import the desired module. If you're seeing this while debugging a failed import,
157 # look at preceding stack frames for relevant error information.
--> 158 original_result = python_builtin_import(name, globals, locals, fromlist, level)
159
160 is_root_import = thread_local._nest_level == 1
.....
....
....
/databricks/python/lib/python3.8/site-packages/sklearn/externals/joblib/externals/cloudpickle/__init__.py in <module>
1 from __future__ import absolute_import
2
----> 3 from .cloudpickle import *
4
5 __version__ = '0.8.0'
/databricks/python_shell/dbruntime/PythonPackageImportsInstrumentation/__init__.py in import_patch(name, globals, locals, fromlist, level)
156 # Import the desired module. If you're seeing this while debugging a failed import,
157 # look at preceding stack frames for relevant error information.
--> 158 original_result = python_builtin_import(name, globals, locals, fromlist, level)
159
160 is_root_import = thread_local._nest_level == 1
/databricks/python/lib/python3.8/site-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py in <module>
150
151
--> 152 _cell_set_template_code = _make_cell_set_template_code()
153
154
/databricks/python/lib/python3.8/site-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py in _make_cell_set_template_code()
131 )
132 else:
--> 133 return types.CodeType(
134 co.co_argcount,
135 co.co_kwonlyargcount,
TypeError: an integer is required (got type bytes)
โ02-17-2022 05:58 AM
Ok, if this library is included in this DBR , can you please check https://docs.databricks.com/release-notes/runtime/9.1ml.html . If not. please check if you are installing this library from cluster with all dependencies . Thanks.
โ02-14-2022 06:19 AM
@Qian Yuโ I believe the error is coming while you are executing any particular code on notebook.Could you please check the python version?
โ02-14-2022 03:43 PM
@Atanu Sarkarโ I am using databricks runtime 9.1ML LTS and python version is 3.8.10
I am only just running import statement
from sklearn.metrics import *
from sklearn.preprocessing import LabelEncoder
โ02-17-2022 05:58 AM
Ok, if this library is included in this DBR , can you please check https://docs.databricks.com/release-notes/runtime/9.1ml.html . If not. please check if you are installing this library from cluster with all dependencies . Thanks.
Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโt want to miss the chance to attend and share knowledge.
If there isnโt a group near you, start one and help create a community that brings people together.
Request a New Group