Pyomo / pyomo

An object-oriented algebraic modeling language in Python for structured optimization problems.
https://www.pyomo.org
Other
1.92k stars 494 forks source link

errors during tests: RecursionError: maximum recursion depth exceeded in comparison #3232

Closed yurivict closed 3 months ago

yurivict commented 3 months ago
cd /usr/ports/math/py-Pyomo/work-py39/pyomo-6.7.1 && /usr/bin/env -i HOME=/usr/ports/math/py-Pyomo/work-py39  PWD="${PWD}"  __MAKE_CONF=/nonexistent OSVERSION=1400509 PATH=/usr/local/libexec/ccache:/usr/ports/math/py-Pyomo/work-py39/.bin:/home/yuri/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin TERM=xterm-256color XDG_DATA_HOME=/usr/ports/math/py-Pyomo/work-py39  XDG_CONFIG_HOME=/usr/ports/math/py-Pyomo/work-py39  XDG_CACHE_HOME=/usr/ports/math/py-Pyomo/work-py39/.cache  HOME=/usr/ports/math/py-Pyomo/work-py39 PATH=/usr/local/libexec/ccache:/usr/ports/math/py-Pyomo/work-py39/.bin:/home/yuri/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin PKG_CONFIG_LIBDIR=/usr/ports/math/py-Pyomo/work-py39/.pkgconfig:/usr/local/libdata/pkgconfig:/usr/local/share/pkgconfig:/usr/libdata/pkgconfig MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES LDSHARED="cc -shared" PYTHONDONTWRITEBYTECODE= PYTHONOPTIMIZE= PREFIX=/usr/local  LOCALBASE=/usr/local  CC="cc" CFLAGS="-O2 -pipe  -fstack-protector-strong -fno-strict-aliasing "  CPP="cpp" CPPFLAGS=""  LDFLAGS=" -fstack-protector-strong " LIBS=""  CXX="c++" CXXFLAGS="-O2 -pipe -fstack-protector-strong -fno-strict-aliasing  " CCACHE_DIR="/tmp/.ccache" BSD_INSTALL_PROGRAM="install  -s -m 555"  BSD_INSTALL_LIB="install  -s -m 0644"  BSD_INSTALL_SCRIPT="install  -m 555"  BSD_INSTALL_DATA="install  -m 0644"  BSD_INSTALL_MAN="install  -m 444" /usr/local/bin/python3.9 -m pytest -k '' -rs -v -o addopts= 
==================================================================================== test session starts ====================================================================================
platform freebsd14 -- Python 3.9.18, pytest-7.4.4, pluggy-1.4.0 -- /usr/local/bin/python3.9
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase(PosixPath('/usr/ports/math/py-Pyomo/work-py39/pyomo-6.7.1/.hypothesis/examples'))
Using --randomly-seed=3878283185
rootdir: /usr/ports/math/py-Pyomo/work-py39/pyomo-6.7.1
configfile: setup.cfg
plugins: anyio-4.3.0, hypothesis-6.98.18, datadir-1.5.0, cov-4.1.0, flake8-1.1.1, randomly-3.12.0, timeout-2.1.0, time-machine-2.11.0, rerunfailures-11.1.2, flaky-3.7.0, forked-1.6.0, aspectlib-2.0.0, xdist-3.5.0, env-0.6.2, mock-3.10.0, subtests-0.12.1, parallel-0.1.1
collected 16419 items / 2 errors / 21 skipped                                                                                                                                               

========================================================================================== ERRORS ===========================================================================================
____________________________________________________________ ERROR collecting pyomo/contrib/viewer/tests/test_data_model_item.py ____________________________________________________________
pyomo/contrib/viewer/tests/test_data_model_item.py:51: in <module>
    x = pyo.units.m
pyomo/core/base/units_container.py:1086: in __getattr__
    pint_registry = self._pint_registry
pyomo/core/base/units_container.py:1086: in __getattr__
    pint_registry = self._pint_registry
pyomo/core/base/units_container.py:1086: in __getattr__
    pint_registry = self._pint_registry
E   RecursionError: maximum recursion depth exceeded in comparison
!!! Recursion detected (same locals & position)
____________________________________________________________ ERROR collecting pyomo/contrib/viewer/tests/test_data_model_tree.py ____________________________________________________________
pyomo/contrib/viewer/tests/test_data_model_tree.py:47: in <module>
    _x = pyo.units.m
pyomo/core/base/units_container.py:1086: in __getattr__
    pint_registry = self._pint_registry
pyomo/core/base/units_container.py:1086: in __getattr__
    pint_registry = self._pint_registry
pyomo/core/base/units_container.py:1086: in __getattr__
    pint_registry = self._pint_registry
E   RecursionError: maximum recursion depth exceeded in comparison
!!! Recursion detected (same locals & position)
===================================================================================== warnings summary ======================================================================================
../../../../../local/lib/python3.9/site-packages/qtconsole/mainwindow.py:14
  /usr/local/lib/python3.9/site-packages/qtconsole/mainwindow.py:14: DeprecationWarning: Jupyter is migrating its paths to use standard platformdirs
  given by the platformdirs library.  To remove this warning and
  see the appropriate new directories, set the environment variable
  `JUPYTER_PLATFORM_DIRS=1` and then run `jupyter --paths`.
  The use of platformdirs will be the default in `jupyter_core` v6
    from jupyter_core.paths import jupyter_runtime_dir

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================== short test summary info ==================================================================================
SKIPPED [1] pyomo/contrib/appsi/solvers/tests/test_gurobi_persistent.py:24: unittest.case.SkipTest
SKIPPED [1] pyomo/contrib/appsi/solvers/tests/test_highs_persistent.py:26: unittest.case.SkipTest
SKIPPED [1] pyomo/contrib/interior_point/tests/test_inverse_reduced_hessian.py:32: unittest.case.SkipTest: inverse_reduced_hessian tests require numpy, scipy, and asl
SKIPPED [1] pyomo/contrib/interior_point/tests/test_realloc.py:30: unittest.case.SkipTest: Regularization tests require ASL
SKIPPED [1] pyomo/contrib/interior_point/tests/test_reg.py:33: unittest.case.SkipTest: Regularization tests require ASL
SKIPPED [1] pyomo/contrib/pynumero/algorithms/solvers/tests/test_cyipopt_interfaces.py:29: unittest.case.SkipTest: Pynumero needs the ASL extension to run CyIpoptSolver tests
SKIPPED [1] pyomo/contrib/pynumero/algorithms/solvers/tests/test_cyipopt_solver.py:31: unittest.case.SkipTest: Pynumero needs the ASL extension to run CyIpoptSolver tests
SKIPPED [1] pyomo/contrib/pynumero/algorithms/solvers/tests/test_implicit_functions.py:40: unittest.case.SkipTest: PyNumero ASL extension is necessary to test implicit function solvers
SKIPPED [1] pyomo/contrib/pynumero/algorithms/solvers/tests/test_pyomo_ext_cyipopt.py:30: unittest.case.SkipTest: Pynumero needs the ASL extension to run CyIpoptSolver tests
SKIPPED [1] pyomo/contrib/pynumero/examples/tests/test_cyipopt_examples.py:44: unittest.case.SkipTest: Pynumero needs the ASL extension to run CyIpopt tests
SKIPPED [1] pyomo/contrib/pynumero/examples/tests/test_examples.py:23: unittest.case.SkipTest: Pynumero examples need ASL
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_cyipopt_interface.py:28: unittest.case.SkipTest: Pynumero needs the ASL extension to run CyIpopt tests
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_dynamic_model.py:31: unittest.case.SkipTest: Pynumero needs the ASL extension to run CyIpoptSolver tests
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_external_asl_function.py:25: unittest.case.SkipTest: Pynumero needs the ASL extension to run NLP tests
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_external_grey_box_model.py:30: unittest.case.SkipTest: Pynumero needs the ASL extension to run cyipopt tests
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_external_pyomo_block.py:33: unittest.case.SkipTest: Pynumero needs the ASL extension to run cyipopt tests
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_external_pyomo_model.py:31: unittest.case.SkipTest: Pynumero needs the ASL extension to run cyipopt tests
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_nlp.py:28: unittest.case.SkipTest: Pynumero needs the ASL extension to run NLP tests
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_nlp_projections.py:27: unittest.case.SkipTest: Pynumero needs the ASL extension to run NLP tests
SKIPPED [1] pyomo/contrib/pynumero/interfaces/tests/test_pyomo_grey_box_nlp.py:30: unittest.case.SkipTest: Pynumero needs the ASL extension to run cyipopt tests
SKIPPED [1] pyomo/contrib/solver/tests/solvers/test_gurobi_persistent.py:21: unittest.case.SkipTest
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================================================= 21 skipped, 1 warning, 2 errors in 49.71s =========================================================================
*** Error code 2

Version: 6.7.1 Python-3.9 FreeBSD 14.0

mrmundt commented 3 months ago

@yurivict - The contrib.viewer module tests are rather fragile. As you can see in https://github.com/Pyomo/pyomo/blob/main/setup.py#L281:

            # qtconsole also requires a supported Qt version (PyQt5 or PySide6).
            # Because those are environment specific, we have left that out here.
            'qtconsole',  # contrib.viewer

The contrib.viewer documentation also notes this. It is likely that your environment is not properly configured for those specific tests.

mrmundt commented 3 months ago

Also for more information on how fragile these tests are... https://github.com/Pyomo/pyomo/issues/2289 <- we had a whole issue for it that took me quite a while to diagnose.