Sklearn/skimage cannot allocate memory in static TLS block

After running a sudo apt-get update/upgrade which updated my python3-dev/distutils etc. I can’t run my program where I import sklearn and skimage.

Traceback (most recent call last):
File “/home/user/.local/lib/python3.9/site-packages/skimage/init.py”, line 151, in
from ._shared import geometry
ImportError: /home/user/.local/lib/python3.9/site-packages/skimage/_shared/…/…/scikit_image.libs/libgomp-d22c30c5.so.1.0.0: cannot allocate memory in static TLS block

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/user/user/code/main.py”, line 7, in
from vision_worker import VisionWorker
File “/home/user/user/code/vision_worker.py”, line 8, in
from services import CameraService, ClassificationService, PointCloudService, ObjectRGBExtractionService, PredictionReviewService
File “/home/user/user/code/services/init.py”, line 6, in
from .classification_service import ClassificationService, Classifier
File “/home/user/user/code/services/classification_service.py”, line 11, in
from .embedded_feature_classifier import EmbeddedFeatureClassifier
File “/home/user/user/code/services/embedded_feature_classifier.py”, line 2, in
from .embedding_classifier import KnownDataset, ImageTransform, EmbeddingExtractor, IndexBuilder, IndexSearcher,
File “/home/user/user/code/services/embedding_classifier/init.py”, line 3, in
from .known_dataset import KnownDataset
File “/home/user/user/code/services/embedding_classifier/known_dataset.py”, line 1, in
from skimage import io
File “/home/user/.local/lib/python3.9/site-packages/skimage/init.py”, line 154, in
_raise_build_error(e)
File “/home/user/.local/lib/python3.9/site-packages/skimage/init.py”, line 131, in _raise_build_error
raise ImportError(“”"%s
ImportError: /home/user/.local/lib/python3.9/site-packages/skimage/_shared/…/…/scikit_image.libs/libgomp-d22c30c5.so.1.0.0: cannot allocate memory in static TLS block
It seems that scikit-image has not been built correctly.

Your install of scikit-image appears to be broken.
Try re-installing the package following the instructions at:
Installing scikit-image — skimage v0.19.2 docs

I have tried using:

export LD_PRELOAD=‘/home/user/.local/lib/python3.9/site-packages/scikit_image.libs/libgomp-d22c30c5.so.1.0.0’

but it does not make a difference.
My last resort will be to try and reorder the whole import order of all my modules, so that whatever is conflicting with Scikit can be imported afterwards.

I have tried running an empty python3 shell and importing sklearn and skimage without issues.

Hi,

Could you share which JetPack you used with us first?
Thanks.

Hi AastaLLL
I am on Xavier NX16 running Jetpack4.6

Edit:
I added:

import sklearn
import skimage

to the beginning of my script and it seems to have resolved the issue because scikit is the first thing that gets memory allocated.
I am still not sure how this started to appear after running a standard update/upgrade process.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.