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

Fix for scikit sparse dependency issue #7

Merged
merged 4 commits into from
Mar 21, 2022

Conversation

af-a
Copy link
Contributor

@af-a af-a commented Mar 21, 2022

Summary

Removing the scikit-sparse dependency.

TODOs

  • Update README with note mentioning that scikit-sparse must be installed manually, if an optional flag for using Chloesky decomposition is specified (soon to be integrated).

Description

The scikit-sparse dependency was previously included in setup.py and requirements.txt.
However, installing LaPy using pip when scikit-sparse is specified as a dependency leads to errors:

Building wheels for collected packages: scikit-sparse
  Building wheel for scikit-sparse (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /opt/conda/bin/python /opt/conda/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpfo7yw9fp
       cwd: /tmp/pip-install-w717c8s7/scikit-sparse_8636ab45e8894133b2998e2d9b87d24f
  Complete output (35 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.8
  creating build/lib.linux-x86_64-3.8/sksparse
  copying sksparse/__init__.py -> build/lib.linux-x86_64-3.8/sksparse
  copying sksparse/test_cholmod.py -> build/lib.linux-x86_64-3.8/sksparse
  creating build/lib.linux-x86_64-3.8/sksparse/test_data
  copying sksparse/test_data/illc1033.mtx.gz -> build/lib.linux-x86_64-3.8/sksparse/test_data
  copying sksparse/test_data/illc1033_rhs1.mtx.gz -> build/lib.linux-x86_64-3.8/sksparse/test_data
  copying sksparse/test_data/illc1850.mtx.gz -> build/lib.linux-x86_64-3.8/sksparse/test_data
  copying sksparse/test_data/illc1850_rhs1.mtx.gz -> build/lib.linux-x86_64-3.8/sksparse/test_data
  copying sksparse/test_data/well1033.mtx.gz -> build/lib.linux-x86_64-3.8/sksparse/test_data
  copying sksparse/test_data/well1033_rhs1.mtx.gz -> build/lib.linux-x86_64-3.8/sksparse/test_data
  copying sksparse/test_data/well1850.mtx.gz -> build/lib.linux-x86_64-3.8/sksparse/test_data
  copying sksparse/test_data/well1850_rhs1.mtx.gz -> build/lib.linux-x86_64-3.8/sksparse/test_data
  running build_ext
  building 'sksparse.cholmod' extension
  creating build/temp.linux-x86_64-3.8
  creating build/temp.linux-x86_64-3.8/sksparse
  gcc -pthread -B /opt/conda/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Isksparse -I/tmp/pip-build-env-ozzw5wiz/overlay/lib/python3.8/site-packages/numpy/core/include -I/opt/conda/include -I/usr/include/suitesparse -I/opt/conda/include/python3.8 -c sksparse/cholmod.c -o build/temp.linux-x86_64-3.8/sksparse/cholmod.o
  In file included from /tmp/pip-build-env-ozzw5wiz/overlay/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830:0,
                   from /tmp/pip-build-env-ozzw5wiz/overlay/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                   from /tmp/pip-build-env-ozzw5wiz/overlay/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                   from sksparse/cholmod.c:713:
  /tmp/pip-build-env-ozzw5wiz/overlay/lib/python3.8/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
   #warning "Using deprecated NumPy API, disable it with " \
    ^~~~~~~
  In file included from sksparse/cholmod.c:715:0:
  sksparse/cholmod_backward_compatible.h:1:10: fatal error: cholmod.h: No such file or directory
   #include "cholmod.h"
            ^~~~~~~~~~~
  compilation terminated.
  error: command '/usr/bin/gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for scikit-sparse
Failed to build scikit-sparse
ERROR: Could not build wheels for scikit-sparse which use PEP 517 and cannot be installed directly

Therefore, it was removed from the list of dependencies in both files.

In addition, the requirements.in file from which the requirements.txt file is generated (using the pip-compile tool) has also been included.

@af-a
Copy link
Contributor Author

af-a commented Mar 21, 2022

The following can be added as a note under the Installation section of the README:

The Solver can either use LU decomposition (default) or Cholesky decomposition if the use_cholmod flag is used. the latter depends on the scikit-sparse library. This library can not be installed among the depedencies of LaPy using pip (if it is specified in setup.py or requirements.txt), since it causes errors. Therefore, if you would like to use use_cholmod, you need to install scikit-sparse separately.

@m-reuter is this description sufficient?

@m-reuter
Copy link
Member

Use this Note:

Several functions, e.g. the Solver, require a sparse matrix decomposition, for which either the LU decomposition (from scipy sparse) or the faster Cholesky decomposition (from scikit-sparse cholmod) can be used. If the parameter flag use_cholmod is True, the code will try to import cholmod from the scikit-sparse package and will fall back to LU if the import fails. If you would like to use cholmod, you need to install scikit-sparse separately. It cannot be listed among LaPy's dependencies (e.g. in setup.py or requirements.txt) as that causes errors with pip. scikit-sparse requires numpy and scipy to be installed separately beforehand.

@af-a af-a changed the title [WIP] Fix for scikit sparse dependency issue Fix for scikit sparse dependency issue Mar 21, 2022
@m-reuter m-reuter merged commit c3fbd45 into Deep-MI:master Mar 21, 2022
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

Successfully merging this pull request may close these issues.

2 participants