open-mmlab / mmcv

OpenMMLab Computer Vision Foundation
https://mmcv.readthedocs.io/en/latest/
Apache License 2.0
5.91k stars 1.65k forks source link

[Bug] Unable to install mmcv on macOS 14.3.1 #3033

Closed nfazekas closed 9 months ago

nfazekas commented 9 months ago

Prerequisite

Environment

The following commands were executed before:

conda install pytorch torchvision cpuonly -c pytorch
pip install -U openmim
mim install mmengine

I was able to install mmcv-lite, but I need mmcv for mmdet.

python -c "from mmcv.utils import collect_env; print(collect_env())" OrderedDict([('sys.platform', 'darwin'), ('Python', '3.10.13 (main, Sep 11 2023, 08:39:02) [Clang 14.0.6 ]'), ('CUDA available', False), ('MUSA available', False), ('numpy_random_seed', 2147483648), ('GCC', 'Apple clang version 15.0.0 (clang-1500.1.0.2.5)'), ('PyTorch', '2.2.1'), ('PyTorch compiling details', 'PyTorch built with:\n - GCC 4.2\n - C++ Version: 201703\n - clang 13.1.6\n - Intel(R) oneAPI Math Kernel Library Version 2023.1-Product Build 20230303 for Intel(R) 64 architecture applications\n - Intel(R) MKL-DNN v3.3.2 (Git Hash 2dc95a2ad0841e29db8b22fbccaf3e5da7992b01)\n - OpenMP 201811\n - LAPACK is enabled (usually provided by MKL)\n - NNPACK is enabled\n - CPU capability usage: AVX2\n - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CXX_COMPILER=/Applications/Xcode_13.3.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++, CXX_FLAGS= -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DLIBKINETO_NOROCTRACER -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_PYTORCH_METAL_EXPORT -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DUSE_COREML_DELEGATE -O2 -fPIC -Wall -Wextra -Werror=return-type -Werror=non-virtual-dtor -Werror=braced-scalar-init -Werror=range-loop-construct -Werror=bool-operation -Wnarrowing -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wvla-extension -Wsuggest-override -Wnewline-eof -Winconsistent-missing-override -Winconsistent-missing-destructor-override -Wno-pass-failed -Wno-error=pedantic -Wno-error=old-style-cast -Wno-error=inconsistent-missing-override -Wno-error=inconsistent-missing-destructor-override -Wconstant-conversion -Wno-invalid-partial-specialization -Wno-missing-braces -Qunused-arguments -fcolor-diagnostics -faligned-new -Wno-unused-but-set-variable -fno-math-errno -fno-trapping-math -Werror=format -DUSE_MPS -Wno-unused-private-field -Wno-missing-braces, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=2.2.1, USE_CUDA=0, USE_CUDNN=OFF, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=OFF, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF, USE_ROCM_KERNEL_ASSERT=OFF, \n'), ('TorchVision', '0.17.1'), ('OpenCV', '4.9.0'), ('MMEngine', '0.10.3'), ('MMCV', '2.1.0'), ('MMCV Compiler', 'n/a'), ('MMCV CUDA Compiler', 'n/a')])

Reproduces the problem - code sample

Reproduces the problem - command or script

mim install mmcv

Reproduces the problem - error message

/Users/norbert.fazekas/miniconda/envs/mmdetection3d-main/lib/python3.10/site-packages/torch/include/c10/util/OptionalArrayRef.h:155:34: error: 'value' is unavailable: introduced in macOS 10.13
          return wrapped_opt_array_ref.value();
                                       ^
      /Users/norbert.fazekas/miniconda/envs/mmdetection3d-main/lib/python3.10/site-packages/torch/include/ATen/WrapDimUtilsMulti.h:26:26: note: in instantiation of member function 'c10::OptionalArrayRef<long long>::value' requested here
          auto dims = opt_dims.value();
                               ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/optional:1001:27: note: 'value' has been explicitly marked unavailable here
          constexpr value_type& value() &
                                ^
      fatal error: too many errors emitted, stopping now [-ferror-limit=]
      20 errors generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for mmcv
  Running setup.py clean for mmcv
Failed to build mmcv
ERROR: Could not build wheels for mmcv, which is required to install pyproject.toml-based projects

Additional information

No response

nfazekas commented 9 months ago

I solved it using an older version of pytorch. (pip install torch==2.0.0 torchvision==0.15.1)