models icon indicating copy to clipboard operation
models copied to clipboard

ImportError: dlopen: cannot load any more object with static TLS

Open mijung-kim opened this issue 10 years ago • 11 comments

Please let us know which model this issue is about (specify the top-level directory)

I add 'import cv2' to use some image preprocessing functions and got the following error.

Traceback (most recent call last): File "train_image_classifier.py", line 27, in from preprocessing import preprocessing_factory File "/home/mijung/BC/models/slim/preprocessing/preprocessing_factory.py", line 27, in from preprocessing import bc_preprocessing File "/home/mijung/BC/models/slim/preprocessing/bc_preprocessing.py", line 21, in import cv2 ImportError: dlopen: cannot load any more object with static TLS

Anyone knows how to solve this?

Thank you in advance!

mijung-kim avatar Oct 10 '16 02:10 mijung-kim

This might be a system configuration error rather than a bug in TensorFlow. The closest thing I can find is this thread on Stack Overflow. You might want to direct the question there for community support.

jart avatar Oct 14 '16 02:10 jart

my solution is put import cv2 above import tensorflow. I don't know why the reason.

pribadihcr avatar Jan 16 '17 01:01 pribadihcr

@pribadihcr, I already have tried your method and did not work for me.

mijung-kim avatar Jan 16 '17 03:01 mijung-kim

I got this problem when I upgraded to 1.0. After the upgrade, it happens when I import spaCy in a program where I import TensorFlow. This does not occur when I use spaCy without TensorFlow. For now, I pulled out the import of spaCy.

jmugan avatar Feb 18 '17 05:02 jmugan

I have the same problem when I import cv2 with the OpenCV's version 3.1.0. But it's ok with the version 2.4.13. And this problem only comes out after I upgraded to 1.0 of tensorflow. BTW, changing the import order of cv2 and tf can't help me.

carsonDB avatar Feb 18 '17 09:02 carsonDB

I had the same issue with tensorflow 1.0 and Spacy 1.5.1, importing spacy before tensorflow fixed it for me.

chrishokamp avatar Feb 20 '17 18:02 chrishokamp

I have the same issue with spaCy + Tensorflow too.

stephenhky avatar Apr 25 '17 18:04 stephenhky

I think we need to import tensorflow and related modules only after we have imported all the other modules. I don't know why does it work, but it did the trick for me.

ajeetksingh avatar Sep 05 '17 14:09 ajeetksingh

I have the same problem with matplotlib. importing matplotlib before tensorflow does the trick.

youkaichao avatar Jul 12 '18 16:07 youkaichao

I was running ubuntu 14.04. I upgraded to 16.04 and it solved it.

edugp avatar Sep 19 '19 17:09 edugp

As https://github.com/pytorch/pytorch/issues/2575 said That's also why changing import order can fix things, because if you change it in a way that loads all your "static TLS" libraries first, then future "dynamic TLS" libraries will resize the DTV like normal, I just insert import cv2 at the 1st line of https://github.com/rupeshs/fastsdcpu/blob/main/src/app.py and solve the issue.

flyskywhy avatar Nov 12 '24 01:11 flyskywhy