-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Closed
Labels
array typesItems related to array API support and input array validation (see gh-18286)Items related to array API support and input array validation (see gh-18286)defectA clear bug or issue that prevents SciPy from being installed or used as expectedA clear bug or issue that prevents SciPy from being installed or used as expectedscipy.sparse
Milestone
Description
Describe your issue.
It seems like the described behavior does no work while np.array(int())
does seem to work. This comes from the array api test suite setup, so presumably it should work and indeed does for csr_matrix
. I think the error is recent (or on main
) because it does not error in 1.11.4
. I know there has been a lot of work around 1d so sorry if this is expected! Happy to fix if it's a real bug!
Reproducing Code Example
from scipy import sparse
import numpy as np
sparse.csr_array(int()) # errors
sparse.csr_matrix(int()) # does not error
np.array(int()) # does not error
Error message
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/ilangold/Projects/Theis/scipy/scipy/sparse/_compressed.py", line 86, in __init__
self._coo_container(arg1, dtype=dtype)
File "/Users/ilangold/Projects/Theis/scipy/scipy/sparse/_coo.py", line 81, in __init__
self._shape = check_shape(M.shape, allow_1d=is_array)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ilangold/Projects/Theis/scipy/scipy/sparse/_sputils.py", line 317, in check_shape
raise TypeError("function missing 1 required positional argument: "
TypeError: function missing 1 required positional argument: 'shape'
SciPy/NumPy/Python version and system information
1.13.0.dev0+1365.cd9d20b 1.26.4 sys.version_info(major=3, minor=11, micro=8, releaselevel='final', serial=0)
Build Dependencies:
blas:
detection method: pkgconfig
found: true
include directory: /Users/ilangold/micromamba/envs/scipy-dev-array-api/include
lib directory: /Users/ilangold/micromamba/envs/scipy-dev-array-api/lib
name: openblas
openblas configuration: USE_64BITINT=0 DYNAMIC_ARCH=0 DYNAMIC_OLDER= NO_CBLAS=
NO_LAPACK=0 NO_LAPACKE= NO_AFFINITY=1 USE_OPENMP=1 VORTEX MAX_THREADS=128
pc file directory: /Users/ilangold/micromamba/envs/scipy-dev-array-api/lib/pkgconfig
version: 0.3.26
lapack:
detection method: pkgconfig
found: true
include directory: /Users/ilangold/micromamba/envs/scipy-dev-array-api/include
lib directory: /Users/ilangold/micromamba/envs/scipy-dev-array-api/lib
name: openblas
openblas configuration: USE_64BITINT=0 DYNAMIC_ARCH=0 DYNAMIC_OLDER= NO_CBLAS=
NO_LAPACK=0 NO_LAPACKE= NO_AFFINITY=1 USE_OPENMP=1 VORTEX MAX_THREADS=128
pc file directory: /Users/ilangold/micromamba/envs/scipy-dev-array-api/lib/pkgconfig
version: 0.3.26
pybind11:
detection method: pkgconfig
include directory: /Users/ilangold/micromamba/envs/scipy-dev-array-api/include
name: pybind11
version: 2.11.1
Compilers:
c:
args: -ftree-vectorize, -fPIC, -fstack-protector-strong, -O2, -pipe, -isystem,
/Users/ilangold/micromamba/envs/scipy-dev/include, -D_FORTIFY_SOURCE=2, -isystem,
/Users/ilangold/micromamba/envs/scipy-dev/include
commands: arm64-apple-darwin20.0.0-clang
linker: ld64
linker args: -Wl,-headerpad_max_install_names, -Wl,-dead_strip_dylibs, -Wl,-rpath,/Users/ilangold/micromamba/envs/scipy-dev/lib,
-L/Users/ilangold/micromamba/envs/scipy-dev/lib, -ftree-vectorize, -fPIC, -fstack-protector-strong,
-O2, -pipe, -isystem, /Users/ilangold/micromamba/envs/scipy-dev/include, -D_FORTIFY_SOURCE=2,
-isystem, /Users/ilangold/micromamba/envs/scipy-dev/include
name: clang
version: 16.0.6
c++:
args: -ftree-vectorize, -fPIC, -fstack-protector-strong, -O2, -pipe, -stdlib=libc++,
-fvisibility-inlines-hidden, -fmessage-length=0, -isystem, /Users/ilangold/micromamba/envs/scipy-dev/include,
-D_FORTIFY_SOURCE=2, -isystem, /Users/ilangold/micromamba/envs/scipy-dev/include
commands: arm64-apple-darwin20.0.0-clang++
linker: ld64
linker args: -Wl,-headerpad_max_install_names, -Wl,-dead_strip_dylibs, -Wl,-rpath,/Users/ilangold/micromamba/envs/scipy-dev/lib,
-L/Users/ilangold/micromamba/envs/scipy-dev/lib, -ftree-vectorize, -fPIC, -fstack-protector-strong,
-O2, -pipe, -stdlib=libc++, -fvisibility-inlines-hidden, -fmessage-length=0,
-isystem, /Users/ilangold/micromamba/envs/scipy-dev/include, -D_FORTIFY_SOURCE=2,
-isystem, /Users/ilangold/micromamba/envs/scipy-dev/include
name: clang
version: 16.0.6
cython:
commands: cython
linker: cython
name: cython
version: 3.0.8
fortran:
args: -march=armv8.3-a, -ftree-vectorize, -fPIC, -fno-stack-protector, -O2, -pipe,
-isystem, /Users/ilangold/micromamba/envs/scipy-dev/include
commands: /Users/ilangold/micromamba/envs/scipy-dev/bin/arm64-apple-darwin20.0.0-gfortran
linker: ld64
linker args: -Wl,-headerpad_max_install_names, -Wl,-dead_strip_dylibs, -Wl,-rpath,/Users/ilangold/micromamba/envs/scipy-dev/lib,
-L/Users/ilangold/micromamba/envs/scipy-dev/lib, -march=armv8.3-a, -ftree-vectorize,
-fPIC, -fno-stack-protector, -O2, -pipe, -isystem, /Users/ilangold/micromamba/envs/scipy-dev/include
name: gcc
version: 12.3.0
pythran:
include directory: ../../../../micromamba/envs/scipy-dev-array-api/lib/python3.11/site-packages/pythran
version: 0.15.0
Machine Information:
build:
cpu: aarch64
endian: little
family: aarch64
system: darwin
cross-compiled: false
host:
cpu: aarch64
endian: little
family: aarch64
system: darwin
Python Information:
path: /Users/ilangold/micromamba/envs/scipy-dev-array-api/bin/python3.11
version: '3.11'
Metadata
Metadata
Assignees
Labels
array typesItems related to array API support and input array validation (see gh-18286)Items related to array API support and input array validation (see gh-18286)defectA clear bug or issue that prevents SciPy from being installed or used as expectedA clear bug or issue that prevents SciPy from being installed or used as expectedscipy.sparse