mindocr icon indicating copy to clipboard operation
mindocr copied to clipboard

lanms python version mismatch

Open chernobaevigor opened this issue 2 years ago • 3 comments

Hi, We've met the issue with the lanms: it was compiled for python 3.8 and not compatible with python 3.7. Steps to reproduce:

  1. Install mindocr using pip install git+https://github.com/mindspore-lab/[email protected]
  2. Wait till pip gets all dependencies including lanms==1.0.2 (this is the latest version)
  3. Try launching something from mindocr During the import the error happens:
File "/mnt/ichernob/projects/environments/190/lib/python3.7/site-packages/lanms/__init__.py", line 2, in <module>
    from .adaptor import merge_quadrangle_n9 as nms_impl
ImportError: Python version mismatch: module was compiled for version 3.8, while the interpreter is running version 3.7.

Kind regards, Igor

P.S. There is a workaround by switching to lanms-nova (https://github.com/AndranikSargsyan/lanms-nova)

chernobaevigor avatar Jul 24 '23 06:07 chernobaevigor

Upd. To reproduce the issue we simply import mindocr module: from mindocr.models import build_model, list_models

Environment to reproduce: Python 3.7, mindspore 1.9.0

chernobaevigor avatar Jul 25 '23 06:07 chernobaevigor

Any updates on the issue ?

chernobaevigor avatar Sep 08 '23 14:09 chernobaevigor

We are sorry for keeping your long waiting.

Some Python 3.7 environment may meet this problem when multiple python3 environment exists. You could try the following steps to solve this problem:

  1. run pip3 install lanms -i https://pypi.tuna.tsinghua.edu.cn/simple, and get the url for downloading lanms-1.0.2.tar.gz(like https://pypi.tuna.tsinghua.edu.cn/packages/96/c0/50dc2c857ed060e907adaef31184413a7706e475c322236d346382e45195/lanms-1.0.2.tar.gz)
  2. use this url and dowload the lanms-1.0.2.tar.gz, run tar -zxvf lanms-1.0.2.tar.gz to decompress the package.
  3. cd lanms-1.0.2
  4. edit the Makefile, replace python3-config with python3.7-config in line 1 and line 2, and you could get
    CXXFLAGS = -I include  -std=c++11 -O3 $(shell python3.7-config --cflags)
    LDFLAGS = $(shell python3.7-config --ldflags)
    ...
    
    save Makefile. So that the make process would exactly compile with python3.7 environment
  5. run python setup.py install and completely install lanms.

And you can import lamns to check whether the installation is successful. We are also recommand to use mindspore>=2.2.0 and latest mindocr version.

horcham avatar Feb 19 '24 03:02 horcham