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

lanms python version mismatch #524

Open
chernobaevigor opened this issue Jul 24, 2023 · 3 comments
Open

lanms python version mismatch #524

chernobaevigor opened this issue Jul 24, 2023 · 3 comments
Assignees

Comments

@chernobaevigor
Copy link
Collaborator

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
Copy link
Collaborator Author

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
Copy link
Collaborator Author

Any updates on the issue ?

@horcham
Copy link
Collaborator

horcham commented Feb 19, 2024

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.

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

2 participants