Jetson.inference + opencv - problem with python3

Hello,

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 “t6.py”, line 4, in
import cv2
File “/usr/local/lib/python2.7/dist-packages/cv2/init.py”, line 96, in
bootstrap()
File “/usr/local/lib/python2.7/dist-packages/cv2/init.py”, line 86, in bootstrap
import cv2
ImportError: /usr/lib/aarch64-linux-gnu/libgomp.so.1: 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/libgomp.so.1 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: https://github.com/pytorch/pytorch/issues/2575#issuecomment-523653380

1 Like