has2k1 / scikit-misc

Miscellaneous tools for data analysis and scientific computing
https://has2k1.github.io/scikit-misc/stable
BSD 3-Clause "New" or "Revised" License
39 stars 9 forks source link

How to run tests #19

Closed penguinpee closed 2 years ago

penguinpee commented 2 years ago

I tried running the tests as part of packaging scikit-misc for Fedora. It fails with the following error:

__init__.py:21: in <module>
    from skmisc.__config__ import show as show_config  # noqa: F401
E   ModuleNotFoundError: No module named 'skmisc.__config__'

There's an explanation in the exception following the import:

Error importing skmisc: you cannot import skmisc while
being in skmisc source directory; please exit the skmisc source
tree first, and relaunch your python intepreter.

I fail to fully grasp the meaning of the message. My first assertion is that this is not possible in the build environment. Is there any other way of running the tests?

For now I'm doing a simple import test, which should be acceptable to get the package reviewed. However, if possible, I would also like to run the tests.

has2k1 commented 2 years ago

There is something wrong with the installation. Check that .../skmisc/__config__.py file was created by numpy.

penguinpee commented 2 years ago

skmisc/__config__.py has been created and is part of the package. However the tests are run in the build environment. I double checked and in there skmisc/__config__.py is not present.

Is that what the comment, mentioned above, is referring to? I can try to copy __config__.py over.

has2k1 commented 2 years ago

__config__.py is required and __init__.py refers to it.

penguinpee commented 2 years ago

We made progress. Tests are running, but failing due to a linking issue:

E   ImportError: /builddir/build/BUILD/scikit-misc-0.1.4/empty/skmisc/loess/_loess.cpython-311-x86_64-linux-gnu.so: undefined symbol: drot_

This is from a fellow Fedora packager/developer posted in Bugzilla. There is more information regarding FlexiBLAS as BLAS/LAPACK in Fedora.

I haven't found the time to dive into it yet. This is getting a little above my (pay)grade.

has2k1 commented 2 years ago

You are on the right track, drot_ is provided by BLAS/LAPACK. scikit-misc uses the same not so nice build setup as scipy (which is migrating to meson).

The problem seems to be that the builder is not picking up FlexiBLAS! Here is how to check what is being discovered.

from numpy.distutils.system_info import get_info
get_info('blas_opt')

Output on OSX (which compiles successfully)

{'extra_compile_args': ['-msse3',
  '-I/System/Library/Frameworks/vecLib.framework/Headers'],
 'extra_link_args': ['-Wl,-framework', '-Wl,Accelerate'],
 'define_macros': [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]}

Output on Arch Linux (which also compiles successfully)

{'libraries': ['openblas', 'openblas'],
 'library_dirs': ['/usr/lib64'],
 'language': 'c',
 'define_macros': [('HAVE_CBLAS', None)]}
penguinpee commented 2 years ago

:no_mouth: I was using OpenBLAS instead of FlexiBLAS. :facepalm:

I changed it and tests are completing successfully now. Thanks very much for your help.