– EDIT: it seems a python issue or related. dont know how.
from multiprocessing.util import register_after_fork is a python module that is being imported in
torch.multiprocessing.reductions.py. not sure why this issue raises because
from multiprocessing.util import register_after_fork works fine in python. almost certain that it has something to do with the installation. tried code on different virtual env. torch multiprocessing works fine… creating a new new virtual env. and installing pytorch in it solved the issue.
code was working fine.
did a script where i used
import torch.multiprocessing as mp. running the script throws the error bellow.
now, running any script, without even multiprocessing, throws the same error.
import torch throws the error.
import torch in python or ipython interpreter is fine.
Python 3.7.10 (default, Feb 26 2021, 18:47:35) [GCC 7.3.0] :: Anaconda, Inc. on linux
Traceback (most recent call last): File "multips.py", line 3, in <module> import torch File "x/lib/python3.7/site-packages/torch/__init__.py", line 688, in <module> from torch import multiprocessing as multiprocessing File "x/lib/python3.7/site-packages/torch/multiprocessing/__init__.py", line 18, in <module> from .reductions import init_reductions File "x/lib/python3.7/site-packages/torch/multiprocessing/reductions.py", line 7, in <module> from multiprocessing.util import register_after_fork ModuleNotFoundError: No module named 'multiprocessing.util'; 'multiprocessing' is not a package