ImportError: dlopen: cannot load any more object with static TLS
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!
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.
my solution is put import cv2 above import tensorflow. I don't know why the reason.
@pribadihcr, I already have tried your method and did not work for me.
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.
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.
I had the same issue with tensorflow 1.0 and Spacy 1.5.1, importing spacy before tensorflow fixed it for me.
I have the same issue with spaCy + Tensorflow too.
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.
I have the same problem with matplotlib. importing matplotlib before tensorflow does the trick.
I was running ubuntu 14.04. I upgraded to 16.04 and it solved it.
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.