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

"How to resolve the error encountered during the process of importing the function to compute gene-gene distances?" #12

Open
maaa-a opened this issue Jun 18, 2024 · 3 comments

Comments

@maaa-a
Copy link

maaa-a commented Jun 18, 2024

"When I was working on computing gene-gene distances, I encountered this error. How can I resolve it? Thank you."
cal_ot_mat_from_numpy <- reticulate::import('gene_trajectory.compute_gene_distance_cmd')$cal_ot_mat_from_numpy
error in py_module_import(module, convert = convert):
ImportError: numpy.core.multiarray failed to import (auto-generated because you didn't call 'numpy.import_array()' after cimporting numpy; use 'numpy._import_array' to disable if you are certain you don't need it).

@fra-pcmgf
Copy link
Collaborator

Hi @maaa-a

It looks like there are issues with your Python environment and the installation of numpy.

Are you using conda or virtualenv? Can you check the version of Python and numpy you are using? To get the values, start a new R session, pick the environment to use with reticulate (e.g. reticulate::use_virtualenv('igt')) and then run reticulate::py_config().

If you have an older version of numpy, updating may solve the issue

@maaa-a
Copy link
Author

maaa-a commented Jun 19, 2024

"I've been using the latest versions of Python and numpy. If I need to use another version.
version: 3.12.4 (tags/v3.12.4:8e8a4ba, Jun 6 2024, 19:30:16)
numpy_version: 2.0.0

@fra-pcmgf
Copy link
Collaborator

fra-pcmgf commented Jun 19, 2024

It seems like numpy 2.0 has introduced some non-breaking changes. Try downgrading numpy (e.g. reticulate::py_install('numpy<2.0' ) )

I have created an issue on the Python project (KlugerLab/GeneTrajectory-python#12) to try and make the package compatible with numpy 2.0 and 1.26.

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