I had this problem running numpy on an ubuntu server. I got all of the following errors, depending on whether I tried to import numpy in a shell or running my django app:
- PyCapsule_Import could not import module “datetime” from
- numpy.core._multiarray_umath import ( OpenBLAS blas_thread_init:
- pthread_create failed for thread 25 of 32: Resource temporarily unavailable
I’m posting this answer since it drove me crazy. What helped for me was to add:
import os
os.environ['OPENBLAS_NUM_THREADS'] = '1'
before
import numpy as np
I guess the server had some limit for the amount of threads it allows(?). Hope it helps someone!