Jupyter dlopen cannot load any more object with static TLS
A weird problem that execute "import torch" in bash works but when you run it in Jupyter notebook:
ImportError Traceback (most recent call last) <ipython-input-4-8ba1970b60ce> in <module> 6 import random 7 ----> 8 import torch 9 import torch.nn as nn 10 ~/miniconda3/envs/tf/lib/python3.6/site-packages/torch/__init__.py in <module> 79 del _dl_flags 80 ---> 81 from torch._C import * 82 83 __all__ += [name for name in dir(_C) ImportError: dlopen: cannot load any more object with static TLS
Seems that it's a compatibility issue. Even though there are a large volume of discussions but none of them works. Ironically, I accidently fixed the issue by resolving another: # RuntimeError cuDNN error CUDNN_STATUS_EXECUTION_FAILED Solution
Potential Solution
I marked these solutions as "potential" because I didn't make a strict control variable experiment. I tried all of them and it worked. :-)
My environment:
1. Ubuntu 14.04 LTS 2. Python 3.6.9 3. PyTorch 1.3.0 4. cuda 10.1 (Tesla K40m)
The order of following solutions matters.
Upgrade/Downgrade Cuda
To the best of my understanding, this operation does the trick (but didn't verified). Downgrade cuda from 10.x to 9.0.
Upgrade/Downgrade PyTorch
conda install pytorch==1.2.0 torchvision==0.4.0 cudatoolkit=10.0 -c pytorch
If you use conda, you can refer to this page to find a working combination: INSTALLING PREVIOUS VERSIONS OF PYTORCH
Upgrade Jupyter
$ conda update jupyter
Upgrade Ubuntu
I do-release-upgrade
from 14.04 to 16.04 and finally
18.04 LTS. Ubuntu
Upgrades
Preview: