The error looks like this:
$ python test.py
Traceback (most recent call last):
File "test.py", line 3, in <module>
...
File "miniconda3/envs/torch/lib/python3.7/site-packages/apex/__init__.py", line 18, in <module>
from apex.interfaces import (ApexImplementation,
File "miniconda3/envs/torch/lib/python3.7/site-packages/apex/interfaces.py", line 10, in <module>
class ApexImplementation(object):
File "miniconda3/envs/torch/lib/python3.7/site-packages/apex/interfaces.py", line 14, in ApexImplementation
implements(IApex)
File "miniconda3/envs/torch/lib/python3.7/site-packages/zope/interface/declarations.py", line 483, in implements
raise TypeError(_ADVICE_ERROR % 'implementer')
TypeError: Class advice impossible in Python3. Use the @implementer class decorator instead.
Refer to this issue: https://github.com/NVIDIA/apex/issues/116
Install the latest version resolved the issue:
pip uninstall apex
git clone https://www.github.com/nvidia/apex
cd apex
python setup.py install