mindspore-lab / mindocr

A toolbox of ocr models and algorithms based on MindSpore

Home Page:https://mindspore-lab.github.io/mindocr/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lanms python version mismatch

chernobaevigor opened this issue · 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/mindocr.git@v0.1.1
  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)

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

Any updates on the issue ?

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.