Starlitnightly / omicverse

A python library for multi omics included bulk, single cell and spatial RNA-seq analysis.
https://starlitnightly.github.io/omicverse/
GNU General Public License v3.0
474 stars 57 forks source link

Bug in ov.space.svg():TypingError:Failed in nopython mode pipeline (step: nopython frontend) Untyped global name 'tqdm': Cannot determine Numba type of <class 'type'> #208

Open GhostInTheShellwjc opened 2 weeks ago

GhostInTheShellwjc commented 2 weeks ago

Hello!When I run the code in the tutorials-space Mapping single-cell profile onto spatial profile,it raises "TypingError:Failed in nopython mode pipeline (step: nopython frontend) Untyped global name 'tqdm': Cannot determine Numba type of <class 'type'>" when I execute 'adata=ov.space.svg(adata,mode='prost',n_svgs=3000,target_sum=1e4,platform="visium",)'.It is not the first time that the func ov.space.svg raises error(another error in problem #207).Perhaps it is due to the numba has a conflict with the tqdm.I will be more than glad if someone can provide a version of numpy,numba and tqdm , under which the bug will not happen,or the func will be modified in future versions.Hopefully the problem will be solved. versions:numpy==1.26.4,numba==0.60.0-py310h7793332_0,tqdm==4.67.0 platform:jupyter on vscode,Windows11

屏幕截图 2024-11-09 183202 屏幕截图 2024-11-09 183229
GhostInTheShellwjc commented 2 weeks ago

It can be solved by disabling Numba acceleration.I think it is because the numpy 1.x.x version conflicts with numba0.60.0.I will be more than glad if someone provides a fit numba or upgrade numpy in next version of omicverse.

colinwxl commented 2 weeks ago

@GhostInTheShellwjc I have encountered the same error too. How can I disable the Numba acceleration?

GhostInTheShellwjc commented 2 weeks ago

@colinwxl I modify the codes in utils.py as a temporary solution of the problem(The codes in "D:\Miniconda3\envs\omicverse\Lib\site-packages\omicverse\externel\PROST\utils.py")(This is my path,you should modify it to your path of miniconda3).In 97 and in 189,in front of func "get_image_idx_1D" and " gene_img_flatten",I comment "@numba.jit" with a "#"(both of 97 and 189).Although it costs more time when running on my cpus,it works well.Hopfully it can help.

屏幕截图 2024-11-11 095757 屏幕截图 2024-11-11 095850 屏幕截图 2024-11-11 102101
colinwxl commented 2 weeks ago

@GhostInTheShellwjc I have done the same, and solve the error. thank you

Starlitnightly commented 4 days ago

You can try pip install numpy==1.23.5 llvmlite==0.41.1 numba==0.58.1 -i https://pypi.tuna.tsinghua.edu.cn/simple

GhostInTheShellwjc commented 2 days ago

It really works!Thank you!