第一次使用 PyCaret。使用命令行安装 Anacoda,然后在 Jupyter Notebook 中安装 PyCaret。
PyCaret 安装成功,因为以下代码有效:
from pycaret.datasets import get_data
jewellery = get_data('jewellery')
但是当使用以下代码时:
from pycaret.clustering import *
出现以下错误:
-
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)
任何帮助将不胜感激?