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

[Bug] MMOCR fails to install using MIM #2010

Open
2 tasks done
laclouis5 opened this issue Nov 10, 2023 · 3 comments
Open
2 tasks done

[Bug] MMOCR fails to install using MIM #2010

laclouis5 opened this issue Nov 10, 2023 · 3 comments
Assignees

Comments

@laclouis5
Copy link

laclouis5 commented Nov 10, 2023

Prerequisite

Task

I'm using the official example scripts/configs for the officially supported tasks/models/datasets.

Branch

main branch https://github.com/open-mmlab/mmocr

Environment

Linux 22.04 with NVIDIA card. Conda up to date, PyTorch installed through the official instructions (conda) with GPU support. I'm using Python 3.8 as suggested in the installation guide. gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04).

Reproduces the problem - code sample

The error occurs during the installation process.

Reproduces the problem - command or script

I'm just trying to install MMOCR using the official installation using MIM:

conda create --name openmmlab python=3.8 -y
conda activate openmmlab
conda install pytorch torchvision -c pytorch

pip install -U openmim
mim install mmengine
mim install mmcv
mim install mmdet

mim install mmocr

Reproduces the problem - error message

The installation of MMOCR fails with the message (truncated):

7ldomlqt/mmcv_de92dafe04b1455ea303e20579a204b2/mmcv/ops/csrc/common/pytorch_cpp_helper.hpp:3,
                       from ./mmcv/ops/csrc/pytorch/active_rotated_filter.cpp:5:
      /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/ATen/core/boxing/impl/boxing.h: In static member function ‘static Result c10::impl::BoxedKernelWrapper<Result(Args ...), typename std::enable_if<((c10::guts::conjunction<c10::guts::disjunction<std::is_constructible<c10::IValue, typename std::decay<Args>::type>, std::is_same<c10::TensorOptions, typename std::decay<Args>::type> >...>::value && c10::guts::conjunction<c10::guts::disjunction<c10::impl::has_ivalue_to<T, void>, std::is_same<void, T> >, c10::guts::negation<std::is_lvalue_reference<_Tp> > >::value) && (! c10::impl::is_tuple_of_mutable_tensor_refs<Result>::value)), void>::type>::call(const c10::BoxedKernel&, const c10::OperatorHandle&, c10::DispatchKeySet, Args ...)’:
      /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/ATen/core/boxing/impl/boxing.h:229:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’
        229 |     if constexpr (!std::is_same_v<void, Result>) {
            |        ^~~~~~~~~
      /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/ATen/core/boxing/impl/boxing.h:229:25: error: ‘is_same_v’ is not a member of ‘std’; did you mean ‘is_same’?
        229 |     if constexpr (!std::is_same_v<void, Result>) {
            |                         ^~~~~~~~~
            |                         is_same
      /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/ATen/core/boxing/impl/boxing.h:229:35: error: expected primary-expression before ‘void’
        229 |     if constexpr (!std::is_same_v<void, Result>) {
            |                                   ^~~~
      /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/ATen/core/boxing/impl/boxing.h:229:34: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
        229 |     if constexpr (!std::is_same_v<void, Result>) {
            |                                  ^
      /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/ATen/core/boxing/impl/boxing.h:229:35: error: expected ‘)’ before ‘void’
        229 |     if constexpr (!std::is_same_v<void, Result>) {
            |                                   ^~~~
      /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/ATen/core/boxing/impl/boxing.h:229:18: note: to match this ‘(’
        229 |     if constexpr (!std::is_same_v<void, Result>) {
            |                  ^
      In file included from /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/ATen/core/boxing/KernelFunction_impl.h:2,
                       from /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/ATen/core/boxing/KernelFunction.h:251,
                       from /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/ATen/core/dispatch/Dispatcher.h:4,
                       from /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/types.h:12,
                       from /tmp/pip-install-7ldomlqt/mmcv_de92dafe04b1455ea303e20579a204b2/mmcv/ops/csrc/common/pytorch_cpp_helper.hpp:3,
                       from ./mmcv/ops/csrc/pytorch/active_rotated_filter.cpp:5:
      /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h: In constructor ‘c10::impl::assert_is_valid_input_type<T, AllowDeprecatedTypes, Enable>::assert_is_valid_input_type()’:
      /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h:109:10: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’
        109 |       if constexpr (guts::typelist::contains<supported_primitive_arg_types, T>::value) {
            |          ^~~~~~~~~
      In file included from /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/ATen/core/boxing/KernelFunction_impl.h:2,
                       from /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/ATen/core/boxing/KernelFunction.h:251,
                       from /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/ATen/core/dispatch/Dispatcher.h:4,
                       from /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/types.h:12,
                       from /tmp/pip-install-7ldomlqt/mmcv_de92dafe04b1455ea303e20579a204b2/mmcv/ops/csrc/common/pytorch_cpp_helper.hpp:3,
                       from ./mmcv/ops/csrc/pytorch/active_rotated_filter.cpp:5:
      /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h: In constructor ‘c10::impl::assert_is_valid_output_type<T, AllowDeprecatedTypes, Enable>::assert_is_valid_output_type()’:
      /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h:215:10: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’
        215 |       if constexpr(guts::typelist::contains<supported_primitive_arg_types, T>::value) {
            |          ^~~~~~~~~
      /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h: In static member function ‘static void c10::impl::make_boxed_from_unboxed_functor<KernelFunctor, AllowDeprecatedTypes>::call(c10::OperatorKernel*, const c10::OperatorHandle&, c10::DispatchKeySet, c10::Stack*)’:
      /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h:575:10: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’
        575 |       if constexpr (has_outputs) {
            |          ^~~~~~~~~
      In file included from /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/types.h:12,
                       from /tmp/pip-install-7ldomlqt/mmcv_de92dafe04b1455ea303e20579a204b2/mmcv/ops/csrc/common/pytorch_cpp_helper.hpp:3,
                       from ./mmcv/ops/csrc/pytorch/active_rotated_filter.cpp:5:
      /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/ATen/core/dispatch/Dispatcher.h: In static member function ‘static Return c10::Dispatcher::callWithDispatchKeySlowPath(const c10::TypedOperatorHandle<Return(Args ...)>&, at::StepCallbacks&, c10::DispatchKeySet, const c10::KernelFunction&, Args ...)’:
      /home/louis/miniconda3/envs/openmmlab/lib/python3.8/site-packages/torch/include/ATen/core/dispatch/Dispatcher.h:597:6: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’
        597 |   if constexpr (num_boxed_args != 0) {
            |      ^~~~~~~~~
      error: command '/usr/bin/gcc' 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

I tried a lot of alternatives, including installing MMOCR from source (using the git repo official installation). This fails with version constrains not being met (MMDET not compatible with MMOCR). If I try to install the correct version I face the same wheel compilation issue as presented above.

I tried in another computer running macOS and I also face issues that I cannot solve during installation (linker symbols missing, etc.).

To be honest, I wonder how the current installation guide of MMOCR could work reliably since it uses 3 different tools to manage dependencies and virtual environments (conda, pip, mim) and relies on external dependencies (gcc I think). Moreover, there is no dependency contrain anywhere in the installation guide (mmcv, model, etc.) while we know for sure that there is a lot of contrains in MMOCR and other MM tools given the amount of error messages about wrong dependencies.

Would it be possible to clarify how to install MMOCR and give a comprehensive guide in order to be able to install this tool reliably?

@jbesq-ml
Copy link

Any movement on this issue? I am having the same issue.

@zhouzaida
Copy link
Member

Hi, what is your pytorch and cuda version? It seems like the pre-built mmcv has not been found so it build it from source.

@jbesq-ml
Copy link

Hi, I just realized that "https://mmocr.readthedocs.io/en/dev-1.x/get_started/install.html" produces the above errors and the installation in the readme works well. No issues.

Thanks!

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

4 participants