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

pytest error #539

Open
outpaddling opened this issue Dec 28, 2023 · 5 comments
Open

pytest error #539

outpaddling opened this issue Dec 28, 2023 · 5 comments

Comments

@outpaddling
Copy link

outpaddling commented Dec 28, 2023

I'm working on a FreeBSD port and a pkgsrc package of hmmlearn 0.3.0 (as a dependency of MACS3), and running into an error importing '_hmmc' when running pytest. The error from pkgsrc is the same on Alma Linux 8, macOS 14.0, and NetBSD 9, and the same in the FreeBSD port. FreeBSD is using python 3.9 and pkgsrc python 3.11.

Below is output from "make test" in the pkgsrc package. The long list of environment variables is just the standard pkgsrc test env. The raw command here is:

cd ${WRKSRC} && ${SETENV} ${TEST_ENV} pytest-${PYVERSSUFFIX}

I'm guessing most of the env variables are irrelevant to pytest, but perhaps one of them is throwing something off?

Any suggestions to help identify the problem would be appreciated.

=> Test dependency py311-test>=5.4.1: found py311-test-7.4.3
===> Testing for py311-hmmlearn-0.3.0
cd /home/bacon/Pkgsrc/pkgsrc/wip/py-hmmlearn/work/hmmlearn-0.3.0 && /bin/env USETOOLS=no PTHREAD_CFLAGS=\ -pthread\  PTHREAD_LDFLAGS=\ -pthread PTHREAD_LIBS=-lpthread\ -lrt PTHREADBASE=/usr NPY_BLAS_LIBS=-lblas NPY_LAPACK_LIBS=-llapack\ -lblas NPY_CBLAS_LIBS=-lcblas\ -lblas PYTHON=/home/bacon/Pkgsrc/pkg/bin/python3.11 CC=cc CFLAGS=-O2\ -I/home/bacon/Pkgsrc/pkg/include\ -I/usr/include\ -I/home/bacon/Pkgsrc/pkg/include/python3.11 CPPFLAGS=-I/home/bacon/Pkgsrc/pkg/include\ -I/usr/include\ -I/home/bacon/Pkgsrc/pkg/include/python3.11 CXX=c++ CXXFLAGS=-O2\ -I/home/bacon/Pkgsrc/pkg/include\ -I/usr/include\ -I/home/bacon/Pkgsrc/pkg/include/python3.11 COMPILER_RPATH_FLAG=-Wl,-R F77=gfortran FC=gfortran FFLAGS=-O LANG=C LC_ALL=C LC_COLLATE=C LC_CTYPE=C LC_MESSAGES=C LC_MONETARY=C LC_NUMERIC=C LC_TIME=C LDFLAGS=-Wl,-zrelro\ -L/home/bacon/Pkgsrc/pkg/lib\ -L/usr/lib64\ -Wl,-R/usr/lib64\ -Wl,-R/home/bacon/Pkgsrc/pkg/lib LINKER_RPATH_FLAG=-R PATH=/home/bacon/Pkgsrc/pkgsrc/wip/py-hmmlearn/work/.cwrapper/bin:/home/bacon/Pkgsrc/pkgsrc/wip/py-hmmlearn/work/.buildlink/bin:/home/bacon/Pkgsrc/pkgsrc/wip/py-hmmlearn/work/.gcc/bin:/home/bacon/Pkgsrc/pkgsrc/wip/py-hmmlearn/work/.tools/bin:/home/bacon/Pkgsrc/pkg/bin:/home/bacon/scripts:/home/bacon/Pkgsrc/pkg/bin:/home/bacon/Pkgsrc/pkg/sbin:/usr/local/bin:/home/bacon/scripts:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/sbin:/usr/local/sbin:/usr/pkg/sbin:/home/bacon/scripts:/home/bacon/Pkgsrc/pkg/bin:/home/bacon/Pkgsrc/pkg/bin PREFIX=/home/bacon/Pkgsrc/pkg MAKELEVEL=0 CONFIG_SITE= PKG_SYSCONFDIR=/home/bacon/Pkgsrc/pkg/etc HOME=/home/bacon/Pkgsrc/pkgsrc/wip/py-hmmlearn/work/.home CWRAPPERS_CONFIG_DIR=/home/bacon/Pkgsrc/pkgsrc/wip/py-hmmlearn/work/.cwrapper/config CPP=cpp LOCALBASE=/home/bacon/Pkgsrc/pkg X11BASE=/home/bacon/Pkgsrc/pkg PKGMANDIR=man PKGINFODIR=info PKGGNUDIR=gnu/ MAKECONF=/dev/null OBJECT_FMT=ELF USETOOLS=no BSD_INSTALL_PROGRAM=/bin/install\ -c\ -s\ -o\ bacon\ -g\ bacon\ -m\ 755 BSD_INSTALL_SCRIPT=/bin/install\ -c\ -o\ bacon\ -g\ bacon\ -m\ 755 BSD_INSTALL_LIB=/bin/install\ -c\ -o\ bacon\ -g\ bacon\ -m\ 755 BSD_INSTALL_DATA=/bin/install\ -c\ -o\ bacon\ -g\ bacon\ -m\ 644 BSD_INSTALL_MAN=/bin/install\ -c\ -o\ bacon\ -g\ bacon\ -m\ 644 BSD_INSTALL=/bin/install BSD_INSTALL_PROGRAM_DIR=/bin/install\ -d\ -o\ bacon\ -g\ bacon\ -m\ 755 BSD_INSTALL_SCRIPT_DIR=/bin/install\ -d\ -o\ bacon\ -g\ bacon\ -m\ 755 BSD_INSTALL_LIB_DIR=/bin/install\ -d\ -o\ bacon\ -g\ bacon\ -m\ 755 BSD_INSTALL_DATA_DIR=/bin/install\ -d\ -o\ bacon\ -g\ bacon\ -m\ 755 BSD_INSTALL_MAN_DIR=/bin/install\ -d\ -o\ bacon\ -g\ bacon\ -m\ 755 BSD_INSTALL_GAME=/bin/install\ -c\ -s\ -o\ bacon\ -g\ bacon\ -m\ 0755 BSD_INSTALL_GAME_DATA=/bin/install\ -c\ -o\ bacon\ -g\ bacon\ -m\ 0644 BSD_INSTALL_GAME_DIR=/bin/install\ -d\ -o\ bacon\ -g\ bacon\ -m\ 0755 INSTALL_INFO= MAKEINFO=/home/bacon/Pkgsrc/pkgsrc/wip/py-hmmlearn/work/.tools/bin/makeinfo FLEX= BISON= ITSTOOL=/home/bacon/Pkgsrc/pkgsrc/wip/py-hmmlearn/work/.tools/bin/itstool GDBUS_CODEGEN=/home/bacon/Pkgsrc/pkgsrc/wip/py-hmmlearn/work/.tools/bin/gdbus-codegen PKG_CONFIG=/home/bacon/Pkgsrc/pkgsrc/wip/py-hmmlearn/work/.tools/bin/pkg-config PKG_CONFIG_LIBDIR=/home/bacon/Pkgsrc/pkgsrc/wip/py-hmmlearn/work/.buildlink/lib64/pkgconfig:/home/bacon/Pkgsrc/pkgsrc/wip/py-hmmlearn/work/.buildlink/lib/pkgconfig:/home/bacon/Pkgsrc/pkgsrc/wip/py-hmmlearn/work/.buildlink/share/pkgconfig PKG_CONFIG_LOG=/home/bacon/Pkgsrc/pkgsrc/wip/py-hmmlearn/work/.pkg-config.log PKG_CONFIG_PATH= CWRAPPERS_CONFIG_DIR=/home/bacon/Pkgsrc/pkgsrc/wip/py-hmmlearn/work/.cwrapper/config pytest-3.11 --capture=no
============================= test session starts ==============================
platform linux -- Python 3.11.7, pytest-7.4.3, pluggy-1.3.0
rootdir: /home/bacon/Pkgsrc/pkgsrc/wip/py-hmmlearn/work/hmmlearn-0.3.0
configfile: setup.cfg
collected 0 items / 1 error                                                    

==================================== ERRORS ====================================
________________________ ERROR collecting test session _________________________
../../../../../pkg/lib/python3.11/site-packages/_pytest/config/__init__.py:641: in _importconftest
    mod = import_path(conftestpath, mode=importmode, root=rootpath)
../../../../../pkg/lib/python3.11/site-packages/_pytest/pathlib.py:567: in import_path
    importlib.import_module(module_name)
../../../../../pkg/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1204: in _gcd_import
    ???
<frozen importlib._bootstrap>:1176: in _find_and_load
    ???
<frozen importlib._bootstrap>:1126: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:241: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1204: in _gcd_import
    ???
<frozen importlib._bootstrap>:1176: in _find_and_load
    ???
<frozen importlib._bootstrap>:1147: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:690: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:940: in exec_module
    ???
<frozen importlib._bootstrap>:241: in _call_with_frames_removed
    ???
lib/hmmlearn/tests/__init__.py:9: in <module>
    from hmmlearn.base import DECODER_ALGORITHMS
lib/hmmlearn/base.py:12: in <module>
    from . import _hmmc, _kl_divergence as _kl, _utils
E   ImportError: cannot import name '_hmmc' from 'hmmlearn' (/home/bacon/Pkgsrc/pkgsrc/wip/py-hmmlearn/work/hmmlearn-0.3.0/lib/hmmlearn/__init__.py)            
=========================== short test summary info ============================
ERROR  - ImportError: cannot import name '_hmmc' from 'hmmlearn' (/home/bacon/Pkgsrc...
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 1.26s ===============================
*** Error code 2

Stop.
bmake[1]: stopped in /home/bacon/Pkgsrc/pkgsrc/wip/py-hmmlearn
*** Error code 1

Stop.
bmake: stopped in /home/bacon/Pkgsrc/pkgsrc/wip/py-hmmlearn
@blckmaxima
Copy link
Contributor

Hello!

I've seen this before (we communicated privately about pkgsrc maintainership).

I believe the way the tests are integrated in the repository, it is expecting the module to be built "inplace" via python setup.py develop before running the tests.

In my local pkgsrc repo I have the following

do-test:
+       cd ${WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHONBIN} setup.py develop
        cd ${WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHONBIN} -m pytest -s

This has the unfortunate effect of building this library twice.

It is low-priority for me to revamp the build system here.

@outpaddling
Copy link
Author

That works, thanks. I don't see a problem with the second build when running "make test".

However, several tests are failing on all platforms (Alma, macOS, NetBSD). Results from macOS below.

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED doc/source/tutorial.rst::tutorial.rst
FAILED lib/hmmlearn/tests/test_variational_gaussian.py::TestFull::test_fit_mcgrory_titterington1d[scaling] - AssertionError: array([[-1.20874339],
FAILED lib/hmmlearn/tests/test_variational_gaussian.py::TestFull::test_fit_mcgrory_titterington1d[log] - AssertionError: array([[-1.20874339],
FAILED lib/hmmlearn/tests/test_variational_gaussian.py::TestTied::test_fit_mcgrory_titterington1d[scaling] - AssertionError: array([[ 0.78750943],
FAILED lib/hmmlearn/tests/test_variational_gaussian.py::TestTied::test_fit_mcgrory_titterington1d[log] - AssertionError: array([[ 0.78750943],
FAILED lib/hmmlearn/tests/test_variational_gaussian.py::TestSpherical::test_fit_mcgrory_titterington1d[scaling] - AssertionError: array([[-1.20874339],
FAILED lib/hmmlearn/tests/test_variational_gaussian.py::TestSpherical::test_fit_mcgrory_titterington1d[log] - AssertionError: array([[-1.20874339],
FAILED lib/hmmlearn/tests/test_variational_gaussian.py::TestDiagonal::test_fit_mcgrory_titterington1d[scaling] - AssertionError: array([[-1.20874339],
FAILED lib/hmmlearn/tests/test_variational_gaussian.py::TestDiagonal::test_fit_mcgrory_titterington1d[log] - AssertionError: array([[-1.20874339],
===== 9 failed, 286 passed, 16 xfailed, 10 xpassed, 163 warnings in 16.64s =====
*** Error code 1

@blckmaxima
Copy link
Contributor

blckmaxima commented Dec 28, 2023 via email

@outpaddling
Copy link
Author

Not sure what this is, but the tutorial.rst test fails on all platforms, and this actually seems to terminate testing in the FreeBSD port.

pkgsrc:

collected 321 items                                                            

doc/source/tutorial.rst F
lib/hmmlearn/tests/test_base.py ................

FreeBSD:

collected 321 items                                                            

doc/source/tutorial.rst ld-elf.so.1: Can't find module with TLS index 1
*** Error code 1

Stop.

@blckmaxima
Copy link
Contributor

blckmaxima commented Dec 29, 2023 via email

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