anndata icon indicating copy to clipboard operation
anndata copied to clipboard

anndata optional dependency import system can behave poorly with autodoc_mock_imports

Open Intron7 opened this issue 1 year ago • 4 comments

Please make sure these conditions are met

  • [X] I have checked that this issue has not already been reported.
  • [X] I have confirmed this bug exists on the latest version of anndata.
  • [X] (optional) I have confirmed this bug exists on the master branch of anndata.

Report

I ran into a problem with the new GPU dependencies and how they are loaded in anndata. For the rapids-singlecell docs I mock import all gpu packages, this includes cupy and cupyx. Because of the mock imports anndata thought it was in a GPU enviroment and tried to load the packages. The docs creation froze and didn't finish. Mock importing anndata didn't fix the issue it just resulted in a bug. What I had to do in the end is importing anndata at the start of the conf.py so that it doesn't know about cupy. If there is a more elegant solution than this please let me know.

Versions

anndata 0.10.0rc1

Intron7 avatar Sep 10 '23 21:09 Intron7