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

import sparseqr error #24

Open
ivangvozdanovic opened this issue May 8, 2024 · 3 comments
Open

import sparseqr error #24

ivangvozdanovic opened this issue May 8, 2024 · 3 comments

Comments

@ivangvozdanovic
Copy link

ivangvozdanovic commented May 8, 2024

I have downloaded and installed both SuiteSparse and sparseqr packages, however when I try to import: ( import sparseqr ), I get the following error:

=== Wrapper module not compiled; compiling...
generating /usr/local/lib/python3.10/dist-packages/sparseqr/_sparseqr.c
setting the current directory to '/usr/local/lib/python3.10/dist-packages'
INFO:root:running build_ext
INFO:root:building 'sparseqr._sparseqr' extension
INFO:root:x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/usr/include/suitesparse -I/opt/homebrew/include -I/usr/include/python3.10 -c sparseqr/_sparseqr.c -o ./sparseqr/_sparseqr.o

ModuleNotFoundError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/sparseqr/sparseqr.py in
14 try:
---> 15 from ._sparseqr import ffi, lib
16 except ImportError:

ModuleNotFoundError: No module named 'sparseqr._sparseqr' <------------------- This is what I am getting.

During handling of the above exception, another exception occurred:

DistutilsExecError Traceback (most recent call last)
22 frames
DistutilsExecError: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1

During handling of the above exception, another exception occurred:

CompileError Traceback (most recent call last)
CompileError: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1

During handling of the above exception, another exception occurred:

VerificationError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/cffi/ffiplatform.py in _build(tmpdir, ext, compiler_verbose, debug)
52 set_threshold(old_level)
53 except (CompileError, LinkError) as e:
---> 54 raise VerificationError('%s: %s' % (e.class.name, e))
55 #
56 return soname

VerificationError: CompileError: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1

Thank you in advance for your help.

@yig
Copy link
Owner

yig commented May 8, 2024

The same error was reported here: jwyang/faster-rcnn.pytorch#641. The solution for them was to change some paths. Are you able to try that? For them it was:

export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
export CPATH=/usr/local/cuda-8.0/include${CPATH:+:${CPATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

Another solution is to move the compilation to setup.py (https://cffi.readthedocs.io/en/latest/cdef.html under "For Setuptools (out-of-line only, but works in ABI or API mode; recommended)") and use cibuildwheel https://github.com/pypa/cibuildwheel to have github do all the compilation in advance.

@ivangvozdanovic
Copy link
Author

The link says to change paths in the make.sh file. But I do not see that file. I only see _sparseqr.c file. Would that be the one?

@yig
Copy link
Owner

yig commented May 8, 2024

Those are environment variables. Can you set environment variables for the environment in which your Python is running and importing sparseqr?

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