ModuleNotFoundError: No module named 'torch.utils._import_utils'

Hello,

I am currently executing a job on a cluster, but it halts due to an inability to locate a specific module. The log indicates the following error:

Traceback (most recent call last):
File “/proj/users/xmal/RoseTTAFold2NA/network/predict.py”, line 8, in
from RoseTTAFoldModel import RoseTTAFoldModule
File “/proj/users/xmal/RoseTTAFold2NA/network/RoseTTAFoldModel.py”, line 3, in
from Embeddings import MSA_emb, Extra_emb, Templ_emb, Recycling
File “/proj/users/xmal/RoseTTAFold2NA/network/Embeddings.py”, line 7, in
from util_module import Dropout, get_clones, create_custom_forward, rbf, init_lecun_normal
File “/proj/users/xmal/RoseTTAFold2NA/networkutil_module.py”, line 7, in
import dgl
File “/home/xmal/.conda/envs/RF2NA/lib/python3.10/site-packages/dgl/init.py”, line 16, in
from . import (
File “/home/xmal/.conda/envs/RF2NA/lib/python3.10/site-packages/dgl/dataloading/init.py”, line 13, in
from .dataloader import *
File “/home/xmal/.conda/envs/RF2NA/lib/python3.10/site-packages/dgl/dataloading/dataloader.py”, line 27, in
from …distributed import DistGraph
File “/home/xmal/.conda/envs/RF2NA/lib/python3.10/site-packages/dgl/distributed/init.py”, line 5, in
from .dist_graph import DistGraph, DistGraphServer, edge_split, node_split
File “/home/xmal/.conda/envs/RF2NA/lib/python3.10/site-packages/dgl/distributed/dist_graph.py”, line 11, in
from … import backend as F, graphbolt as gb, heterograph_index
File “/home/xmal/.conda/envs/RF2NA/lib/python3.10/site-packages/dgl/graphbolt/init.py”, line 8, in
from .base import *
File “/home/xmal/.conda/envs/RF2NA/lib/python3.10/site-packages/dgl/graphbolt/base.py”, line 8, in
from torchdata.datapipes.iter import IterDataPipe
File “/home/xmal/.conda/envs/RF2NA/lib/python3.10/site-packages/torchdata/datapipes/init.py”, line 11, in
from . import iter, map, utils
File “/home/xmal/.conda/envs/RF2NA/lib/python3.10/site-packages/torchdata/datapipes/iter/init.py”, line 79, in
from torchdata.datapipes.iter.util.cacheholder import (
File “/home/xmal/.conda/envs/RF2NA/lib/python3.10/site-packages/torchdata/datapipes/iter/util/cacheholder.py”, line 24, in
from torch.utils._import_utils import dill_available
ModuleNotFoundError: No module named ‘torch.utils._import_utils’

Version I have in my env
pytorch-cuda 11.7
pytorch-mutex 1.0
torch 2.1.2
torch-utils 0.1.2
torchaudio 2.2.2
torchdata 0.8.0
torchvision 0.17.2

Any help would be appreciated thanks!

The failing function was merged in Jan 2024 in this PR and your PyTorch release is thus too old. Update PyTorch and rerun your script again.

This helps, but raises another error for FileNotFoundError: Cannot find DGL C++ graphbolt library at /home/xmal/.conda/envs/RF2NA/lib/python3.10/site-packages/dgl/graphbolt/libgraphbolt_pytorch_2.3.1.so

If i changed to another version then this error is solved, but ‘torch.utils’ raises again.