NVIDIA / NVIDIA/apex

Error with install apex

Open
#808 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
9k
Forks
1.5k
Avg merge
2d 4h
Merged PRs (30d)
3

Description

I get this error installing with“python setup.py install --user --cuda_ext --cpp_ext”. Please advise! Thank you!

torch.version = 1.3.1
running install
running bdist_egg
running egg_info
creating apex.egg-info
writing apex.egg-info/PKG-INFO
writing dependency_links to apex.egg-info/dependency_links.txt
writing top-level names to apex.egg-info/top_level.txt
writing manifest file 'apex.egg-info/SOURCES.txt'
reading manifest file 'apex.egg-info/SOURCES.txt'
writing manifest file 'apex.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/apex
copying apex/init.py -> build/lib.linux-x86_64-3.6/apex
creating build/lib.linux-x86_64-3.6/apex/parallel
copying apex/parallel/optimized_sync_batchnorm_kernel.py -> build/lib.linux-x86_64-3.6/apex/parallel
copying apex/parallel/sync_batchnorm_kernel.py -> build/lib.linux-x86_64-3.6/apex/parallel
copying apex/parallel/sync_batchnorm.py -> build/lib.linux-x86_64-3.6/apex/parallel
copying apex/parallel/LARC.py -> build/lib.linux-x86_64-3.6/apex/parallel
copying apex/parallel/init.py -> build/lib.linux-x86_64-3.6/apex/parallel
copying apex/parallel/multiproc.py -> build/lib.linux-x86_64-3.6/apex/parallel
copying apex/parallel/distributed.py -> build/lib.linux-x86_64-3.6/apex/parallel
copying apex/parallel/optimized_sync_batchnorm.py -> build/lib.linux-x86_64-3.6/apex/parallel
creating build/lib.linux-x86_64-3.6/apex/normalization
copying apex/normalization/init.py -> build/lib.linux-x86_64-3.6/apex/normalization
copying apex/normalization/fused_layer_norm.py -> build/lib.linux-x86_64-3.6/apex/normalization
creating build/lib.linux-x86_64-3.6/apex/RNN
copying apex/RNN/RNNBackend.py -> build/lib.linux-x86_64-3.6/apex/RNN
copying apex/RNN/models.py -> build/lib.linux-x86_64-3.6/apex/RNN
copying apex/RNN/init.py -> build/lib.linux-x86_64-3.6/apex/RNN
copying apex/RNN/cells.py -> build/lib.linux-x86_64-3.6/apex/RNN
creating build/lib.linux-x86_64-3.6/apex/optimizers
copying apex/optimizers/fused_adam.py -> build/lib.linux-x86_64-3.6/apex/optimizers
copying apex/optimizers/fp16_optimizer.py -> build/lib.linux-x86_64-3.6/apex/optimizers
copying apex/optimizers/init.py -> build/lib.linux-x86_64-3.6/apex/optimizers
creating build/lib.linux-x86_64-3.6/apex/fp16_utils
copying apex/fp16_utils/fp16_optimizer.py -> build/lib.linux-x86_64-3.6/apex/fp16_utils
copying apex/fp16_utils/loss_scaler.py -> build/lib.linux-x86_64-3.6/apex/fp16_utils
copying apex/fp16_utils/init.py -> build/lib.linux-x86_64-3.6/apex/fp16_utils
copying apex/fp16_utils/fp16util.py -> build/lib.linux-x86_64-3.6/apex/fp16_utils
creating build/lib.linux-x86_64-3.6/apex/reparameterization
copying apex/reparameterization/reparameterization.py -> build/lib.linux-x86_64-3.6/apex/reparameterization
copying apex/reparameterization/weight_norm.py -> build/lib.linux-x86_64-3.6/apex/reparameterization
copying apex/reparameterization/init.py -> build/lib.linux-x86_64-3.6/apex/reparameterization
creating build/lib.linux-x86_64-3.6/apex/amp
copying apex/amp/rnn_compat.py -> build/lib.linux-x86_64-3.6/apex/amp
copying apex/amp/version.py -> build/lib.linux-x86_64-3.6/apex/amp
copying apex/amp/utils.py -> build/lib.linux-x86_64-3.6/apex/amp
copying apex/amp/scaler.py -> build/lib.linux-x86_64-3.6/apex/amp
copying apex/amp/handle.py -> build/lib.linux-x86_64-3.6/apex/amp
copying apex/amp/wrap.py -> build/lib.linux-x86_64-3.6/apex/amp
copying apex/amp/opt.py -> build/lib.linux-x86_64-3.6/apex/amp
copying apex/amp/init.py -> build/lib.linux-x86_64-3.6/apex/amp
copying apex/amp/compat.py -> build/lib.linux-x86_64-3.6/apex/amp
copying apex/amp/amp.py -> build/lib.linux-x86_64-3.6/apex/amp
creating build/lib.linux-x86_64-3.6/apex/amp/lists
copying apex/amp/lists/functional_overrides.py -> build/lib.linux-x86_64-3.6/apex/amp/lists
copying apex/amp/lists/torch_overrides.py -> build/lib.linux-x86_64-3.6/apex/amp/lists
copying apex/amp/lists/tensor_overrides.py -> build/lib.linux-x86_64-3.6/apex/amp/lists
copying apex/amp/lists/init.py -> build/lib.linux-x86_64-3.6/apex/amp/lists
running build_ext
building 'apex_C' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/csrc
gcc -pthread -B /home/czn/anaconda3/envs/layoutlm/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include -I/home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/TH -I/home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/THC -I/home/czn/anaconda3/envs/layoutlm/include/python3.6m -c csrc/flatten_unflatten.cpp -o build/temp.linux-x86_64-3.6/csrc/flatten_unflatten.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=apex_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11

cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
g++ -pthread -shared -B /home/czn/anaconda3/envs/layoutlm/compiler_compat -L/home/czn/anaconda3/envs/layoutlm/lib -Wl,-rpath=/home/czn/anaconda3/envs/layoutlm/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/csrc/flatten_unflatten.o -o build/lib.linux-x86_64-3.6/apex_C.cpython-36m-x86_64-linux-gnu.so
building 'amp_C' extension
gcc -pthread -B /home/czn/anaconda3/envs/layoutlm/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include -I/home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/TH -I/home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/THC -I/home/czn/cuda-10.0/include -I/home/czn/anaconda3/envs/layoutlm/include/python3.6m -c csrc/scale_check_overflow.cpp -o build/temp.linux-x86_64-3.6/csrc/scale_check_overflow.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=amp_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++

In file included from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/c10/core/Device.h:5:0,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/c10/core/Allocator.h:6,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/ATen/ATen.h:3,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/extension.h:4,
from csrc/scale_check_overflow.cpp:1:
csrc/scale_check_overflow.cpp: In function ‘void scale_check_overflow(at::Tensor, float, at::Tensor, at::Tensor)’:
/home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/c10/util/Exception.h:350:20: warning: ‘void c10::detail::deprecated_AT_CHECK()’ is deprecated [-Wdeprecated-declarations]
::c10::detail::deprecated_AT_CHECK();
^
csrc/scale_check_overflow.cpp:14:3: note: in expansion of macro ‘AT_CHECK’
AT_CHECK(grads.type().is_cuda(), "grads must be a CUDA tensor");
^

In file included from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/c10/core/Device.h:5:0,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/c10/core/Allocator.h:6,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/ATen/ATen.h:3,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/extension.h:4,
from csrc/scale_check_overflow.cpp:1:
/home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/c10/util/Exception.h:325:13: note: declared here
inline void deprecated_AT_CHECK() {}
^~~~~~~~~~~~~~~~~~~
……
In file included from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/c10/core/Device.h:5:0,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/c10/core/Allocator.h:6,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/ATen/ATen.h:3,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
from /home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/torch/extension.h:4,
from csrc/scale_check_overflow.cpp:1:
/home/czn/anaconda3/envs/layoutlm/lib/python3.6/site-packages/torch/include/c10/util/Exception.h:349:3: error: expected ‘;’ before ‘do’
do {
^
error: command 'gcc' failed with exit status 1

my python and pytorch version:
Python 3.6.10 |Anaconda, Inc.| (default, Mar 25 2020, 23:51:54) '1.3.1'

my nvcc --version:
Cuda compilation tools, release 10.0, V10.0.130

my gcc --version:
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The report uses setup.py with --cuda_ext and --cpp_ext and reaches csrc/scale_check_overflow.cpp, but the compiler output is truncated. Start by reproducing the command and capturing the complete build error, then inspect the reported source and installation configuration. Done means the extension builds and the Apex install completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
build-system, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.