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

ModuleNotFoundError: cupy, torch, sympy #94

Open
Sheila-nk opened this issue Sep 14, 2023 · 1 comment
Open

ModuleNotFoundError: cupy, torch, sympy #94

Sheila-nk opened this issue Sep 14, 2023 · 1 comment
Labels
bug Something isn't working pytest-plugin

Comments

@Sheila-nk
Copy link
Collaborator

Sheila-nk commented Sep 14, 2023

Pytest collection fails on an attempt at importing cupy and pytorch for _lib/array_api_compat and sympy for _interpnd_info.py.

To reproduce on the Scipy shell:

pytest --doctest-modules build-install/lib/python3.11/site-packages/scipy -v
ERROR build-install/lib/python3.11/site-packages/scipy/_lib/array_api_compat/array_api_compat/cupy/__init__.py - ModuleNotFoundError: No module named 'cupy'
ERROR build-install/lib/python3.11/site-packages/scipy/_lib/array_api_compat/array_api_compat/cupy/_aliases.py - ModuleNotFoundError: No module named 'cupy'
ERROR build-install/lib/python3.11/site-packages/scipy/_lib/array_api_compat/array_api_compat/cupy/_typing.py - ModuleNotFoundError: No module named 'cupy'
ERROR build-install/lib/python3.11/site-packages/scipy/_lib/array_api_compat/array_api_compat/cupy/linalg.py - ModuleNotFoundError: No module named 'cupy'
ERROR build-install/lib/python3.11/site-packages/scipy/_lib/array_api_compat/array_api_compat/torch/__init__.py - ModuleNotFoundError: No module named 'torch'
ERROR build-install/lib/python3.11/site-packages/scipy/_lib/array_api_compat/array_api_compat/torch/_aliases.py - ModuleNotFoundError: No module named 'torch'
ERROR build-install/lib/python3.11/site-packages/scipy/_lib/array_api_compat/array_api_compat/torch/linalg.py - ModuleNotFoundError: No module named 'torch'
ERROR build-install/lib/python3.11/site-packages/scipy/interpolate/_interpnd_info.py - ModuleNotFoundError: No module named 'sympy'

The current solution is to exclude _lib/array_api_compat and _interpnd_info.py from doctesting:

pytest --doctest-modules build-install/lib/python3.11/site-packages/scipy -v --ignore=build-install/lib/python3.11/site-packages/scipy/_lib/array_api_compat --ignore=build-install/lib/python3.11/site-packages/scipy/interpolate/_interpnd_info.py
@Sheila-nk Sheila-nk added bug Something isn't working pytest-plugin labels Sep 14, 2023
@ev-br
Copy link
Member

ev-br commented Feb 20, 2024

This is a problem for testing installed scipy: pytest --pyargs scipy fails collection. For dev installs, we can add explicit ignores indeed. Otherwise, we probably want to invent a way to add a way to blacklist modules and to skip collection of things which try to import blacklisted things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pytest-plugin
Projects
None yet
Development

No branches or pull requests

2 participants