首页 > 解决方案 > OpenBLAS blas_thread_init:pthread_create:资源暂时不可用

问题描述

我现在面临一个问题,无法在集群中运行任何程序。它给出了错误。

OpenBLAS blas_thread_init: pthread_create: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 64 current, 64 max
OpenBLAS blas_thread_init: pthread_create: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 64 current, 64 max
OpenBLAS blas_thread_init: pthread_create: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 64 current, 64 max
OpenBLAS blas_thread_init: pthread_create: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 64 current, 64 max
Traceback (most recent call last):
  File "hello-world.py", line 1, in <module>
    from keras.models import Sequential
  File "/home/amalli2s/anaconda3/lib/python3.6/site-packages/keras/__init__.py", line 3, in <module>
    from . import utils
  File "/home/amalli2s/anaconda3/lib/python3.6/site-packages/keras/utils/__init__.py", line 2, in <module>
    from . import np_utils
  File "/home/amalli2s/anaconda3/lib/python3.6/site-packages/keras/utils/np_utils.py", line 6, in <module>
    import numpy as np
  File "/home/amalli2s/.local/lib/python3.6/site-packages/numpy/__init__.py", line 142, in <module>
    from . import add_newdocs
  File "/home/amalli2s/.local/lib/python3.6/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/home/amalli2s/.local/lib/python3.6/site-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/home/amalli2s/.local/lib/python3.6/site-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/home/amalli2s/.local/lib/python3.6/site-packages/numpy/core/__init__.py", line 16, in <module>
    from . import multiarray
SystemError: initialization of multiarray raised unreported exception

这个问题,我假设与这个相同Python 的多个实例同时运行限制为 35

所以根据我设置时的解决方案 export OPENBLAS_NUM_THREADS=1

然后我最终得到以下错误:

terminate called after throwing an instance of 'std::system_error'
  what():  Resource temporarily unavailable
Aborted

是否有其他人面临同样的问题或对如何解决这个问题有想法?谢谢你。

编辑:好的,这似乎是因为管理员试图实施的一些配置限制。现在它又可以工作了。

标签: python-3.xkerasopenblas

解决方案


我在 ubuntu 服务器上运行 numpy 时遇到了这个问题。我收到以下所有错误,具体取决于我是尝试在 shell 中导入 numpy 还是运行我的 django 应用程序:

  • PyCapsule_Import 无法从
  • numpy.core._multiarray_umath 导入(OpenBLAS blas_thread_init:
  • 线程 25 的 pthread_create 失败(共 32 个):资源暂时不可用

我发布这个答案,因为它让我发疯。对我有帮助的是添加:

import os
os.environ['OPENBLAS_NUM_THREADS'] = '1'

import numpy as np

我猜服务器对它允许的线程数量有一些限制(?)。希望它可以帮助某人!


推荐阅读