Skip to content
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

error triggered by sklearn.cluster.kmeans #123

Closed
Freakwill opened this issue Apr 6, 2022 · 2 comments
Closed

error triggered by sklearn.cluster.kmeans #123

Freakwill opened this issue Apr 6, 2022 · 2 comments

Comments

@Freakwill
Copy link

Freakwill commented Apr 6, 2022

Method kmeans.predict() calls threadpoolctl and throws the following error. How do I fix it?

> 
>   File "/usr/local/lib/python3.8/site-packages/sklearn/cluster/_kmeans.py", line 1334, in predict
>     return _labels_inertia_threadpool_limit(
>   File "/usr/local/lib/python3.8/site-packages/sklearn/cluster/_kmeans.py", line 755, in _labels_inertia_threadpool_limit
>     with threadpool_limits(limits=1, user_api="blas"):
>   File "/usr/local/lib/python3.8/site-packages/sklearn/utils/fixes.py", line 314, in threadpool_limits
>     return threadpoolctl.threadpool_limits(limits=limits, user_api=user_api)
>   File "/usr/local/lib/python3.8/site-packages/threadpoolctl.py", line 171, in __init__
>     self._original_info = self._set_threadpool_limits()
>   File "/usr/local/lib/python3.8/site-packages/threadpoolctl.py", line 268, in _set_threadpool_limits
>     modules = _ThreadpoolInfo(prefixes=self._prefixes,
>   File "/usr/local/lib/python3.8/site-packages/threadpoolctl.py", line 340, in __init__
>     self._load_modules()
>   File "/usr/local/lib/python3.8/site-packages/threadpoolctl.py", line 371, in _load_modules
>     self._find_modules_with_dyld()
>   File "/usr/local/lib/python3.8/site-packages/threadpoolctl.py", line 428, in _find_modules_with_dyld
>     self._make_module_from_path(filepath)
>   File "/usr/local/lib/python3.8/site-packages/threadpoolctl.py", line 515, in _make_module_from_path
>     module = module_class(filepath, prefix, user_api, internal_api)
>   File "/usr/local/lib/python3.8/site-packages/threadpoolctl.py", line 606, in __init__
>     self.version = self.get_version()
>   File "/usr/local/lib/python3.8/site-packages/threadpoolctl.py", line 646, in get_version
>     config = get_config().split()
> AttributeError: 'NoneType' object has no attribute 'split'
@ogrisel
Copy link
Contributor

ogrisel commented Apr 7, 2022

Why did you close this? Can you please explain how to reproduce? In particular the versions number of the various libraries involved would help.

@dwwkelly
Copy link

dwwkelly commented Jul 1, 2022

I can reproduce this with the threadpoolctl example:

$ python3.9 -m threadpoolctl -i numpy scipy.linalg
Traceback (most recent call last):
  File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.9/site-packages/threadpoolctl.py", line 796, in <module>
    _main()
  File "/usr/local/lib/python3.9/site-packages/threadpoolctl.py", line 792, in _main
    print(json.dumps(threadpool_info(), indent=2))
  File "/usr/local/lib/python3.9/site-packages/threadpoolctl.py", line 124, in threadpool_info
    return _ThreadpoolInfo(user_api=_ALL_USER_APIS).todicts()
  File "/usr/local/lib/python3.9/site-packages/threadpoolctl.py", line 340, in __init__
    self._load_modules()
  File "/usr/local/lib/python3.9/site-packages/threadpoolctl.py", line 371, in _load_modules
    self._find_modules_with_dyld()
  File "/usr/local/lib/python3.9/site-packages/threadpoolctl.py", line 428, in _find_modules_with_dyld
    self._make_module_from_path(filepath)
  File "/usr/local/lib/python3.9/site-packages/threadpoolctl.py", line 515, in _make_module_from_path
    module = module_class(filepath, prefix, user_api, internal_api)
  File "/usr/local/lib/python3.9/site-packages/threadpoolctl.py", line 606, in __init__
    self.version = self.get_version()
  File "/usr/local/lib/python3.9/site-packages/threadpoolctl.py", line 646, in get_version
    config = get_config().split()
AttributeError: 'NoneType' object has no attribute 'split'

Threadpoolctl

$ pip3.9 show threadpoolctl
Name: threadpoolctl
Version: 2.1.0
Summary: threadpoolctl
Home-page: https://github.com/joblib/threadpoolctl
Author: Thomas Moreau
Author-email: [email protected]
License: UNKNOWN
Location: /usr/local/lib/python3.9/site-packages
Requires:
Required-by: scikit-learn

OpenBLAS

$ brew info openblas
openblas: stable 0.3.20 (bottled), HEAD [keg-only]
Optimized BLAS library
https://www.openblas.net/
/usr/local/Cellar/openblas/0.3.20 (23 files, 128.6MB)
  Poured from bottle on 2022-03-14 at 20:43:29

Homebrew

$ brew config
HOMEBREW_VERSION: 3.5.2-158-g38e1af8
ORIGIN: https://github.com/Homebrew/brew
HEAD: 38e1af857654b940f52df9b686f31b0b0cce2d17
Last commit: 6 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: a0240681a517411ea09bfce2bfbecccc27538374
Core tap last commit: 5 days ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.yJPIElD4gS/org.xquartz:0
HOMEBREW_EDITOR: vim
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 2.6.8 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: octa-core 64-bit icelake
Clang: 13.1.6 build 1316
Git: 2.32.1 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.79.1 => /usr/bin/curl
macOS: 12.3.1-x86_64
CLT: 13.4.0.0.1.1651278267
Xcode: 13.4.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants