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

Failed to build lanms-neo while installing MMOCR #1263

Closed
arhamshah opened this issue Aug 5, 2022 · 9 comments
Closed

Failed to build lanms-neo while installing MMOCR #1263

arhamshah opened this issue Aug 5, 2022 · 9 comments
Assignees

Comments

@arhamshah
Copy link

I tried installing mmocr in every possible but I get this error stating that

ERROR: Failed building wheel for lanms-neo
Failed to build lanms-neo
ERROR: Could not build wheels for lanms-neo, which is required to install pyproject.toml-based projects

When I install it in google colab its working but not in my windows system.

@arhamshah
Copy link
Author

Here's the error log for your reference

Building wheels for collected packages: lanms-neo
  Building wheel for lanms-neo (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: 'E:\PycharmProjects\table_extraction\venv\Scripts\python.exe' 'E:\PycharmProjects\table_extraction\venv\lib\site-packages\pip\_vendor\pep517\in
_process\_in_process.py' build_wheel 'C:\Users\arhams\AppData\Local\Temp\tmpv2818r8b'
       cwd: C:\Users\arhams\AppData\Local\Temp\pip-install-1j6n0n8m\lanms-neo_1a6c5c149ebf454abc3e832883cdaab6
  Complete output (26 lines):
  running bdist_wheel
  running build
  running build_py
  running build_ext
  building 'lanms._C' extension
  clipper.cpp
  lanms.cpp
  C:\Users\arhams\AppData\Local\Temp\pip-build-env-sq3_aurr\overlay\Lib\site-packages\pybind11\include\pybind11\detail/common.h(1040): error C2737: 'pybind
11::overload_cast': 'constexpr' object must be initialized
  C:\Users\arhams\AppData\Local\Temp\pip-install-1j6n0n8m\lanms-neo_1a6c5c149ebf454abc3e832883cdaab6\lanms\csrc\lanms.h(18): warning C4244: '+=': conversio
n from 'double' to 'float', possible loss of data
  C:\Users\arhams\AppData\Local\Temp\pip-install-1j6n0n8m\lanms-neo_1a6c5c149ebf454abc3e832883cdaab6\lanms\csrc\lanms.h(66): warning C4244: '+=': conversio
n from 'float' to 'int64_t', possible loss of data
  C:\Users\arhams\AppData\Local\Temp\pip-install-1j6n0n8m\lanms-neo_1a6c5c149ebf454abc3e832883cdaab6\lanms\csrc\lanms.h(67): warning C4244: '+=': conversio
n from 'float' to 'int64_t', possible loss of data
  C:\Users\arhams\AppData\Local\Temp\pip-install-1j6n0n8m\lanms-neo_1a6c5c149ebf454abc3e832883cdaab6\lanms\csrc\lanms.h(69): warning C4244: '+=': conversio
n from 'float' to 'int64_t', possible loss of data
  C:\Users\arhams\AppData\Local\Temp\pip-install-1j6n0n8m\lanms-neo_1a6c5c149ebf454abc3e832883cdaab6\lanms\csrc\lanms.h(70): warning C4244: '+=': conversio
n from 'float' to 'int64_t', possible loss of data
  C:\Users\arhams\AppData\Local\Temp\pip-install-1j6n0n8m\lanms-neo_1a6c5c149ebf454abc3e832883cdaab6\lanms\csrc\lanms.h(72): warning C4244: '+=': conversio
n from 'float' to 'int64_t', possible loss of data
  C:\Users\arhams\AppData\Local\Temp\pip-install-1j6n0n8m\lanms-neo_1a6c5c149ebf454abc3e832883cdaab6\lanms\csrc\lanms.h(73): warning C4244: '+=': conversio
n from 'float' to 'int64_t', possible loss of data
  C:\Users\arhams\AppData\Local\Temp\pip-install-1j6n0n8m\lanms-neo_1a6c5c149ebf454abc3e832883cdaab6\lanms\csrc\lanms.h(75): warning C4244: '+=': conversio
n from 'float' to 'int64_t', possible loss of data
  C:\Users\arhams\AppData\Local\Temp\pip-install-1j6n0n8m\lanms-neo_1a6c5c149ebf454abc3e832883cdaab6\lanms\csrc\lanms.h(76): warning C4244: '+=': conversio
n from 'float' to 'int64_t', possible loss of data
  C:\Users\arhams\AppData\Local\Temp\pip-install-1j6n0n8m\lanms-neo_1a6c5c149ebf454abc3e832883cdaab6\lanms\csrc\lanms.h(147): warning C4244: '=': conversio
n from 'float' to 'ClipperLib::cInt', possible loss of data
  C:\Users\arhams\AppData\Local\Temp\pip-install-1j6n0n8m\lanms-neo_1a6c5c149ebf454abc3e832883cdaab6\lanms\csrc\lanms.h(148): warning C4244: '=': conversio
n from 'float' to 'ClipperLib::cInt', possible loss of data
  C:\Users\arhams\AppData\Local\Temp\pip-install-1j6n0n8m\lanms-neo_1a6c5c149ebf454abc3e832883cdaab6\lanms\csrc\lanms.h(149): warning C4244: '=': conversio
n from 'float' to 'ClipperLib::cInt', possible loss of data
  C:\Users\arhams\AppData\Local\Temp\pip-install-1j6n0n8m\lanms-neo_1a6c5c149ebf454abc3e832883cdaab6\lanms\csrc\lanms.h(150): warning C4244: '=': conversio
n from 'float' to 'ClipperLib::cInt', possible loss of data
  C:\Users\arhams\AppData\Local\Temp\pip-install-1j6n0n8m\lanms-neo_1a6c5c149ebf454abc3e832883cdaab6\lanms\csrc\lanms.h(151): warning C4244: '=': conversio
n from 'float' to 'ClipperLib::cInt', possible loss of data
  C:\Users\arhams\AppData\Local\Temp\pip-install-1j6n0n8m\lanms-neo_1a6c5c149ebf454abc3e832883cdaab6\lanms\csrc\lanms.h(152): warning C4244: '=': conversio
n from 'float' to 'ClipperLib::cInt', possible loss of data
  C:\Users\arhams\AppData\Local\Temp\pip-install-1j6n0n8m\lanms-neo_1a6c5c149ebf454abc3e832883cdaab6\lanms\csrc\lanms.h(153): warning C4244: '=': conversio
n from 'float' to 'ClipperLib::cInt', possible loss of data
  C:\Users\arhams\AppData\Local\Temp\pip-install-1j6n0n8m\lanms-neo_1a6c5c149ebf454abc3e832883cdaab6\lanms\csrc\lanms.h(154): warning C4244: '=': conversio
n from 'float' to 'ClipperLib::cInt', possible loss of data
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX86\\x64\\cl.exe' failed wit
h exit code 2
  ----------------------------------------
  ERROR: Failed building wheel for lanms-neo
Failed to build lanms-neo
ERROR: Could not build wheels for lanms-neo, which is required to install pyproject.toml-based projects

@gaotongxiao
Copy link
Collaborator

Could you try upgrading your MSVC to 19.xx? Our local compilation succeeded at this version.

@arhamshah
Copy link
Author

Can you guide me how I could upgrade it as I can't get it what you are trying to say. My Microsoft Visual C++ distribution is of version 14.xx

@gaotongxiao
Copy link
Collaborator

Sorry for the confusion, I'm not an expert on Windows. 19.xx is the version of MSVC compiler instead of MSVC. Our unit test shows that the compilation succeeded at Windows 2022. According to the specs (https://github.com/actions/virtual-environments/blob/main/images/win/Windows2022-Readme.md), you might try to upgrade your MSVC to 14.32.31332 for a successful compilation.

@arhamshah
Copy link
Author

Thanks It is working but while running the program, I get another error! Which is mentioned below:-

Traceback (most recent call last):
  File "E:/PycharmProjects/table_extraction/api.py", line 6, in <module>
    from mmocr.datasets.pipelines.crop import crop_img
  File "E:\PycharmProjects\table_extraction\venv\lib\site-packages\mmocr\datasets\__init__.py", line 2, in <module>
    from mmdet.datasets.builder import DATASETS, build_dataloader, build_dataset
  File "E:\PycharmProjects\table_extraction\venv\lib\site-packages\mmdet\datasets\__init__.py", line 2, in <module>
    from .builder import DATASETS, PIPELINES, build_dataloader, build_dataset
  File "E:\PycharmProjects\table_extraction\venv\lib\site-packages\mmdet\datasets\builder.py", line 15, in <module>
    from .samplers import (ClassAwareSampler, DistributedGroupSampler,
  File "E:\PycharmProjects\table_extraction\venv\lib\site-packages\mmdet\datasets\samplers\__init__.py", line 2, in <module>
    from .class_aware_sampler import ClassAwareSampler
  File "E:\PycharmProjects\table_extraction\venv\lib\site-packages\mmdet\datasets\samplers\class_aware_sampler.py", line 8, in <module>
    from mmdet.core.utils import sync_random_seed
  File "E:\PycharmProjects\table_extraction\venv\lib\site-packages\mmdet\core\__init__.py", line 3, in <module>
    from .bbox import *  # noqa: F401, F403
  File "E:\PycharmProjects\table_extraction\venv\lib\site-packages\mmdet\core\bbox\__init__.py", line 8, in <module>
    from .samplers import (BaseSampler, CombinedSampler,
  File "E:\PycharmProjects\table_extraction\venv\lib\site-packages\mmdet\core\bbox\samplers\__init__.py", line 12, in <module>
    from .score_hlr_sampler import ScoreHLRSampler
  File "E:\PycharmProjects\table_extraction\venv\lib\site-packages\mmdet\core\bbox\samplers\score_hlr_sampler.py", line 3, in <module>
    from mmcv.ops import nms_match
  File "E:\PycharmProjects\table_extraction\venv\lib\site-packages\mmcv\ops\__init__.py", line 2, in <module>
    from .active_rotated_filter import active_rotated_filter
  File "E:\PycharmProjects\table_extraction\venv\lib\site-packages\mmcv\ops\active_rotated_filter.py", line 10, in <module>
    ext_module = ext_loader.load_ext(
  File "E:\PycharmProjects\table_extraction\venv\lib\site-packages\mmcv\utils\ext_loader.py", line 13, in load_ext
    ext = importlib.import_module('mmcv.' + name)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed while importing _ext: The specified procedure could not be found.

@gaotongxiao
Copy link
Collaborator

It's because mmcv-full hasn't been installed correctly. Try the following commands:

pip uninstall mmcv-full
pip uninstall mmcv 
pip install -U openmim
mim install mmcv-full

which should address your issue.

@arhamshah
Copy link
Author

Thanks I have installed the mmcv-full package and it's working but while executing my program, I am getting an error which is related to installation I guess

import cv2
from mmocr.utils.ocr import MMOCR


# Initiating text detection engine
det_engine = MMOCR(det='TextSnake', recog=None)

path = 'E:\PycharmProjects\template.png'

# Inference and displaying detected text
img = cv2.imread(path)
results = det_engine.readtext(img, output='det_out.jpg', details=True)
cv2.imshow(cv2.imread("det_out.jpg"))

Error Log:

Traceback (most recent call last):
  File "E:/PycharmProjects/table_extraction/api.py", line 11, in <module>
    det_engine = MMOCR(det='TextSnake', recog=None)
  File "E:\PycharmProjects\table_extraction\mmocr\mmocr\utils\ocr.py", line 394, in __init__
    self.detect_model = init_detector(
  File "E:\PycharmProjects\table_extraction\mmocr\mmocr\apis\inference.py", line 34, in init_detector
    config = mmcv.Config.fromfile(config)
  File "E:\PycharmProjects\table_extraction\venv\lib\site-packages\mmcv\utils\config.py", line 340, in fromfile
    cfg_dict, cfg_text = Config._file2dict(filename,
  File "E:\PycharmProjects\table_extraction\venv\lib\site-packages\mmcv\utils\config.py", line 183, in _file2dict
    check_file_exist(filename)
  File "E:\PycharmProjects\table_extraction\venv\lib\site-packages\mmcv\utils\path.py", line 23, in check_file_exist
    raise FileNotFoundError(msg_tmpl.format(filename))
FileNotFoundError: file "E:\PycharmProjects\table_extraction\configs\textdet\textsnake\textsnake_r50_fpn_unet_1200e_ctw1500.py" does not exist

@gaotongxiao
Copy link
Collaborator

If you installed mmocr as a pip package, then you should prepare the configs and checkpoints following https://mmocr.readthedocs.io/en/latest/install.html#case-b-installed-as-a-package

@arhamshah
Copy link
Author

Thank you @gaotongxiao, the issue has been resolved!

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

3 participants