Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't build apex on win #839

Closed
kex243 opened this issue May 18, 2020 · 13 comments
Closed

can't build apex on win #839

kex243 opened this issue May 18, 2020 · 13 comments

Comments

@kex243
Copy link

kex243 commented May 18, 2020

just could not find the same error here:
` PS C:\Users\Администратор\apex\apex> pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
e:\miniconda3\lib\site-packages\pip_internal\commands\install.py:244: UserWarning: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
cmdoptions.check_install_build_global(options)
Non-user install because site-packages writeable
Created temporary directory: C:\Users\836D1\AppData\Local\Temp\pip-ephem-wheel-cache-eqet02m3
Created temporary directory: C:\Users\836D
1\AppData\Local\Temp\pip-req-tracker-5j533j1d
Initialized build tracking at C:\Users\836D1\AppData\Local\Temp\pip-req-tracker-5j533j1d
Created build tracker: C:\Users\836D
1\AppData\Local\Temp\pip-req-tracker-5j533j1d
Entered build tracker: C:\Users\836D1\AppData\Local\Temp\pip-req-tracker-5j533j1d
Created temporary directory: C:\Users\836D
1\AppData\Local\Temp\pip-install-ef18vjrk
Processing c:\users\администратор\apex\apex
Created temporary directory: C:\Users\836D1\AppData\Local\Temp\pip-req-build-wv3fuwxe
Added file:///C:/Users/%D0%90%D0%B4%D0%BC%D0%B8%D0%BD%D0%B8%D1%81%D1%82%D1%80%D0%B0%D1%82%D0%BE%D1%80/apex/apex to build tracker 'C:\Users\836D
1\AppData\Local\Temp\pip-req-tracker-5j533j1d'
Running setup.py (path:C:\Users\836D1\AppData\Local\Temp\pip-req-build-wv3fuwxe\setup.py) egg_info for package from file:///C:/Users/%D0%90%D0%B4%D0%BC%D0%B8%D0%BD%D0%B8%D1%81%D1%82%D1%80%D0%B0%D1%82%D0%BE%D1%80/apex/apex
Running command python setup.py egg_info
torch.version = 1.5.0
running egg_info
creating C:\Users\836D
1\AppData\Local\Temp\pip-req-build-wv3fuwxe\pip-egg-info\apex.egg-info
writing C:\Users\836D1\AppData\Local\Temp\pip-req-build-wv3fuwxe\pip-egg-info\apex.egg-info\PKG-INFO
writing dependency_links to C:\Users\836D
1\AppData\Local\Temp\pip-req-build-wv3fuwxe\pip-egg-info\apex.egg-info\dependency_links.txt
writing top-level names to C:\Users\836D1\AppData\Local\Temp\pip-req-build-wv3fuwxe\pip-egg-info\apex.egg-info\top_level.txt
writing manifest file 'C:\Users\836D
1\AppData\Local\Temp\pip-req-build-wv3fuwxe\pip-egg-info\apex.egg-info\SOURCES.txt'
reading manifest file 'C:\Users\836D1\AppData\Local\Temp\pip-req-build-wv3fuwxe\pip-egg-info\apex.egg-info\SOURCES.txt'
writing manifest file 'C:\Users\836D
1\AppData\Local\Temp\pip-req-build-wv3fuwxe\pip-egg-info\apex.egg-info\SOURCES.txt'
C:\Users\836D1\AppData\Local\Temp\pip-req-build-wv3fuwxe\setup.py:46: UserWarning: Option --pyprof not specified. Not installing PyProf dependencies!
warnings.warn("Option --pyprof not specified. Not installing PyProf dependencies!")
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "e:\miniconda3\lib\site-packages\colorama\ansitowin32.py", line 59, in closed
return stream.closed
ValueError: underlying buffer has been detached
Source in c:\users\836d
1\appdata\local\temp\pip-req-build-wv3fuwxe has version 0.1, which satisfies requirement apex==0.1 from file:///C:/Users/%D0%90%D0%B4%D0%BC%D0%B8%D0%BD%D0%B8%D1%81%D1%82%D1%80%D0%B0%D1%82%D0%BE%D1%80/apex/apex
Removed apex==0.1 from file:///C:/Users/%D0%90%D0%B4%D0%BC%D0%B8%D0%BD%D0%B8%D1%81%D1%82%D1%80%D0%B0%D1%82%D0%BE%D1%80/apex/apex from build tracker 'C:\Users\836D~1\AppData\Local\Temp\pip-req-tracker-5j533j1d'
Skipping wheel build for apex, due to binaries being disabled for it.
ERROR: Error checking for conflicts.
Traceback (most recent call last):
File "e:\miniconda3\lib\site-packages\pip_vendor\pkg_resources_init_.py", line 3021, in _dep_map
return self._dep_map
File "e:\miniconda3\lib\site-packages\pip_vendor\pkg_resources_init
.py", line 2815, in getattr
raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "e:\miniconda3\lib\site-packages\pip_vendor\pkg_resources_init_.py", line 3012, in _parsed_pkg_info
return self.pkg_info
File "e:\miniconda3\lib\site-packages\pip_vendor\pkg_resources_init
.py", line 2815, in getattr
raise AttributeError(attr)
AttributeError: _pkg_info

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "e:\miniconda3\lib\site-packages\pip_internal\commands\install.py", line 517, in warn_about_conflicts
package_set, dep_info = check_install_conflicts(to_install)
File "e:\miniconda3\lib\site-packages\pip_internal\operations\check.py", line 114, in check_install_conflicts
package_set, _ = create_package_set_from_installed()
File "e:\miniconda3\lib\site-packages\pip_internal\operations\check.py", line 53, in create_package_set_from_installed
package_set[name] = PackageDetails(dist.version, dist.requires())
File "e:\miniconda3\lib\site-packages\pip_vendor\pkg_resources_init
.py", line 2736, in requires
dm = self.dep_map
File "e:\miniconda3\lib\site-packages\pip_vendor\pkg_resources_init
.py", line 3023, in dep_map
self.dep_map = self.compute_dependencies()
File "e:\miniconda3\lib\site-packages\pip_vendor\pkg_resources_init
.py", line 3032, in compute_dependencies
for req in self.parsed_pkg_info.get_all('Requires-Dist') or []:
File "e:\miniconda3\lib\site-packages\pip_vendor\pkg_resources_init
.py", line 3014, in parsed_pkg_info
metadata = self.get_metadata(self.PKG_INFO)
File "e:\miniconda3\lib\site-packages\pip_vendor\pkg_resources_init
.py", line 1420, in get_metadata
value = self.get(path)
File "e:\miniconda3\lib\site-packages\pip_vendor\pkg_resources_init
.py", line 1616, in get
with open(path, 'rb') as stream:
FileNotFoundError: [Errno 2] No such file or directory: 'e:\miniconda3\lib\site-packages\numpy-1.18.4.dist-info\METADATA'
Installing collected packages: apex
Attempting uninstall: apex
Found existing installation: apex 0.1
Uninstalling apex-0.1:
Created temporary directory: e:\miniconda3\lib\site-packages~pex-0.1.dist-info
Removing file or directory e:\miniconda3\lib\site-packages\apex-0.1.dist-info
Created temporary directory: C:\Users\836D~1\AppData\Local\Temp\pip-uninstall-80k7xwlk
Removing file or directory e:\miniconda3\lib\site-packages\apex_init
.py
Created temporary directory: e:\miniconda3\lib\site-packages\apex~pycache

Removing file or directory e:\miniconda3\lib\site-packages\apex_pycache

Created temporary directory: e:\miniconda3\lib\site-packages\apex~mp
Removing file or directory e:\miniconda3\lib\site-packages\apex\amp
Removing file or directory e:\miniconda3\lib\site-packages\apex\contrib_init
.py
Created temporary directory: e:\miniconda3\lib\site-packages\apex\contrib~pycache

Removing file or directory e:\miniconda3\lib\site-packages\apex\contrib_pycache

Created temporary directory: e:\miniconda3\lib\site-packages\apex\contrib~roupbn
Removing file or directory e:\miniconda3\lib\site-packages\apex\contrib\groupbn
Removing file or directory e:\miniconda3\lib\site-packages\apex\contrib\optimizers_init_.py
Removing file or directory e:\miniconda3\lib\site-packages\apex\contrib\optimizers_pycache__init_.cpython-37.pyc
Removing file or directory e:\miniconda3\lib\site-packages\apex\contrib\optimizers_pycache_\fp16_optimizer.cpython-37.pyc
Removing file or directory e:\miniconda3\lib\site-packages\apex\contrib\optimizers_pycache_\fused_adam.cpython-37.pyc
Removing file or directory e:\miniconda3\lib\site-packages\apex\contrib\optimizers\fp16_optimizer.py
Removing file or directory e:\miniconda3\lib\site-packages\apex\contrib\optimizers\fused_adam.py
Created temporary directory: e:\miniconda3\lib\site-packages\apex\contrib~entropy
Removing file or directory e:\miniconda3\lib\site-packages\apex\contrib\xentropy
Created temporary directory: e:\miniconda3\lib\site-packages\apex~p16_utils
Removing file or directory e:\miniconda3\lib\site-packages\apex\fp16_utils
Created temporary directory: e:\miniconda3\lib\site-packages\apex~ulti_tensor_apply
Removing file or directory e:\miniconda3\lib\site-packages\apex\multi_tensor_apply
Created temporary directory: e:\miniconda3\lib\site-packages\apex~ormalization
Removing file or directory e:\miniconda3\lib\site-packages\apex\normalization
Created temporary directory: e:\miniconda3\lib\site-packages\apex~ptimizers
Removing file or directory e:\miniconda3\lib\site-packages\apex\optimizers
Created temporary directory: e:\miniconda3\lib\site-packages\apex~arallel
Removing file or directory e:\miniconda3\lib\site-packages\apex\parallel
Created temporary directory: e:\miniconda3\lib\site-packages\apex~yprof
Removing file or directory e:\miniconda3\lib\site-packages\apex\pyprof
Created temporary directory: e:\miniconda3\lib\site-packages\apex~eparameterization
Removing file or directory e:\miniconda3\lib\site-packages\apex\reparameterization
Created temporary directory: e:\miniconda3\lib\site-packages\apex~nn
Removing file or directory e:\miniconda3\lib\site-packages\apex\rnn
Successfully uninstalled apex-0.1
Created temporary directory: C:\Users\836D1\AppData\Local\Temp\pip-record-iyah5zse
Running command 'e:\miniconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\836D
1\AppData\Local\Temp\pip-req-build-wv3fuwxe\setup.py'"'"'; file='"'"'C:\Users\836D1\AppData\Local\Temp\pip-req-build-wv3fuwxe\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' --cpp_ext --cuda_ext install --record 'C:\Users\836D1\AppData\Local\Temp\pip-record-iyah5zse\install-record.txt' --single-version-externally-managed --compile --install-headers 'e:\miniconda3\Include\apex'
torch.version = 1.5.0
C:\Users\836D~1\AppData\Local\Temp\pip-req-build-wv3fuwxe\setup.py:46: UserWarning: Option --pyprof not specified. Not installing PyProf dependencies!
warnings.warn("Option --pyprof not specified. Not installing PyProf dependencies!")

Compiling cuda extensions with
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:32:27_Pacific_Daylight_Time_2019
Cuda compilation tools, release 10.2, V10.2.89
from C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2/bin

running install
running build
running build_py
running build_ext
e:\miniconda3\lib\site-packages\torch\utils\cpp_extension.py:237: UserWarning: Error checking compiler version for cl: [WinError 2] Не удается найти указанный файл
  warnings.warn('Error checking compiler version for {}: {}'.format(compiler, error))
building 'apex_C' extension
Emitting ninja build file C:\Users\836D~1\AppData\Local\Temp\pip-req-build-wv3fuwxe\build\temp.win-amd64-3.7\Release\build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/1] cl /showIncludes /nologo /Ox /W3 /GL /DNDEBUG /MD /MD /wd4819 /EHsc -Ie:\miniconda3\lib\site-packages\torch\include -Ie:\miniconda3\lib\site-packages\torch\include\torch\csrc\api\include -Ie:\miniconda3\lib\site-packages\torch\include\TH -Ie:\miniconda3\lib\site-packages\torch\include\THC -Ie:\miniconda3\include -Ie:\miniconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.7.2\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" -c C:\Users\836D~1\AppData\Local\Temp\pip-req-build-wv3fuwxe\csrc\flatten_unflatten.cpp /FoC:\Users\836D~1\AppData\Local\Temp\pip-req-build-wv3fuwxe\build\temp.win-amd64-3.7\Release\csrc/flatten_unflatten.obj -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=apex_C -D_GLIBCXX_USE_CXX11_ABI=0 /std:c++14
FAILED: C:/Users/836D~1/AppData/Local/Temp/pip-req-build-wv3fuwxe/build/temp.win-amd64-3.7/Release/csrc/flatten_unflatten.obj
cl /showIncludes /nologo /Ox /W3 /GL /DNDEBUG /MD /MD /wd4819 /EHsc -Ie:\miniconda3\lib\site-packages\torch\include -Ie:\miniconda3\lib\site-packages\torch\include\torch\csrc\api\include -Ie:\miniconda3\lib\site-packages\torch\include\TH -Ie:\miniconda3\lib\site-packages\torch\include\THC -Ie:\miniconda3\include -Ie:\miniconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.7.2\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" -c C:\Users\836D~1\AppData\Local\Temp\pip-req-build-wv3fuwxe\csrc\flatten_unflatten.cpp /FoC:\Users\836D~1\AppData\Local\Temp\pip-req-build-wv3fuwxe\build\temp.win-amd64-3.7\Release\csrc/flatten_unflatten.obj -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=apex_C -D_GLIBCXX_USE_CXX11_ABI=0 /std:c++14
CreateProcess failed: The system cannot find the file specified.
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "e:\miniconda3\lib\site-packages\torch\utils\cpp_extension.py", line 1400, in _run_ninja_build
    check=True)
  File "e:\miniconda3\lib\subprocess.py", line 512, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\836D~1\AppData\Local\Temp\pip-req-build-wv3fuwxe\setup.py", line 314, in <module>
    extras_require=extras,
  File "e:\miniconda3\lib\site-packages\setuptools\__init__.py", line 144, in setup
    return distutils.core.setup(**attrs)
  File "e:\miniconda3\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "e:\miniconda3\lib\distutils\dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "e:\miniconda3\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "e:\miniconda3\lib\site-packages\setuptools\command\install.py", line 61, in run
    return orig.install.run(self)
  File "e:\miniconda3\lib\distutils\command\install.py", line 545, in run
    self.run_command('build')
  File "e:\miniconda3\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "e:\miniconda3\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "e:\miniconda3\lib\distutils\command\build.py", line 135, in run
    self.run_command(cmd_name)
  File "e:\miniconda3\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "e:\miniconda3\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "e:\miniconda3\lib\site-packages\setuptools\command\build_ext.py", line 87, in run
    _build_ext.run(self)
  File "e:\miniconda3\lib\distutils\command\build_ext.py", line 340, in run
    self.build_extensions()
  File "e:\miniconda3\lib\site-packages\torch\utils\cpp_extension.py", line 580, in build_extensions
    build_ext.build_extensions(self)
  File "e:\miniconda3\lib\distutils\command\build_ext.py", line 449, in build_extensions
    self._build_extensions_serial()
  File "e:\miniconda3\lib\distutils\command\build_ext.py", line 474, in _build_extensions_serial
    self.build_extension(ext)
  File "e:\miniconda3\lib\site-packages\setuptools\command\build_ext.py", line 208, in build_extension
    _build_ext.build_extension(self, ext)
  File "e:\miniconda3\lib\distutils\command\build_ext.py", line 534, in build_extension
    depends=ext.depends)
  File "e:\miniconda3\lib\site-packages\torch\utils\cpp_extension.py", line 562, in win_wrap_ninja_compile
    with_cuda=with_cuda)
  File "e:\miniconda3\lib\site-packages\torch\utils\cpp_extension.py", line 1140, in _write_ninja_file_and_compile_objects
    error_prefix='Error compiling objects for extension')
  File "e:\miniconda3\lib\site-packages\torch\utils\cpp_extension.py", line 1413, in _run_ninja_build
    raise RuntimeError(message)
RuntimeError: Error compiling objects for extension
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "e:\miniconda3\lib\site-packages\colorama\ansitowin32.py", line 59, in closed
    return stream.closed
ValueError: underlying buffer has been detached
Running setup.py install for apex ... error

Rolling back uninstall of apex
Moving to e:\miniconda3\lib\site-packages\apex-0.1.dist-info
from e:\miniconda3\lib\site-packages~pex-0.1.dist-info
Moving to e:\miniconda3\lib\site-packages\apex_init_.py
from C:\Users\836D1\AppData\Local\Temp\pip-uninstall-80k7xwlk_init_.py
Moving to e:\miniconda3\lib\site-packages\apex_pycache_
from e:\miniconda3\lib\site-packages\apex~pycache_
Moving to e:\miniconda3\lib\site-packages\apex\amp
from e:\miniconda3\lib\site-packages\apex~mp
Moving to e:\miniconda3\lib\site-packages\apex\contrib_init_.py
from C:\Users\836D
1\AppData\Local\Temp\pip-uninstall-80k7xwlk\contrib_init_.py
Moving to e:\miniconda3\lib\site-packages\apex\contrib_pycache_
from e:\miniconda3\lib\site-packages\apex\contrib~pycache_
Moving to e:\miniconda3\lib\site-packages\apex\contrib\groupbn
from e:\miniconda3\lib\site-packages\apex\contrib~roupbn
Moving to e:\miniconda3\lib\site-packages\apex\contrib\optimizers_init_.py
from C:\Users\836D1\AppData\Local\Temp\pip-uninstall-80k7xwlk\contrib\optimizers_init_.py
Moving to e:\miniconda3\lib\site-packages\apex\contrib\optimizers_pycache__init_.cpython-37.pyc
from C:\Users\836D
1\AppData\Local\Temp\pip-uninstall-80k7xwlk\contrib\optimizers_pycache__init_.cpython-37.pyc
Moving to e:\miniconda3\lib\site-packages\apex\contrib\optimizers_pycache_\fp16_optimizer.cpython-37.pyc
from C:\Users\836D1\AppData\Local\Temp\pip-uninstall-80k7xwlk\contrib\optimizers_pycache_\fp16_optimizer.cpython-37.pyc
Moving to e:\miniconda3\lib\site-packages\apex\contrib\optimizers_pycache_\fused_adam.cpython-37.pyc
from C:\Users\836D
1\AppData\Local\Temp\pip-uninstall-80k7xwlk\contrib\optimizers_pycache_\fused_adam.cpython-37.pyc
Moving to e:\miniconda3\lib\site-packages\apex\contrib\optimizers\fp16_optimizer.py
from C:\Users\836D1\AppData\Local\Temp\pip-uninstall-80k7xwlk\contrib\optimizers\fp16_optimizer.py
Moving to e:\miniconda3\lib\site-packages\apex\contrib\optimizers\fused_adam.py
from C:\Users\836D
1\AppData\Local\Temp\pip-uninstall-80k7xwlk\contrib\optimizers\fused_adam.py
Moving to e:\miniconda3\lib\site-packages\apex\contrib\xentropy
from e:\miniconda3\lib\site-packages\apex\contrib~entropy
Moving to e:\miniconda3\lib\site-packages\apex\fp16_utils
from e:\miniconda3\lib\site-packages\apex~p16_utils
Moving to e:\miniconda3\lib\site-packages\apex\multi_tensor_apply
from e:\miniconda3\lib\site-packages\apex~ulti_tensor_apply
Moving to e:\miniconda3\lib\site-packages\apex\normalization
from e:\miniconda3\lib\site-packages\apex~ormalization
Moving to e:\miniconda3\lib\site-packages\apex\optimizers
from e:\miniconda3\lib\site-packages\apex~ptimizers
Moving to e:\miniconda3\lib\site-packages\apex\parallel
from e:\miniconda3\lib\site-packages\apex~arallel
Moving to e:\miniconda3\lib\site-packages\apex\pyprof
from e:\miniconda3\lib\site-packages\apex~yprof
Moving to e:\miniconda3\lib\site-packages\apex\reparameterization
from e:\miniconda3\lib\site-packages\apex~eparameterization
Moving to e:\miniconda3\lib\site-packages\apex\rnn
from e:\miniconda3\lib\site-packages\apex~nn
Replacing e:\miniconda3\lib\site-packages\apex-0.1.dist-info\ from e:\miniconda3\lib\site-packages~pex-0.1.dist-info
Replacing e:\miniconda3\lib\site-packages\apex_init_.py from C:\Users\836D1\AppData\Local\Temp\pip-uninstall-80k7xwlk_init_.py
Replacing e:\miniconda3\lib\site-packages\apex_pycache_\ from e:\miniconda3\lib\site-packages\apex~pycache_
Replacing e:\miniconda3\lib\site-packages\apex\amp\ from e:\miniconda3\lib\site-packages\apex~mp
Replacing e:\miniconda3\lib\site-packages\apex\contrib_init_.py from C:\Users\836D
1\AppData\Local\Temp\pip-uninstall-80k7xwlk\contrib_init_.py
Replacing e:\miniconda3\lib\site-packages\apex\contrib_pycache_\ from e:\miniconda3\lib\site-packages\apex\contrib~pycache_
Replacing e:\miniconda3\lib\site-packages\apex\contrib\groupbn\ from e:\miniconda3\lib\site-packages\apex\contrib~roupbn
Replacing e:\miniconda3\lib\site-packages\apex\contrib\optimizers_init_.py from C:\Users\836D1\AppData\Local\Temp\pip-uninstall-80k7xwlk\contrib\optimizers_init_.py
Replacing e:\miniconda3\lib\site-packages\apex\contrib\optimizers_pycache__init_.cpython-37.pyc from C:\Users\836D
1\AppData\Local\Temp\pip-uninstall-80k7xwlk\contrib\optimizers_pycache__init_.cpython-37.pyc
Replacing e:\miniconda3\lib\site-packages\apex\contrib\optimizers_pycache_\fp16_optimizer.cpython-37.pyc from C:\Users\836D1\AppData\Local\Temp\pip-uninstall-80k7xwlk\contrib\optimizers_pycache_\fp16_optimizer.cpython-37.pyc
Replacing e:\miniconda3\lib\site-packages\apex\contrib\optimizers_pycache_\fused_adam.cpython-37.pyc from C:\Users\836D
1\AppData\Local\Temp\pip-uninstall-80k7xwlk\contrib\optimizers_pycache_\fused_adam.cpython-37.pyc
Replacing e:\miniconda3\lib\site-packages\apex\contrib\optimizers\fp16_optimizer.py from C:\Users\836D1\AppData\Local\Temp\pip-uninstall-80k7xwlk\contrib\optimizers\fp16_optimizer.py
Replacing e:\miniconda3\lib\site-packages\apex\contrib\optimizers\fused_adam.py from C:\Users\836D
1\AppData\Local\Temp\pip-uninstall-80k7xwlk\contrib\optimizers\fused_adam.py
Replacing e:\miniconda3\lib\site-packages\apex\contrib\xentropy\ from e:\miniconda3\lib\site-packages\apex\contrib~entropy
Replacing e:\miniconda3\lib\site-packages\apex\fp16_utils\ from e:\miniconda3\lib\site-packages\apex~p16_utils
Replacing e:\miniconda3\lib\site-packages\apex\multi_tensor_apply\ from e:\miniconda3\lib\site-packages\apex~ulti_tensor_apply
Replacing e:\miniconda3\lib\site-packages\apex\normalization\ from e:\miniconda3\lib\site-packages\apex~ormalization
Replacing e:\miniconda3\lib\site-packages\apex\optimizers\ from e:\miniconda3\lib\site-packages\apex~ptimizers
Replacing e:\miniconda3\lib\site-packages\apex\parallel\ from e:\miniconda3\lib\site-packages\apex~arallel
Replacing e:\miniconda3\lib\site-packages\apex\pyprof\ from e:\miniconda3\lib\site-packages\apex~yprof
Replacing e:\miniconda3\lib\site-packages\apex\reparameterization\ from e:\miniconda3\lib\site-packages\apex~eparameterization
Replacing e:\miniconda3\lib\site-packages\apex\rnn\ from e:\miniconda3\lib\site-packages\apex~nn
Cleaning up...
Removing source in C:\Users\836D1\AppData\Local\Temp\pip-req-build-wv3fuwxe
Removed build tracker: 'C:\Users\836D
1\AppData\Local\Temp\pip-req-tracker-5j533j1d'
ERROR: Command errored out with exit status 1: 'e:\miniconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\836D1\AppData\Local\Temp\pip-req-build-wv3fuwxe\setup.py'"'"'; file='"'"'C:\Users\836D1\AppData\Local\Temp\pip-req-build-wv3fuwxe\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' --cpp_ext --cuda_ext install --record 'C:\Users\836D1\AppData\Local\Temp\pip-record-iyah5zse\install-record.txt' --single-version-externally-managed --compile --install-headers 'e:\miniconda3\Include\apex' Check the logs for full command output.
Exception information:
Traceback (most recent call last):
File "e:\miniconda3\lib\site-packages\pip_internal\cli\base_command.py", line 186, in main
status = self.run(options, args)
File "e:\miniconda3\lib\site-packages\pip_internal\commands\install.py", line 404, in run
use_user_site=options.use_user_site,
File "e:\miniconda3\lib\site-packages\pip_internal\req_init
.py", line 71, in install_given_reqs
**kwargs
File "e:\miniconda3\lib\site-packages\pip_internal\req\req_install.py", line 829, in install
scheme=scheme,
File "e:\miniconda3\lib\site-packages\pip_internal\operations\install\legacy.py", line 72, in install
cwd=install_req.unpacked_source_directory,
File "e:\miniconda3\lib\site-packages\pip_internal\utils\subprocess.py", line 275, in runner
spinner=spinner,
File "e:\miniconda3\lib\site-packages\pip_internal\utils\subprocess.py", line 242, in call_subprocess
raise InstallationError(exc_msg)
pip._internal.exceptions.InstallationError: Command errored out with exit status 1: 'e:\miniconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\836D
1\AppData\Local\Temp\pip-req-build-wv3fuwxe\setup.py'"'"'; file='"'"'C:\Users\836D1\AppData\Local\Temp\pip-req-build-wv3fuwxe\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' --cpp_ext --cuda_ext install --record 'C:\Users\836D1\AppData\Local\Temp\pip-record-iyah5zse\install-record.txt' --single-version-externally-managed --compile --install-headers 'e:\miniconda3\Include\apex' Check the logs for full command output.
1 location(s) to search for versions of pip:

cuda 10.2, pytorch 1.5.0

It can compile conda version, but it has no extensions so pix2pixHD gives error 'no module amp_C'.
setup via cloning and python setup.py with --parameters gives same error.

@leungi
Copy link

leungi commented May 22, 2020

Similar issues building on Windows.

Followed the tip to comment out check from #323, and got it working up to the section below after running pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" .

Error msg

D:/Continuum/anaconda3/envs/simpletransformers/lib/site-packages/torch/lib/include\ATen/cuda/CUDAStream.h(129): warning: field of class type without a DLL interface used in a class with a DLL interface

    1 error detected in the compilation of "C:/Users/leungi/AppData/Local/Temp/tmpxft_00019b7c_00000000-10_multi_tensor_sgd_kernel.cpp1.ii".
    multi_tensor_sgd_kernel.cu
    error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.2\\bin\\nvcc.exe' failed with exit status 1
    Running setup.py install for apex ... error
Cleaning up...
  Removing source in C:\Users\leungi\AppData\Local\Temp\pip-req-build-rly3__ln
Removed build tracker: 'C:\\Users\\leungi\\AppData\\Local\\Temp\\pip-req-tracker-5lrcpp9b'
ERROR: Command errored out with exit status 1: 'D:\Continuum\anaconda3\envs\simpletransformers\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\leungi\\AppData\\Local\\Temp\\pip-req-build-rly3__ln\\setup.py'"'"'; __file__='"'"'C:\\Users\\leungi\\AppData\\Local\\Temp\\pip-req-build-rly3__ln\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' --cpp_ext --cuda_ext install --record 'C:\Users\leungi\AppData\Local\Temp\pip-record-8uxyfq66\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\Continuum\anaconda3\envs\simpletransformers\Include\apex' Check the logs for full command output.
Exception information:
Traceback (most recent call last):
  File "D:\Continuum\anaconda3\envs\simpletransformers\lib\site-packages\pip\_internal\cli\base_command.py", line 186, in _main
    status = self.run(options, args)
  File "D:\Continuum\anaconda3\envs\simpletransformers\lib\site-packages\pip\_internal\commands\install.py", line 404, in run
    use_user_site=options.use_user_site,
  File "D:\Continuum\anaconda3\envs\simpletransformers\lib\site-packages\pip\_internal\req\__init__.py", line 71, in install_given_reqs
    **kwargs
  File "D:\Continuum\anaconda3\envs\simpletransformers\lib\site-packages\pip\_internal\req\req_install.py", line 829, in install
    scheme=scheme,
  File "D:\Continuum\anaconda3\envs\simpletransformers\lib\site-packages\pip\_internal\operations\install\legacy.py", line 72, in install
    cwd=install_req.unpacked_source_directory,
  File "D:\Continuum\anaconda3\envs\simpletransformers\lib\site-packages\pip\_internal\utils\subprocess.py", line 275, in runner
    spinner=spinner,
  File "D:\Continuum\anaconda3\envs\simpletransformers\lib\site-packages\pip\_internal\utils\subprocess.py", line 242, in call_subprocess
    raise InstallationError(exc_msg)
pip._internal.exceptions.InstallationError: Command errored out with exit status 1: 'D:\Continuum\anaconda3\envs\simpletransformers\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\leungi\\AppData\\Local\\Temp\\pip-req-build-rly3__ln\\setup.py'"'"'; __file__='"'"'C:\\Users\\leungi\\AppData\\Local\\Temp\\pip-req-build-rly3__ln\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' --cpp_ext --cuda_ext install --record 'C:\Users\leungi\AppData\Local\Temp\pip-record-8uxyfq66\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\Continuum\anaconda3\envs\simpletransformers\Include\apex' Check the logs for full command output.

System info

(simpletransformers) PS P:\project\Fun\apex> [System.Environment]::OSVersion.Version

Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      17134  0

@billpun
Copy link

billpun commented Jun 6, 2020

my experience is similar. I have successfully compiled pytorch 1.6.0 using VS2019 on cuda 10.2 and Windows 10. However, I received similar errors in apex using the recommended command.

pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" .

I have disabled ninja to see the following errors.

multi_tensor_sgd_kernel.cu
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin\nvcc.exe -c csrc/multi_tensor_scale_kernel.cu -o build\temp.win-amd64-3.7\Release\csrc/multi_tensor_scale_kernel.obj -IC:\Users\bill\software\anaconda3\lib\site-packages\torch\include -IC:\Users\bill\software\anaconda3\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\bill\software\anaconda3\lib\site-packages\torch\include\TH -IC:\Users\bill\software\anaconda3\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include" -IC:\Users\bill\software\anaconda3\include -IC:\Users\bill\software\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.2\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcompiler /EHsc -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompiler /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4819 -Xcompiler /MD -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -lineinfo -O3 --use_fast_math -DVERSION_GE_1_1 -DVERSION_GE_1_3 -DVERSION_GE_1_5 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=amp_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=sm_75
C:/Users/bill/software/anaconda3/lib/site-packages/torch/include\c10/util/ThreadLocalDebugInfo.h(12): warning: modifier is ignored on an enum specifier

C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/include\type_traits(1077): error: static assertion failed with "You've instantiated std::aligned_storage<Len, Align> with an extended alignment (in other words, Align > alignof(max_align_t)). Before VS 2017 15.8, the member "type" would non-conformingly have an alignment of only alignof(max_align_t). VS 2017 15.8 was fixed to handle this correctly, but the fix inherently changes layout and breaks binary compatibility (*only* for uses of aligned_storage with extended alignments). Please define either (1) _ENABLE_EXTENDED_ALIGNED_STORAGE to acknowledge that you understand this message and that you actually want a type with an extended alignment, or (2) _DISABLE_EXTENDED_ALIGNED_STORAGE to silence this message and get the old non-conforming behavior."
          detected during:
            instantiation of class "std::_Aligned<_Len, _Align, double, false> [with _Len=16ULL, _Align=16ULL]"
(1097): here
            instantiation of class "std::_Aligned<_Len, _Align, int, false> [with _Len=16ULL, _Align=16ULL]"
(1104): here
            instantiation of class "std::_Aligned<_Len, _Align, short, false> [with _Len=16ULL, _Align=16ULL]"
(1111): here
            instantiation of class "std::_Aligned<_Len, _Align, char, false> [with _Len=16ULL, _Align=16ULL]"
(1118): here
            instantiation of class "std::aligned_storage<_Len, _Align> [with _Len=16ULL, _Align=16ULL]"
csrc/multi_tensor_scale_kernel.cu(25): here
            instantiation of "void load_store(T *, T *, int, int) [with T=float]"
csrc/multi_tensor_scale_kernel.cu(64): here
            instantiation of "void ScaleFunctor<in_t, out_t>::operator()(int, volatile int *, TensorListMetadata<2> &, float) [with in_t=float, out_t=float]"
C:\Users\bill\AppData\Local\Temp\pip-req-build-1533pg19\csrc\multi_tensor_apply.cuh(37): here
            instantiation of "void multi_tensor_apply_kernel(int, volatile int *, T, U, ArgTypes...) [with T=TensorListMetadata<2>, U=ScaleFunctor<float, float>, ArgTypes=<float>]"
C:\Users\bill\AppData\Local\Temp\pip-req-build-1533pg19\csrc\multi_tensor_apply.cuh(106): here
            instantiation of "void multi_tensor_apply<depth,T,ArgTypes...>(int, int, const at::Tensor &, const std::vector<std::vector<at::Tensor, std::allocator<at::Tensor>>, std::allocator<std::vector<at::Tensor, std::allocator<at::Tensor>>>> &, T, ArgTypes...) [with depth=2, T=ScaleFunctor<float, float>, ArgTypes=<float>]"
csrc/multi_tensor_scale_kernel.cu(124): here

1 error detected in the compilation of "C:/Users/bill/AppData/Local/Temp/tmpxft_00006e60_00000000-10_multi_tensor_scale_kernel.cpp1.ii".
multi_tensor_scale_kernel.cu
error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.2\\bin\\nvcc.exe' failed with exit status 1
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "C:\Users\bill\software\anaconda3\lib\site-packages\colorama\ansitowin32.py", line 59, in closed
    return stream.closed
ValueError: underlying buffer has been detached
Running setup.py install for apex ... error

Then, after I modified the setup.py to add the D_ENABLE_EXTENDED_ALIGNED_STORAGE option, I got the following error instead.

multi_tensor_sgd_kernel.cu
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin\nvcc.exe -c csrc/multi_tensor_scale_kernel.cu -o build\temp.win-amd64-3.7\Release\csrc/multi_tensor_scale_kernel.obj -IC:\Users\bill\software\anaconda3\lib\site-packages\torch\include -IC:\Users\bill\software\anaconda3\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\bill\software\anaconda3\lib\site-packages\torch\include\TH -IC:\Users\bill\software\anaconda3\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include" -IC:\Users\bill\software\anaconda3\include -IC:\Users\bill\software\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.2\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcompiler /EHsc -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompiler /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4819 -Xcompiler /MD -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -lineinfo -O3 --use_fast_math -DVERSION_GE_1_1 -DVERSION_GE_1_3 -DVERSION_GE_1_5 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=amp_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=sm_75
C:/Users/bill/software/anaconda3/lib/site-packages/torch/include\c10/util/ThreadLocalDebugInfo.h(12): warning: modifier is ignored on an enum specifier

csrc/multi_tensor_scale_kernel.cu(69): error: calling a __host__ function("isfinite< ::c10::Half> ") from a __device__ function("ScaleFunctor< ::c10::Half, float> ::operator ()") is not allowed

csrc/multi_tensor_scale_kernel.cu(69): error: identifier "isfinite< ::c10::Half> " is undefined in device code

csrc/multi_tensor_scale_kernel.cu(97): error: calling a __host__ function("isfinite< ::c10::Half> ") from a __device__ function("ScaleFunctor< ::c10::Half, float> ::operator ()") is not allowed

csrc/multi_tensor_scale_kernel.cu(97): error: identifier "isfinite< ::c10::Half> " is undefined in device code

csrc/multi_tensor_scale_kernel.cu(69): error: calling a __host__ function("isfinite< ::c10::Half> ") from a __device__ function("ScaleFunctor< ::c10::Half,  ::c10::Half> ::operator ()") is not allowed

csrc/multi_tensor_scale_kernel.cu(69): error: identifier "isfinite< ::c10::Half> " is undefined in device code

csrc/multi_tensor_scale_kernel.cu(97): error: calling a __host__ function("isfinite< ::c10::Half> ") from a __device__ function("ScaleFunctor< ::c10::Half,  ::c10::Half> ::operator ()") is not allowed

csrc/multi_tensor_scale_kernel.cu(97): error: identifier "isfinite< ::c10::Half> " is undefined in device code

8 errors detected in the compilation of "C:/Users/bill/AppData/Local/Temp/tmpxft_00007afc_00000000-10_multi_tensor_scale_kernel.cpp1.ii".
multi_tensor_scale_kernel.cu
error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.2\\bin\\nvcc.exe' failed with exit status 1
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "C:\Users\bill\software\anaconda3\lib\site-packages\colorama\ansitowin32.py", line 59, in closed
    return stream.closed
ValueError: underlying buffer has been detached
Running setup.py install for apex ... error

@kezewang
Copy link

I have also confronted this error. Does anyone know how to solve it? Thanks

@kezewang
Copy link

Please try my forked version: https://github.com/kezewang/apex.
Moreover, please refer to the following link to fix Windows MSVC Compatibility
facebookresearch/pytorch3d#10

It costs me a whole day to address all the issues.

@kex243
Copy link
Author

kex243 commented Jun 22, 2020

thanks man! I'll try kezewang's version and to check msvc and after this will close issue reporting results. Will continue issues there in case of something with that fork.

@kezewang
Copy link

You are very welcome.

@billpun
Copy link

billpun commented Jun 22, 2020

Thank you very much @kezewang all the errors that I mentioned above are resolved. To have apex successfully installed, I have also modified

  1. /anaconda3/lib/site-packages/torch/include/torch/csrc/jit/api/module.h (474, 487, 501, 514) from static constexpr to static const

  2. /anaconda3/lib/site-packages/torch/include/pybind11/cast.h (1449) from explicit operator type&() { return *(this->value); } to explicit operator type&() { return *((type*)(this->value)); } to get it working.

Because of the following errors that I got:

 /anaconda3/lib/site-packages/torch/include\torch/csrc/jit/api/module.h(474): error: member "torch::jit::detail::ModulePolicy::all_slots" may not be initialized

 /anaconda3/lib/site-packages/torch/include\torch/csrc/jit/api/module.h(487): error: member "torch::jit::detail::ParameterPolicy::all_slots" may not be initialized

 /anaconda3/lib/site-packages/torch/include\torch/csrc/jit/api/module.h(501): error: member "torch::jit::detail::BufferPolicy::all_slots" may not be initialized

 /anaconda3/lib/site-packages/torch/include\torch/csrc/jit/api/module.h(514): error: member "torch::jit::detail::AttributePolicy::all_slots" may not be initialized

 \anaconda3\lib\site-packages\torch\include\pybind11\cast.h(1449): error: expression must be a pointer to a complete object type

Now it is working. Again, thank you for working it out.

@kezewang
Copy link

Dear @billpun
you are very welcome! Have a nice day!

@billpun
Copy link

billpun commented Jun 23, 2020

For completeness, let me write down my steps to get apex working:

  1. install pytorch 1.5.0 on windows (I did not compile it from source)

  2. install VS 2019 community

  3. clone from https://github.com/kezewang/apex

  4. modify setup.py (104) to version_dependent_macros = version_ge_1_1 + version_ge_1_3 + version_ge_1_5 + ['-D_ENABLE_EXTENDED_ALIGNED_STORAGE']

  5. Follow the post above to modify module.h and cast.h

  6. run the following commands in cmd (copied from pytorch)

    set CMAKE_GENERATOR=Visual Studio 16 2019
    set CMAKE_GENERATOR_TOOLSET_VERSION=14.26
    set DISTUTILS_USE_SDK=1
    for /f "usebackq tokens=*" %i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 16 -products * -latest -property installationPath`) do call "%i\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=%CMAKE_GENERATOR_TOOLSET_VERSION%

    set CUDAHOSTCXX=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\Hostx64\x64\cl.exe
    set USE_NINJA=OFF

    pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" .

@kex243
Copy link
Author

kex243 commented Jun 23, 2020

probably it is my some local error. Strange part is that ubuntu 18 shows same result.

@kex243 kex243 closed this as completed Jun 23, 2020
@stelmath
Copy link

stelmath commented Jan 5, 2021

@billpun @kezewang Thank you guys!

@megapatato
Copy link

With PyTorch 1.7.1 the files @billpun mention (i.e. module.h and cast.h) no longer require changes; for me @kezewang 's branch compiled with only the environment & setup.py tweaks mentioned above.

@ushio20
Copy link

ushio20 commented Nov 9, 2021

With PyTorch 1.7.1 the files @billpun mention (i.e. module.h and cast.h) no longer require changes; for me @kezewang 's branch compiled with only the environment & setup.py tweaks mentioned above.

hello?I use the https://github.com/kezewang/apex,but I get the error while build apex,
LINK : fatal error LNK1181: 无法打开输入文件“C:\Users\Administrator\PycharmProjects\ObjectDetection\bezier_curve_text_spotting\apex-masters\build\temp.win-amd64-3.6\Release\csrc\flatten_unflatten.obj”
do you know how to solve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants