Jetson.inference + opencv - problem with python3


i wanted to import cv2 to my project when i use jetson.inference, jetson.utils and i have problem:

Traceback (most recent call last):
File “”, line 4, in
import cv2
File “/usr/local/lib/python2.7/dist-packages/cv2/”, line 96, in
File “/usr/local/lib/python2.7/dist-packages/cv2/”, line 86, in bootstrap
import cv2
ImportError: /usr/lib/aarch64-linux-gnu/ cannot allocate memory in static TLS block

Opencv 4.4.0
Python3 3.6.9

Hi @zvonikmartincz, I haven’t seen this specific issue before, but you may want to try these recommendations that I found from this post:

  • export LD_PRELOAD=/usr/lib/aarch64-linux-gnu/ before running your Python program
  • If that doesn’t work, try importing cv2 before jetson.inference or vice-versa

Not sure why you encounter this, as it doesn’t occur with the OpenCV that comes with JetPack, however here is a possible explanation:

1 Like