Jetson scikit learn Error: scikit_learn.libs/ cannot allocate memory in static TLS block


I am using YOLOP for my application.
I am using Jetson Xavier for my application.
Since there is no docker file, I created a custom dockerfile. Please find dockerfile attached. Docker build was successful. But when i run below command inside container as mentioned in the readme instruction for testing an image, i get below error and i am not able to figure out what is the issue and what is the solution.

command executed:
python3 tools/ --source images/inp --save-dir images/outp

Error Log:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/sklearn/__check_build/", line 44, in <module>
    from ._check_build import check_build  # noqa
ImportError: /usr/local/lib/python3.6/dist-packages/sklearn/__check_build/../../scikit_learn.libs/ cannot allocate memory in static TLS block

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "tools/", line 29, in <module>
    from lib.core.postprocess import morphological_process, connect_lane
  File "/yolop/lib/core/", line 6, in <module>
    from sklearn.cluster import DBSCAN
  File "/usr/local/lib/python3.6/dist-packages/sklearn/", line 81, in <module>
    from . import __check_build  # noqa: F401
  File "/usr/local/lib/python3.6/dist-packages/sklearn/__check_build/", line 46, in <module>
  File "/usr/local/lib/python3.6/dist-packages/sklearn/__check_build/", line 41, in raise_build_error
    %s""" % (e, local_dir, ''.join(dir_content).strip(), msg))
ImportError: /usr/local/lib/python3.6/dist-packages/sklearn/__check_build/../../scikit_learn.libs/ cannot allocate memory in static TLS block
Contents of /usr/local/lib/python3.6/dist-packages/sklearn/__check_build:
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 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.

yolop.Dockerfile (4.3 KB)



Since scikit-learn is pre-installed in the l4t-ml container.
Would you mind building the container with l4t-ml base instead?


Ok i Shall try l4t-ml:r32.5.0-py3 as base image rather than .

I am converting requirements.txt to docker.
As per above requirements.txt i need to have opencv-python>=4.1.2, but l4t-ml:r32.5.0-py3 contains OpenCV 4.1.1. Would you suggest me to overwrite this again inside Dockerfile?

My worries is i should not miss any thing from requirements.txt for my application using yolo panoptic.

My nvdia jetpack details are as follows:

Package: nvidia-jetpack
Version: 4.5-b129

Hello, Another question is that I am going to build my application using ros2 foxy and hence i used initially. I hope changing the base image will not create any problem. It is just my guess and i am trying to avoid any rework.

Hello, I am unable to pull the base image as suggested above.

Step 1/16 : FROM l4t-ml:r32.5.0-py3
pull access denied for l4t-ml, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

I am able to pull image with below command:

I will get back if it solves my original scikit-learn issue or not.


I was able to use scikit-learn without any error with below base image.


Thanks for your support.


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