dlopen:无法使用静态 TLS 加载更多对象,sklearn 问题

问题描述 投票:0回答:0

我正在尝试在我的 jupyter 中导入 torch、transformers 和 sklearn。问题是当我首先导入 sklearn 时,在导入其他两个库时出现 dlopen 错误。我意识到我需要在 sklearn 之前导入火炬和变压器,但在这种情况下,我在导入 sklearn 时出错。错误如下:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
File ~/.local/lib/python3.11/site-packages/sklearn/__check_build/__init__.py:48
     47 try:
---> 48     from ._check_build import check_build  # noqa
     49 except ImportError as e:

ImportError: dlopen: cannot load any more object with static TLS

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
Cell In[1], line 4
      2 from torch import nn, optim
      3 from torch.utils.data import Dataset, DataLoader
----> 4 from sklearn.metrics import accuracy_score,f1_score
      5 from sklearn.model_selection import train_test_split
      6 from transformers import BertModel, BertTokenizer, AdamW, get_linear_schedule_with_warmup

File ~/.local/lib/python3.11/site-packages/sklearn/__init__.py:81
     70     # We are not importing the rest of scikit-learn during the build
     71     # process, as it may not be compiled yet
     72 else:
   (...)
     78     # later is linked to the OpenMP runtime to make it possible to introspect
     79     # it and importing it first would fail if the OpenMP dll cannot be found.
     80     from . import _distributor_init  # noqa: F401
---> 81     from . import __check_build  # noqa: F401
     82     from .base import clone
     83     from .utils._show_versions import show_versions

File ~/.local/lib/python3.11/site-packages/sklearn/__check_build/__init__.py:50
     48     from ._check_build import check_build  # noqa
     49 except ImportError as e:
---> 50     raise_build_error(e)

File ~/.local/lib/python3.11/site-packages/sklearn/__check_build/__init__.py:31, in raise_build_error(e)
     29         else:
     30             dir_content.append(filename + "\n")
---> 31     raise ImportError(
     32         """%s
     33 ___________________________________________________________________________
     34 Contents of %s:
     35 %s
     36 ___________________________________________________________________________
     37 It seems that scikit-learn has not been built correctly.
     38 
     39 If you have installed scikit-learn from source, please do not forget
     40 to build the package before using it: run `python setup.py install` or
     41 `make` in the source directory.
     42 %s"""
     43         % (e, local_dir, "".join(dir_content).strip(), msg)
     44     )

ImportError: dlopen: cannot load any more object with static TLS
___________________________________________________________________________
Contents of /home/Something/.local/lib/python3.11/site-packages/sklearn/__check_build:
__pycache__               __init__.py               _check_build.cpython-311-x86_64-linux-gnu.so
___________________________________________________________________________
It seems that scikit-learn has not been built correctly.

If you have installed scikit-learn from source, please do not forget
to build the package before using it: run `python setup.py install` or
`make` in the source directory.

If you have used an installer, please check that it is suited for your
Python version, your operating system and your platform.

此外,我通过 pip 安装 sklearn,我可以单独导入它,没有任何问题。 如果你帮我解决这个问题,我真的很感激。

正如我提到的,我试图改变我的进口订单,它帮助我使用手电筒和变压器,但对 sklearn 没有帮助。

python scikit-learn torch
© www.soinside.com 2019 - 2024. All rights reserved.