I am a beginner with PyTorch and started testing some codes.
The environment is Windows 10, Anaconda 3 and some required libraries have been installed, and then I am working on Spyder.
I am conflicting with an AttributeError in testing the sample program “mnist_hogwild” in “examples-master” folder in PyTorch. The error is as follows:

File “C:\USR\local\Anaconda3\lib\multiprocessing\”, line 172, in get_preparation_data
main_mod_name = getattr(main_module.spec, “name”, None)

AttributeError: module ‘main’ has no attribute ‘spec

Such an error also occurs when I run the program on the command prompt.

How can I resolve this issue? Thank you in advance :slight_smile:


This looks like and error in python’s multiprocessing library…
Which version of python are you using? The source code for python 3.6 is different from the one in your error message here.

1 Like

Hi albanD,

Thank you very much for your quick response!
I guess that the version is the newest one, 3.6, since I installed it about the last week.
But the version might be the reason as you say.
Sorry I am now out of my office and cannot confirm my work PC.
Anyway, I appreciate your reply:)

Best regards.