Project-MONAI / MONAI

AI Toolkit for Healthcare Imaging
https://monai.io/
Apache License 2.0
5.88k stars 1.09k forks source link

Building MONAI from source fails on Ubuntu 20.04.1 #1027

Closed ad12 closed 4 years ago

ad12 commented 4 years ago

Describe the bug Building wheels for MONAI, which uses PEP 517, fails.

To Reproduce

pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI

Expected behavior A clear and concise description of what you expected to happen.

Environment (please complete the following information):

**Relevant Conda/Pip packages***

pip                       20.2.2                   py37_0  
wheel                     0.35.1                     py_0  

Error Message

ERROR: Command errored out with exit status 1:
   command: /miniconda3/envs/mtr_env/bin/python /miniconda3/envs/mtr_env/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp1873hwq5
       cwd: /tmp/pip-install-soyjh8vt/monai
  Complete output (256 lines):
  setup.py with torch 1.6.0
  BUILD_MONAI_CPP=True, BUILD_MONAI_CUDA=True
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.7
  creating build/lib.linux-x86_64-3.7/monai
  copying monai/_version.py -> build/lib.linux-x86_64-3.7/monai
  copying monai/__init__.py -> build/lib.linux-x86_64-3.7/monai
  creating build/lib.linux-x86_64-3.7/monai/handlers
  copying monai/handlers/classification_saver.py -> build/lib.linux-x86_64-3.7/monai/handlers
  copying monai/handlers/validation_handler.py -> build/lib.linux-x86_64-3.7/monai/handlers
  copying monai/handlers/mean_dice.py -> build/lib.linux-x86_64-3.7/monai/handlers
  copying monai/handlers/checkpoint_loader.py -> build/lib.linux-x86_64-3.7/monai/handlers
  copying monai/handlers/lr_schedule_handler.py -> build/lib.linux-x86_64-3.7/monai/handlers
  copying monai/handlers/utils.py -> build/lib.linux-x86_64-3.7/monai/handlers
  copying monai/handlers/smartcache_handler.py -> build/lib.linux-x86_64-3.7/monai/handlers
  copying monai/handlers/metric_logger.py -> build/lib.linux-x86_64-3.7/monai/handlers
  copying monai/handlers/segmentation_saver.py -> build/lib.linux-x86_64-3.7/monai/handlers
  copying monai/handlers/stats_handler.py -> build/lib.linux-x86_64-3.7/monai/handlers
  copying monai/handlers/roc_auc.py -> build/lib.linux-x86_64-3.7/monai/handlers
  copying monai/handlers/__init__.py -> build/lib.linux-x86_64-3.7/monai/handlers
  copying monai/handlers/tensorboard_handlers.py -> build/lib.linux-x86_64-3.7/monai/handlers
  copying monai/handlers/checkpoint_saver.py -> build/lib.linux-x86_64-3.7/monai/handlers
  creating build/lib.linux-x86_64-3.7/monai/config
  copying monai/config/deviceconfig.py -> build/lib.linux-x86_64-3.7/monai/config
  copying monai/config/__init__.py -> build/lib.linux-x86_64-3.7/monai/config
  copying monai/config/type_definitions.py -> build/lib.linux-x86_64-3.7/monai/config
  creating build/lib.linux-x86_64-3.7/monai/transforms
  copying monai/transforms/adaptors.py -> build/lib.linux-x86_64-3.7/monai/transforms
  copying monai/transforms/utils.py -> build/lib.linux-x86_64-3.7/monai/transforms
  copying monai/transforms/compose.py -> build/lib.linux-x86_64-3.7/monai/transforms
  copying monai/transforms/__init__.py -> build/lib.linux-x86_64-3.7/monai/transforms
  creating build/lib.linux-x86_64-3.7/monai/inferers
  copying monai/inferers/utils.py -> build/lib.linux-x86_64-3.7/monai/inferers
  copying monai/inferers/inferer.py -> build/lib.linux-x86_64-3.7/monai/inferers
  copying monai/inferers/__init__.py -> build/lib.linux-x86_64-3.7/monai/inferers
  creating build/lib.linux-x86_64-3.7/monai/networks
  copying monai/networks/utils.py -> build/lib.linux-x86_64-3.7/monai/networks
  copying monai/networks/__init__.py -> build/lib.linux-x86_64-3.7/monai/networks
  creating build/lib.linux-x86_64-3.7/monai/visualize
  copying monai/visualize/img2tensorboard.py -> build/lib.linux-x86_64-3.7/monai/visualize
  copying monai/visualize/__init__.py -> build/lib.linux-x86_64-3.7/monai/visualize
  creating build/lib.linux-x86_64-3.7/monai/utils
  copying monai/utils/module.py -> build/lib.linux-x86_64-3.7/monai/utils
  copying monai/utils/enums.py -> build/lib.linux-x86_64-3.7/monai/utils
  copying monai/utils/aliases.py -> build/lib.linux-x86_64-3.7/monai/utils
  copying monai/utils/decorators.py -> build/lib.linux-x86_64-3.7/monai/utils
  copying monai/utils/__init__.py -> build/lib.linux-x86_64-3.7/monai/utils
  copying monai/utils/misc.py -> build/lib.linux-x86_64-3.7/monai/utils
  creating build/lib.linux-x86_64-3.7/monai/engines
  copying monai/engines/utils.py -> build/lib.linux-x86_64-3.7/monai/engines
  copying monai/engines/trainer.py -> build/lib.linux-x86_64-3.7/monai/engines
  copying monai/engines/multi_gpu_supervised_trainer.py -> build/lib.linux-x86_64-3.7/monai/engines
  copying monai/engines/workflow.py -> build/lib.linux-x86_64-3.7/monai/engines
  copying monai/engines/__init__.py -> build/lib.linux-x86_64-3.7/monai/engines
  copying monai/engines/evaluator.py -> build/lib.linux-x86_64-3.7/monai/engines
  creating build/lib.linux-x86_64-3.7/monai/apps
  copying monai/apps/utils.py -> build/lib.linux-x86_64-3.7/monai/apps
  copying monai/apps/datasets.py -> build/lib.linux-x86_64-3.7/monai/apps
  copying monai/apps/__init__.py -> build/lib.linux-x86_64-3.7/monai/apps
  creating build/lib.linux-x86_64-3.7/monai/losses
  copying monai/losses/focal_loss.py -> build/lib.linux-x86_64-3.7/monai/losses
  copying monai/losses/dice.py -> build/lib.linux-x86_64-3.7/monai/losses
  copying monai/losses/tversky.py -> build/lib.linux-x86_64-3.7/monai/losses
  copying monai/losses/__init__.py -> build/lib.linux-x86_64-3.7/monai/losses
  creating build/lib.linux-x86_64-3.7/monai/data
  copying monai/data/grid_dataset.py -> build/lib.linux-x86_64-3.7/monai/data
  copying monai/data/csv_saver.py -> build/lib.linux-x86_64-3.7/monai/data
  copying monai/data/nifti_saver.py -> build/lib.linux-x86_64-3.7/monai/data
  copying monai/data/nifti_writer.py -> build/lib.linux-x86_64-3.7/monai/data
  copying monai/data/nifti_reader.py -> build/lib.linux-x86_64-3.7/monai/data
  copying monai/data/utils.py -> build/lib.linux-x86_64-3.7/monai/data
  copying monai/data/png_writer.py -> build/lib.linux-x86_64-3.7/monai/data
  copying monai/data/image_reader.py -> build/lib.linux-x86_64-3.7/monai/data
  copying monai/data/synthetic.py -> build/lib.linux-x86_64-3.7/monai/data
  copying monai/data/png_saver.py -> build/lib.linux-x86_64-3.7/monai/data
  copying monai/data/dataloader.py -> build/lib.linux-x86_64-3.7/monai/data
  copying monai/data/decathlon_datalist.py -> build/lib.linux-x86_64-3.7/monai/data
  copying monai/data/__init__.py -> build/lib.linux-x86_64-3.7/monai/data
  copying monai/data/dataset.py -> build/lib.linux-x86_64-3.7/monai/data
  creating build/lib.linux-x86_64-3.7/monai/metrics
  copying monai/metrics/meandice.py -> build/lib.linux-x86_64-3.7/monai/metrics
  copying monai/metrics/rocauc.py -> build/lib.linux-x86_64-3.7/monai/metrics
  copying monai/metrics/confusion_matrix_utils.py -> build/lib.linux-x86_64-3.7/monai/metrics
  copying monai/metrics/__init__.py -> build/lib.linux-x86_64-3.7/monai/metrics
  copying monai/metrics/confusion_matrix.py -> build/lib.linux-x86_64-3.7/monai/metrics
  creating build/lib.linux-x86_64-3.7/monai/transforms/io
  copying monai/transforms/io/array.py -> build/lib.linux-x86_64-3.7/monai/transforms/io
  copying monai/transforms/io/dictionary.py -> build/lib.linux-x86_64-3.7/monai/transforms/io
  copying monai/transforms/io/__init__.py -> build/lib.linux-x86_64-3.7/monai/transforms/io
  creating build/lib.linux-x86_64-3.7/monai/transforms/croppad
  copying monai/transforms/croppad/array.py -> build/lib.linux-x86_64-3.7/monai/transforms/croppad
  copying monai/transforms/croppad/dictionary.py -> build/lib.linux-x86_64-3.7/monai/transforms/croppad
  copying monai/transforms/croppad/__init__.py -> build/lib.linux-x86_64-3.7/monai/transforms/croppad
  creating build/lib.linux-x86_64-3.7/monai/transforms/post
  copying monai/transforms/post/array.py -> build/lib.linux-x86_64-3.7/monai/transforms/post
  copying monai/transforms/post/dictionary.py -> build/lib.linux-x86_64-3.7/monai/transforms/post
  copying monai/transforms/post/__init__.py -> build/lib.linux-x86_64-3.7/monai/transforms/post
  creating build/lib.linux-x86_64-3.7/monai/transforms/utility
  copying monai/transforms/utility/array.py -> build/lib.linux-x86_64-3.7/monai/transforms/utility
  copying monai/transforms/utility/dictionary.py -> build/lib.linux-x86_64-3.7/monai/transforms/utility
  copying monai/transforms/utility/__init__.py -> build/lib.linux-x86_64-3.7/monai/transforms/utility
  creating build/lib.linux-x86_64-3.7/monai/transforms/intensity
  copying monai/transforms/intensity/array.py -> build/lib.linux-x86_64-3.7/monai/transforms/intensity
  copying monai/transforms/intensity/dictionary.py -> build/lib.linux-x86_64-3.7/monai/transforms/intensity
  copying monai/transforms/intensity/__init__.py -> build/lib.linux-x86_64-3.7/monai/transforms/intensity
  creating build/lib.linux-x86_64-3.7/monai/transforms/spatial
  copying monai/transforms/spatial/array.py -> build/lib.linux-x86_64-3.7/monai/transforms/spatial
  copying monai/transforms/spatial/dictionary.py -> build/lib.linux-x86_64-3.7/monai/transforms/spatial
  copying monai/transforms/spatial/__init__.py -> build/lib.linux-x86_64-3.7/monai/transforms/spatial
  creating build/lib.linux-x86_64-3.7/monai/networks/nets
  copying monai/networks/nets/generator.py -> build/lib.linux-x86_64-3.7/monai/networks/nets
  copying monai/networks/nets/densenet.py -> build/lib.linux-x86_64-3.7/monai/networks/nets
  copying monai/networks/nets/highresnet.py -> build/lib.linux-x86_64-3.7/monai/networks/nets
  copying monai/networks/nets/vnet.py -> build/lib.linux-x86_64-3.7/monai/networks/nets
  copying monai/networks/nets/senet.py -> build/lib.linux-x86_64-3.7/monai/networks/nets
  copying monai/networks/nets/nnunet.py -> build/lib.linux-x86_64-3.7/monai/networks/nets
  copying monai/networks/nets/classifier.py -> build/lib.linux-x86_64-3.7/monai/networks/nets
  copying monai/networks/nets/segresnet.py -> build/lib.linux-x86_64-3.7/monai/networks/nets
  copying monai/networks/nets/regressor.py -> build/lib.linux-x86_64-3.7/monai/networks/nets
  copying monai/networks/nets/ahnet.py -> build/lib.linux-x86_64-3.7/monai/networks/nets
  copying monai/networks/nets/__init__.py -> build/lib.linux-x86_64-3.7/monai/networks/nets
  copying monai/networks/nets/unet.py -> build/lib.linux-x86_64-3.7/monai/networks/nets
  creating build/lib.linux-x86_64-3.7/monai/networks/blocks
  copying monai/networks/blocks/segresnet_block.py -> build/lib.linux-x86_64-3.7/monai/networks/blocks
  copying monai/networks/blocks/nnunet_block.py -> build/lib.linux-x86_64-3.7/monai/networks/blocks
  copying monai/networks/blocks/fcn.py -> build/lib.linux-x86_64-3.7/monai/networks/blocks
  copying monai/networks/blocks/upsample.py -> build/lib.linux-x86_64-3.7/monai/networks/blocks
  copying monai/networks/blocks/squeeze_and_excitation.py -> build/lib.linux-x86_64-3.7/monai/networks/blocks
  copying monai/networks/blocks/downsample.py -> build/lib.linux-x86_64-3.7/monai/networks/blocks
  copying monai/networks/blocks/aspp.py -> build/lib.linux-x86_64-3.7/monai/networks/blocks
  copying monai/networks/blocks/convolutions.py -> build/lib.linux-x86_64-3.7/monai/networks/blocks
  copying monai/networks/blocks/__init__.py -> build/lib.linux-x86_64-3.7/monai/networks/blocks
  creating build/lib.linux-x86_64-3.7/monai/networks/layers
  copying monai/networks/layers/simplelayers.py -> build/lib.linux-x86_64-3.7/monai/networks/layers
  copying monai/networks/layers/spatial_transforms.py -> build/lib.linux-x86_64-3.7/monai/networks/layers
  copying monai/networks/layers/__init__.py -> build/lib.linux-x86_64-3.7/monai/networks/layers
  copying monai/networks/layers/factories.py -> build/lib.linux-x86_64-3.7/monai/networks/layers
  copying monai/networks/layers/convutils.py -> build/lib.linux-x86_64-3.7/monai/networks/layers
  copying monai/py.typed -> build/lib.linux-x86_64-3.7/monai
  UPDATING build/lib.linux-x86_64-3.7/monai/_version.py
  set build/lib.linux-x86_64-3.7/monai/_version.py to '0.2.0+156.ge6ac8bf'
  running build_ext
  building 'monai._C' extension
  creating /tmp/pip-install-soyjh8vt/monai/build/temp.linux-x86_64-3.7
  creating /tmp/pip-install-soyjh8vt/monai/build/temp.linux-x86_64-3.7/tmp
  creating /tmp/pip-install-soyjh8vt/monai/build/temp.linux-x86_64-3.7/tmp/pip-install-soyjh8vt
  creating /tmp/pip-install-soyjh8vt/monai/build/temp.linux-x86_64-3.7/tmp/pip-install-soyjh8vt/monai
  creating /tmp/pip-install-soyjh8vt/monai/build/temp.linux-x86_64-3.7/tmp/pip-install-soyjh8vt/monai/monai
  creating /tmp/pip-install-soyjh8vt/monai/build/temp.linux-x86_64-3.7/tmp/pip-install-soyjh8vt/monai/monai/csrc
  creating /tmp/pip-install-soyjh8vt/monai/build/temp.linux-x86_64-3.7/tmp/pip-install-soyjh8vt/monai/monai/csrc/lltm
  Emitting ninja build file /tmp/pip-install-soyjh8vt/monai/build/temp.linux-x86_64-3.7/build.ninja...
  Compiling objects...
  Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
  [1/3] /usr/local/cuda/bin/nvcc -DWITH_CUDA -I/tmp/pip-install-soyjh8vt/monai/monai/csrc -I/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include -I/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/TH -I/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/include -I/miniconda3/envs/mtr_env/include/python3.7m -c -c /tmp/pip-install-soyjh8vt/monai/monai/csrc/lltm/lltm_cuda.cu -o /tmp/pip-install-soyjh8vt/monai/build/temp.linux-x86_64-3.7/tmp/pip-install-soyjh8vt/monai/monai/csrc/lltm/lltm_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=sm_75 -std=c++14
  FAILED: /tmp/pip-install-soyjh8vt/monai/build/temp.linux-x86_64-3.7/tmp/pip-install-soyjh8vt/monai/monai/csrc/lltm/lltm_cuda.o
  /usr/local/cuda/bin/nvcc -DWITH_CUDA -I/tmp/pip-install-soyjh8vt/monai/monai/csrc -I/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include -I/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/TH -I/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/include -I/miniconda3/envs/mtr_env/include/python3.7m -c -c /tmp/pip-install-soyjh8vt/monai/monai/csrc/lltm/lltm_cuda.cu -o /tmp/pip-install-soyjh8vt/monai/build/temp.linux-x86_64-3.7/tmp/pip-install-soyjh8vt/monai/monai/csrc/lltm/lltm_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=sm_75 -std=c++14
  In file included from /usr/local/cuda/include/cuda_runtime.h:83,
                   from <command-line>:
  /usr/local/cuda/include/crt/host_config.h:138:2: error: #error -- unsupported GNU version! gcc versions later than 8 are not supported!
    138 | #error -- unsupported GNU version! gcc versions later than 8 are not supported!
        |  ^~~~~
  [2/3] c++ -MMD -MF /tmp/pip-install-soyjh8vt/monai/build/temp.linux-x86_64-3.7/tmp/pip-install-soyjh8vt/monai/monai/csrc/lltm/lltm_cpu.o.d -pthread -B /miniconda3/envs/mtr_env/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/tmp/pip-install-soyjh8vt/monai/monai/csrc -I/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include -I/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/TH -I/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/include -I/miniconda3/envs/mtr_env/include/python3.7m -c -c /tmp/pip-install-soyjh8vt/monai/monai/csrc/lltm/lltm_cpu.cpp -o /tmp/pip-install-soyjh8vt/monai/build/temp.linux-x86_64-3.7/tmp/pip-install-soyjh8vt/monai/monai/csrc/lltm/lltm_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  In file included from /tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/ATen/Parallel.h:149,
                   from /tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/utils.h:3,
                   from /tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:5,
                   from /tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn.h:3,
                   from /tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/all.h:7,
                   from /tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/torch/extension.h:4,
                   from /tmp/pip-install-soyjh8vt/monai/monai/csrc/lltm/lltm_cpu.cpp:14:
  /tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/ATen/ParallelOpenMP.h:84: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
     84 | #pragma omp parallel for if ((end - begin) >= grain_size)
        |
  [3/3] c++ -MMD -MF /tmp/pip-install-soyjh8vt/monai/build/temp.linux-x86_64-3.7/tmp/pip-install-soyjh8vt/monai/monai/csrc/ext.o.d -pthread -B /miniconda3/envs/mtr_env/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/tmp/pip-install-soyjh8vt/monai/monai/csrc -I/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include -I/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/TH -I/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/include -I/miniconda3/envs/mtr_env/include/python3.7m -c -c /tmp/pip-install-soyjh8vt/monai/monai/csrc/ext.cpp -o /tmp/pip-install-soyjh8vt/monai/build/temp.linux-x86_64-3.7/tmp/pip-install-soyjh8vt/monai/monai/csrc/ext.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  In file included from /tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/ATen/Parallel.h:149,
                   from /tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/utils.h:3,
                   from /tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:5,
                   from /tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn.h:3,
                   from /tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/all.h:7,
                   from /tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/torch/extension.h:4,
                   from /tmp/pip-install-soyjh8vt/monai/monai/csrc/ext.cpp:14:
  /tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/include/ATen/ParallelOpenMP.h:84: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
     84 | #pragma omp parallel for if ((end - begin) >= grain_size)
        |
  ninja: build stopped: subcommand failed.
  Traceback (most recent call last):
    File "/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1515, in _run_ninja_build
      env=env)
    File "/miniconda3/envs/mtr_env/lib/python3.7/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 "/miniconda3/envs/mtr_env/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
      main()
    File "/miniconda3/envs/mtr_env/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/miniconda3/envs/mtr_env/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 205, in build_wheel
      metadata_directory)
    File "/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 217, in build_wheel
      wheel_directory, config_settings)
    File "/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 202, in _build_with_temp_dir
      self.run_setup()
    File "/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 254, in run_setup
      self).run_setup(setup_script=setup_script)
    File "/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 145, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 95, in <module>
      ext_modules=get_extensions(),
    File "/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "/miniconda3/envs/mtr_env/lib/python3.7/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/miniconda3/envs/mtr_env/lib/python3.7/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/miniconda3/envs/mtr_env/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 290, in run
      self.run_command('build')
    File "/miniconda3/envs/mtr_env/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/miniconda3/envs/mtr_env/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/miniconda3/envs/mtr_env/lib/python3.7/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/miniconda3/envs/mtr_env/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/miniconda3/envs/mtr_env/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 79, in run
      _build_ext.run(self)
    File "/miniconda3/envs/mtr_env/lib/python3.7/distutils/command/build_ext.py", line 340, in run
      self.build_extensions()
    File "/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 649, in build_extensions
      build_ext.build_extensions(self)
    File "/miniconda3/envs/mtr_env/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
      self._build_extensions_serial()
    File "/miniconda3/envs/mtr_env/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
      self.build_extension(ext)
    File "/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 196, in build_extension
      _build_ext.build_extension(self, ext)
    File "/miniconda3/envs/mtr_env/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
      depends=ext.depends)
    File "/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 478, in unix_wrap_ninja_compile
      with_cuda=with_cuda)
    File "/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1233, in _write_ninja_file_and_compile_objects
      error_prefix='Error compiling objects for extension')
    File "/tmp/pip-build-env-5d2h2p6j/overlay/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1529, in _run_ninja_build
      raise RuntimeError(message)
  RuntimeError: Error compiling objects for extension
  ----------------------------------------
  ERROR: Failed building wheel for MONAI
Failed to build MONAI
ERROR: Could not build wheels for MONAI which use PEP 517 and cannot be installed directly
Nic-Ma commented 4 years ago

Hi @ad12 ,

Thanks for your bug report. @wyli @IsaacYangSLA I think you guys are experts on the build system, could you please help take a quick look?

Thanks.

wyli commented 4 years ago

looks like the issue is "/usr/local/cuda/include/crt/host_config.h:138:2: error: #error -- unsupported GNU version! gcc versions later than 8 are not supported!"

Could you please try: SKIP_MONAI_BUILD=1 pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI this will skip the cpp/cuda extensions but still allows you to use most of the MONAI features

ad12 commented 4 years ago

Ah I see- thanks for the note. The command above did work.

Which specific features are disabled as a result of building without the cpp/cuda extensions? From what I can tell, standard torch cuda functionality (conv, etc.) is working fine. Also, is there a plan to support gcc>=8?

Thanks for your help!

juampatronics commented 4 years ago

Had the very same problem under Windows 10. It is not a bug in MONAI, but in PyTorch. The call to ninja is wrong. Should be ninja --version, instead of ninja -v