-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
Discussed in #440
Originally posted by glemieux June 24, 2025
I recently stumbled upon an issue in which scipy was not found when building an environment through a conda-lock file:
File "/home/glemieux/local/miniconda3/envs/landusedata-env/lib/python3.13/site-packages/xesmf/smm.py", line 224, in add_nans_to_weights
m = weights.data.to_scipy_sparse().tolil()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/home/glemieux/local/miniconda3/envs/landusedata-env/lib/python3.13/site-packages/sparse/numba_backend/_coo/core.py", line 1187, in to_scipy_sparse
import scipy.sparse
ModuleNotFoundError: No module named 'scipy'
Going over to the sparse issues I found this comment that states that this package made scipy optional with sparse=0.17.0:
Hello, we switched to having SciPy as an optional dependency in 0.16.0, and it's only used on conversions to/from scipy. This was missed in the conda-forge feedstock; but it is fixed in the 0.17.0 feedstock.
If you're explicitly using scipy in your package/script, please include it in your requirements explicitly.
Solutions
Instead of adding the dependency, we could also revisit the add_nans_to_weights function and see if this can be done without leaving sparse.
Metadata
Metadata
Assignees
Labels
No labels