简体   繁体   中英

OSError Traceback (most recent call last) for PyCaret

Using PyCaret for the first time. Installed Anacoda using command line and then install PyCaret inside the Jupyter Notebook.

PyCaret installed is successful because this following code works:

from pycaret.datasets import get_data
jewellery = get_data('jewellery') 

But when using following code:

from pycaret.clustering import *

The following error comes:


-
OSError                                   Traceback (most recent call last)
/var/folders/2s/mwp2zlp50sb75l3zpcq67szw0000gp/T/ipykernel_16163/1576494110.py in <module>
----> 1 from pycaret.clustering import *
      2 exp_name = setup(data = jewellery)

~/anaconda3/lib/python3.9/site-packages/pycaret/clustering.py in <module>
     14 import ipywidgets as ipw
     15 from typing import List, Tuple, Any, Union, Optional, Dict
---> 16 import pycaret.internal.tabular
     17 
     18 from pycaret.internal.tabular import MLUsecase

~/anaconda3/lib/python3.9/site-packages/pycaret/internal/tabular.py in <module>
     46 import pycaret.containers.models.clustering
     47 import pycaret.containers.models.anomaly
---> 48 import pycaret.internal.preprocess
     49 import pandas as pd
     50 import numpy as np

~/anaconda3/lib/python3.9/site-packages/pycaret/internal/preprocess.py in <module>
     32 from sklearn.ensemble import RandomForestClassifier as rfc
     33 from sklearn.ensemble import RandomForestRegressor as rfr
---> 34 from lightgbm import LGBMClassifier as lgbmc
     35 from lightgbm import LGBMRegressor as lgbmr
     36 import sys

~/anaconda3/lib/python3.9/site-packages/lightgbm/__init__.py in <module>
      6 from pathlib import Path
      7 
----> 8 from .basic import Booster, Dataset, Sequence, register_logger
      9 from .callback import early_stopping, log_evaluation, print_evaluation, record_evaluation, reset_parameter
     10 from .engine import CVBooster, cv, train

~/anaconda3/lib/python3.9/site-packages/lightgbm/basic.py in <module>
    108 
    109 
--> 110 _LIB = _load_lib()
    111 
    112 

~/anaconda3/lib/python3.9/site-packages/lightgbm/basic.py in _load_lib()
     99     if len(lib_path) == 0:
    100         return None
--> 101     lib = ctypes.cdll.LoadLibrary(lib_path[0])
    102     lib.LGBM_GetLastError.restype = ctypes.c_char_p
    103     callback = ctypes.CFUNCTYPE(None, ctypes.c_char_p)

~/anaconda3/lib/python3.9/ctypes/__init__.py in LoadLibrary(self, name)
    458 
    459     def LoadLibrary(self, name):
--> 460         return self._dlltype(name)
    461 
    462     __class_getitem__ = classmethod(_types.GenericAlias)

~/anaconda3/lib/python3.9/ctypes/__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error, winmode)
    380 
    381         if handle is None:
--> 382             self._handle = _dlopen(self._name, mode)
    383         else:
    384             self._handle = handle

OSError: dlopen(/Users/sparsh/anaconda3/lib/python3.9/site-packages/lightgbm/lib_lightgbm.so, 0x0006): Library not loaded: /usr/local/opt/libomp/lib/libomp.dylib
  Referenced from: /Users/sparsh/anaconda3/lib/python3.9/site-packages/lightgbm/lib_lightgbm.so
  Reason: tried: '/usr/local/opt/libomp/lib/libomp.dylib' (no such file), '/usr/local/lib/libomp.dylib' (no such file), '/usr/lib/libomp.dylib' (no such file)

Any help would be greatly appreciated?

If your os is Mac.

brew install libomp 

solves the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM