inplace_abn icon indicating copy to clipboard operation
inplace_abn copied to clipboard

Pytorch: ImportError: No module named 'inplace_abn'

Open amaanda opened this issue 5 years ago • 1 comments

When I try importing the module in a simple python code such as

import inplace_abn
print('hello')

I get no errors. But when I try the command pointed in the README by the authors, that is,

python test_vistas.py /path/to/model.pth.tar /path/to/input/folder /path/to/output/folder

I get the following error:

C:\Users\Pichau\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\utils\cpp_extension.py:184: UserWarning: Error checking compiler version for c++: [WinError 2] O sistema não pode encontrar o arquivo especificado
  warnings.warn('Error checking compiler version for {}: {}'.format(compiler, error))
Traceback (most recent call last):
  File "test_vistas_single_gpu.py", line 14, in <module>
    import models
  File "C:\Users\Pichau\AppData\Local\Programs\Python\Python36\Lib\site-packages\inplace_abn\models\__init__.py", line 1, in <module>
    from .resnext import *
  File "C:\Users\Pichau\AppData\Local\Programs\Python\Python36\Lib\site-packages\inplace_abn\models\resnext.py", line 7, in <module>
    from modules import IdentityResidualBlock, ABN, GlobalAvgPool2d
  File "C:\Users\Pichau\AppData\Local\Programs\Python\Python36\Lib\site-packages\inplace_abn\modules\__init__.py", line 1, in <module>
    from .bn import ABN, InPlaceABN, InPlaceABNSync
  File "C:\Users\Pichau\AppData\Local\Programs\Python\Python36\Lib\site-packages\inplace_abn\modules\bn.py", line 10, in <module>
    from .functions import *
  File "C:\Users\Pichau\AppData\Local\Programs\Python\Python36\Lib\site-packages\inplace_abn\modules\functions.py", line 18, in <module>
    extra_cuda_cflags=["--expt-extended-lambda"])
  File "C:\Users\Pichau\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\utils\cpp_extension.py", line 645, in load
    is_python_module)
  File "C:\Users\Pichau\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\utils\cpp_extension.py", line 825, in _jit_compile
    return _import_module_from_library(name, build_directory, is_python_module)
  File "C:\Users\Pichau\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\utils\cpp_extension.py", line 964, in _import_module_from_library
    file, path, description = imp.find_module(module_name, [path])
  File "C:\Users\Pichau\AppData\Local\Programs\Python\Python36\lib\imp.py", line 297, in find_module
    raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named 'inplace_abn'

I am using Pytorch 1.0 stable, Python 3.6.8 and CUDA 9.0 on a Windows 10 machine. Any suggestion on how to solve this issue?

amaanda avatar Apr 24 '19 15:04 amaanda

This looks like a python module resolution issue. I would suggest to try again with the latest version of the code, since the scripts / library structure has been reworked.

ducksoup avatar Jul 10 '19 08:07 ducksoup