Skip to content

6 tests fail #853

Closed
Closed

Description

@yurivict
================================================================================================================== FAILURES ==================================================================================================================
______________________________________________________________________________________________________ test_jive_docstring_examples_run ______________________________________________________________________________________________________

    def test_jive_docstring_examples_run():
        with_examples, failures = run_docstring_examples(IVJIVE, "IVJIVE")
>       assert not failures, "".join(failures)
E       AssertionError: Trying:
E             import numpy as np
E         Expecting nothing
E         ok
E         Trying:
E             from linearmodels.iv import IVJIVE
E         Expecting nothing
E         ok
E         Trying:
E             rng = np.random.default_rng(0)
E         Expecting nothing
E         ok
E         Trying:
E             n = 500
E         Expecting nothing
E         ok
E         Trying:
E             z = rng.standard_normal((n, 3))
E         Expecting nothing
E         ok
E         Trying:
E             x = z[:, 0] + rng.standard_normal(n)
E         Expecting nothing
E         ok
E         Trying:
E             exog = np.ones((n, 1))
E         Expecting nothing
E         ok
E         Trying:
E             y = x + rng.standard_normal(n)
E         Expecting nothing
E         ok
E         Trying:
E             mod = IVJIVE(y, exog, x[:, None], z)
E         Expecting nothing
E         ok
E         Trying:
E             res = mod.fit()
E         Expecting nothing
E         ok
E         Trying:
E             from linearmodels.datasets import wage
E         Expecting nothing
E         ok
E         Trying:
E             from linearmodels.iv import IVJIVE
E         Expecting nothing
E         ok
E         Trying:
E             data = wage.load()
E         Expecting nothing
E         ok
E         Trying:
E             formula = "np.log(wage) ~ 1 + exper + I(exper ** 2) + brthord + [educ ~ sibs]"
E         Expecting nothing
E         ok
E         Trying:
E             mod = IVJIVE.from_formula(formula, data)
E         Expecting nothing
E         ok
E         
E       assert not ['Trying:\n    import numpy as np\nExpecting nothing\n', 'ok\n', 'Trying:\n    from linearmodels.iv import IVJIVE\nExpecting nothing\n', 'ok\n', 'Trying:\n    rng = np.random.default_rng(0)\nExpecting nothing\n', 'ok\n', ...]

linearmodels/tests/iv/test_new_feature_hardening.py:102: AssertionError
____________________________________________________________________________ test_system_gmm_explicit_bandwidth_works_with_the_observations_that_raise[bartlett] _____________________________________________________________________________

kernel = 'bartlett'

    @pytest.mark.parametrize("kernel", CANONICAL)
    def test_system_gmm_explicit_bandwidth_works_with_the_observations_that_raise(kernel):
        nobs = fewest_observations(kernel) - 1
        equations = system_equations(nobs, True)
        explicit = IVSystemGMM(
            equations, weight_type="kernel", kernel=kernel, bandwidth=1
>       ).fit()
          ^^^^^

linearmodels/tests/test_kernel_bandwidth_few_observations.py:951: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
linearmodels/system/model.py:2514: in fit
    vinv = inv(v)
           ^^^^^^
/usr/local/lib/python3.12/site-packages/numpy/linalg/_linalg.py:647: in inv
    ainv = _umath_linalg.inv(a, signature=signature)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

err = 'invalid value', flag = 8

    def _raise_linalgerror_singular(err, flag):
>       raise LinAlgError("Singular matrix")
E       numpy.linalg.LinAlgError: Singular matrix

/usr/local/lib/python3.12/site-packages/numpy/linalg/_linalg.py:144: LinAlgError
_____________________________________________________________________________ test_system_gmm_explicit_bandwidth_works_with_the_observations_that_raise[parzen] ______________________________________________________________________________

kernel = 'parzen'

    @pytest.mark.parametrize("kernel", CANONICAL)
    def test_system_gmm_explicit_bandwidth_works_with_the_observations_that_raise(kernel):
        nobs = fewest_observations(kernel) - 1
        equations = system_equations(nobs, True)
        explicit = IVSystemGMM(
            equations, weight_type="kernel", kernel=kernel, bandwidth=1
        ).fit()
        assert explicit.weight_config["bandwidth"] == 1
        restored = IVSystemGMM(
            equations, weight_type="kernel", kernel=kernel, optimal_bw=False
>       ).fit()
          ^^^^^

linearmodels/tests/test_kernel_bandwidth_few_observations.py:955: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
linearmodels/system/model.py:2501: in fit
    beta = self._blocked_gmm(
linearmodels/system/model.py:2587: in _blocked_gmm
    wi = np.linalg.inv(w)
         ^^^^^^^^^^^^^^^^
/usr/local/lib/python3.12/site-packages/numpy/linalg/_linalg.py:647: in inv
    ainv = _umath_linalg.inv(a, signature=signature)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

err = 'invalid value', flag = 8

    def _raise_linalgerror_singular(err, flag):
>       raise LinAlgError("Singular matrix")
E       numpy.linalg.LinAlgError: Singular matrix

/usr/local/lib/python3.12/site-packages/numpy/linalg/_linalg.py:144: LinAlgError
___________________________________________________________________________________________ test_system_gmm_with_the_fewest_observations[bartlett] ___________________________________________________________________________________________

kernel = 'bartlett'

    @pytest.mark.parametrize("kernel", CANONICAL)
    def test_system_gmm_with_the_fewest_observations(kernel):
        nobs = fewest_observations(kernel)
        equations = system_equations(nobs, True)
        res = IVSystemGMM(
            equations, weight_type="kernel", kernel=kernel, optimal_bw=True
>       ).fit(cov_type="kernel", kernel=kernel)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

linearmodels/tests/test_kernel_bandwidth_few_observations.py:965: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
linearmodels/system/model.py:2501: in fit
    beta = self._blocked_gmm(
linearmodels/system/model.py:2587: in _blocked_gmm
    wi = np.linalg.inv(w)
         ^^^^^^^^^^^^^^^^
/usr/local/lib/python3.12/site-packages/numpy/linalg/_linalg.py:647: in inv
    ainv = _umath_linalg.inv(a, signature=signature)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

err = 'invalid value', flag = 8

    def _raise_linalgerror_singular(err, flag):
>       raise LinAlgError("Singular matrix")
E       numpy.linalg.LinAlgError: Singular matrix

/usr/local/lib/python3.12/site-packages/numpy/linalg/_linalg.py:144: LinAlgError
________________________________________________________________________________________________________________ test_runner _________________________________________________________________________________________________________________
'gpu' not found in `markers` configuration option
------------------------------------------------------------------------------------------------------------ Captured stdout call ------------------------------------------------------------------------------------------------------------
tests/shared/test_typed_getters.py
/usr/ports/math/py-linearmodels/work-py312/linearmodels-7.1/linearmodels
/usr/ports/math/py-linearmodels/work-py312/linearmodels-7.1/linearmodels/tests/shared/test_typed_getters.py
running: pytest /usr/ports/math/py-linearmodels/work-py312/linearmodels-7.1/linearmodels/tests/shared/test_typed_getters.py --tb=auto
______________________________________________________________________________________________________________ test_extra_args _______________________________________________________________________________________________________________
'gpu' not found in `markers` configuration option
------------------------------------------------------------------------------------------------------------ Captured stdout call ------------------------------------------------------------------------------------------------------------
tests/shared/test_typed_getters.py
/usr/ports/math/py-linearmodels/work-py312/linearmodels-7.1/linearmodels
/usr/ports/math/py-linearmodels/work-py312/linearmodels-7.1/linearmodels/tests/shared/test_typed_getters.py
running: pytest /usr/ports/math/py-linearmodels/work-py312/linearmodels-7.1/linearmodels/tests/shared/test_typed_getters.py --tb=short
============================================================================================================== warnings summary ==============================================================================================================
linearmodels/tests/test_tester.py::test_runner
linearmodels/tests/test_tester.py::test_extra_args
  /usr/local/lib/python3.12/site-packages/dash/testing/plugin.py:104: PytestRemovedIn10Warning: The hookimpl pytest_addhooks uses old-style configuration options (marks or attributes).
  Please use the pytest.hookimpl(tryfirst=True) decorator instead
   to configure the hooks.
   See https://docs.pytest.org/en/latest/deprecations.html#configuring-hook-specs-impls-using-markers
    @pytest.mark.tryfirst

linearmodels/tests/test_tester.py::test_runner
linearmodels/tests/test_tester.py::test_extra_args
  /usr/local/lib/python3.12/site-packages/aiomisc/pytest.py:541: PytestRemovedIn10Warning: The hookimpl pytest_pyfunc_call uses old-style configuration options (marks or attributes).
  Please use the pytest.hookimpl(tryfirst=True) decorator instead
   to configure the hooks.
   See https://docs.pytest.org/en/latest/deprecations.html#configuring-hook-specs-impls-using-markers
    @pytest.mark.tryfirst

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:45: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    dynamic: list[str] | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:57: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    supported_platform: list[str] | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:72: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    description_content_type: str | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:89: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    download_url: str | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:105: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    maintainer: str | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:111: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    maintainer_email: str | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:126: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    classifier: list[str] | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:133: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    requires_dist: list[str] | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:140: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    requires_python: str | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:148: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    requires_external: list[str] | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:157: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    project_url: list[str] | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:163: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    provides_extra: list[str] | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:172: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    provides_dist: list[str] | None = Field(None, min_ver="1.2")

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:173: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    obsoletes_dist: list[str] | None = Field(None, min_ver="1.2")

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/contributions/_contributions.py:46: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'hide_docs'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    keybindings: list[KeyBindingContribution] | None = Field(None, hide_docs=True)

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/schema.py:101: PydanticDeprecatedSince20: `allow_mutation` is deprecated and will be removed. use `frozen` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    name: Annotated[str, BeforeValidator(_validators.package_name)] = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/schema.py:197: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'hide_docs'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    package_metadata: PackageMetadata | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/schema.py:206: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'hide_docs'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    npe1_shim: bool = Field(

-- Docs: https:================================================================================================================== FAILURES ==================================================================================================================
______________________________________________________________________________________________________ test_jive_docstring_examples_run ______________________________________________________________________________________________________

    def test_jive_docstring_examples_run():
        with_examples, failures = run_docstring_examples(IVJIVE, "IVJIVE")
>       assert not failures, "".join(failures)
E       AssertionError: Trying:
E             import numpy as np
E         Expecting nothing
E         ok
E         Trying:
E             from linearmodels.iv import IVJIVE
E         Expecting nothing
E         ok
E         Trying:
E             rng = np.random.default_rng(0)
E         Expecting nothing
E         ok
E         Trying:
E             n = 500
E         Expecting nothing
E         ok
E         Trying:
E             z = rng.standard_normal((n, 3))
E         Expecting nothing
E         ok
E         Trying:
E             x = z[:, 0] + rng.standard_normal(n)
E         Expecting nothing
E         ok
E         Trying:
E             exog = np.ones((n, 1))
E         Expecting nothing
E         ok
E         Trying:
E             y = x + rng.standard_normal(n)
E         Expecting nothing
E         ok
E         Trying:
E             mod = IVJIVE(y, exog, x[:, None], z)
E         Expecting nothing
E         ok
E         Trying:
E             res = mod.fit()
E         Expecting nothing
E         ok
E         Trying:
E             from linearmodels.datasets import wage
E         Expecting nothing
E         ok
E         Trying:
E             from linearmodels.iv import IVJIVE
E         Expecting nothing
E         ok
E         Trying:
E             data = wage.load()
E         Expecting nothing
E         ok
E         Trying:
E             formula = "np.log(wage) ~ 1 + exper + I(exper ** 2) + brthord + [educ ~ sibs]"
E         Expecting nothing
E         ok
E         Trying:
E             mod = IVJIVE.from_formula(formula, data)
E         Expecting nothing
E         ok
E         
E       assert not ['Trying:\n    import numpy as np\nExpecting nothing\n', 'ok\n', 'Trying:\n    from linearmodels.iv import IVJIVE\nExpecting nothing\n', 'ok\n', 'Trying:\n    rng = np.random.default_rng(0)\nExpecting nothing\n', 'ok\n', ...]

linearmodels/tests/iv/test_new_feature_hardening.py:102: AssertionError
____________________________________________________________________________ test_system_gmm_explicit_bandwidth_works_with_the_observations_that_raise[bartlett] _____________________________________________________________________________

kernel = 'bartlett'

    @pytest.mark.parametrize("kernel", CANONICAL)
    def test_system_gmm_explicit_bandwidth_works_with_the_observations_that_raise(kernel):
        nobs = fewest_observations(kernel) - 1
        equations = system_equations(nobs, True)
        explicit = IVSystemGMM(
            equations, weight_type="kernel", kernel=kernel, bandwidth=1
>       ).fit()
          ^^^^^

linearmodels/tests/test_kernel_bandwidth_few_observations.py:951: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
linearmodels/system/model.py:2514: in fit
    vinv = inv(v)
           ^^^^^^
/usr/local/lib/python3.12/site-packages/numpy/linalg/_linalg.py:647: in inv
    ainv = _umath_linalg.inv(a, signature=signature)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

err = 'invalid value', flag = 8

    def _raise_linalgerror_singular(err, flag):
>       raise LinAlgError("Singular matrix")
E       numpy.linalg.LinAlgError: Singular matrix

/usr/local/lib/python3.12/site-packages/numpy/linalg/_linalg.py:144: LinAlgError
_____________________________________________________________________________ test_system_gmm_explicit_bandwidth_works_with_the_observations_that_raise[parzen] ______________________________________________________________________________

kernel = 'parzen'

    @pytest.mark.parametrize("kernel", CANONICAL)
    def test_system_gmm_explicit_bandwidth_works_with_the_observations_that_raise(kernel):
        nobs = fewest_observations(kernel) - 1
        equations = system_equations(nobs, True)
        explicit = IVSystemGMM(
            equations, weight_type="kernel", kernel=kernel, bandwidth=1
        ).fit()
        assert explicit.weight_config["bandwidth"] == 1
        restored = IVSystemGMM(
            equations, weight_type="kernel", kernel=kernel, optimal_bw=False
>       ).fit()
          ^^^^^

linearmodels/tests/test_kernel_bandwidth_few_observations.py:955: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
linearmodels/system/model.py:2501: in fit
    beta = self._blocked_gmm(
linearmodels/system/model.py:2587: in _blocked_gmm
    wi = np.linalg.inv(w)
         ^^^^^^^^^^^^^^^^
/usr/local/lib/python3.12/site-packages/numpy/linalg/_linalg.py:647: in inv
    ainv = _umath_linalg.inv(a, signature=signature)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

err = 'invalid value', flag = 8

    def _raise_linalgerror_singular(err, flag):
>       raise LinAlgError("Singular matrix")
E       numpy.linalg.LinAlgError: Singular matrix

/usr/local/lib/python3.12/site-packages/numpy/linalg/_linalg.py:144: LinAlgError
___________________________________________________________________________________________ test_system_gmm_with_the_fewest_observations[bartlett] ___________________________________________________________________________________________

kernel = 'bartlett'

    @pytest.mark.parametrize("kernel", CANONICAL)
    def test_system_gmm_with_the_fewest_observations(kernel):
        nobs = fewest_observations(kernel)
        equations = system_equations(nobs, True)
        res = IVSystemGMM(
            equations, weight_type="kernel", kernel=kernel, optimal_bw=True
>       ).fit(cov_type="kernel", kernel=kernel)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

linearmodels/tests/test_kernel_bandwidth_few_observations.py:965: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
linearmodels/system/model.py:2501: in fit
    beta = self._blocked_gmm(
linearmodels/system/model.py:2587: in _blocked_gmm
    wi = np.linalg.inv(w)
         ^^^^^^^^^^^^^^^^
/usr/local/lib/python3.12/site-packages/numpy/linalg/_linalg.py:647: in inv
    ainv = _umath_linalg.inv(a, signature=signature)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

err = 'invalid value', flag = 8

    def _raise_linalgerror_singular(err, flag):
>       raise LinAlgError("Singular matrix")
E       numpy.linalg.LinAlgError: Singular matrix

/usr/local/lib/python3.12/site-packages/numpy/linalg/_linalg.py:144: LinAlgError
________________________________________________________________________________________________________________ test_runner _________________________________________________________________________________________________________________
'gpu' not found in `markers` configuration option
------------------------------------------------------------------------------------------------------------ Captured stdout call ------------------------------------------------------------------------------------------------------------
tests/shared/test_typed_getters.py
/usr/ports/math/py-linearmodels/work-py312/linearmodels-7.1/linearmodels
/usr/ports/math/py-linearmodels/work-py312/linearmodels-7.1/linearmodels/tests/shared/test_typed_getters.py
running: pytest /usr/ports/math/py-linearmodels/work-py312/linearmodels-7.1/linearmodels/tests/shared/test_typed_getters.py --tb=auto
______________________________________________________________________________________________________________ test_extra_args _______________________________________________________________________________________________________________
'gpu' not found in `markers` configuration option
------------------------------------------------------------------------------------------------------------ Captured stdout call ------------------------------------------------------------------------------------------------------------
tests/shared/test_typed_getters.py
/usr/ports/math/py-linearmodels/work-py312/linearmodels-7.1/linearmodels
/usr/ports/math/py-linearmodels/work-py312/linearmodels-7.1/linearmodels/tests/shared/test_typed_getters.py
running: pytest /usr/ports/math/py-linearmodels/work-py312/linearmodels-7.1/linearmodels/tests/shared/test_typed_getters.py --tb=short
============================================================================================================== warnings summary ==============================================================================================================
linearmodels/tests/test_tester.py::test_runner
linearmodels/tests/test_tester.py::test_extra_args
  /usr/local/lib/python3.12/site-packages/dash/testing/plugin.py:104: PytestRemovedIn10Warning: The hookimpl pytest_addhooks uses old-style configuration options (marks or attributes).
  Please use the pytest.hookimpl(tryfirst=True) decorator instead
   to configure the hooks.
   See https://docs.pytest.org/en/latest/deprecations.html#configuring-hook-specs-impls-using-markers
    @pytest.mark.tryfirst

linearmodels/tests/test_tester.py::test_runner
linearmodels/tests/test_tester.py::test_extra_args
  /usr/local/lib/python3.12/site-packages/aiomisc/pytest.py:541: PytestRemovedIn10Warning: The hookimpl pytest_pyfunc_call uses old-style configuration options (marks or attributes).
  Please use the pytest.hookimpl(tryfirst=True) decorator instead
   to configure the hooks.
   See https://docs.pytest.org/en/latest/deprecations.html#configuring-hook-specs-impls-using-markers
    @pytest.mark.tryfirst

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:45: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    dynamic: list[str] | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:57: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    supported_platform: list[str] | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:72: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    description_content_type: str | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:89: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    download_url: str | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:105: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    maintainer: str | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:111: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    maintainer_email: str | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:126: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    classifier: list[str] | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:133: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    requires_dist: list[str] | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:140: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    requires_python: str | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:148: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    requires_external: list[str] | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:157: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    project_url: list[str] | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:163: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    provides_extra: list[str] | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:172: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    provides_dist: list[str] | None = Field(None, min_ver="1.2")

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/_package_metadata.py:173: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'min_ver'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    obsoletes_dist: list[str] | None = Field(None, min_ver="1.2")

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/contributions/_contributions.py:46: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'hide_docs'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    keybindings: list[KeyBindingContribution] | None = Field(None, hide_docs=True)

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/schema.py:101: PydanticDeprecatedSince20: `allow_mutation` is deprecated and will be removed. use `frozen` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    name: Annotated[str, BeforeValidator(_validators.package_name)] = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/schema.py:197: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'hide_docs'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    package_metadata: PackageMetadata | None = Field(

linearmodels/tests/test_tester.py::test_runner
  /usr/local/lib/python3.12/site-packages/npe2/manifest/schema.py:206: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'hide_docs'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.13/migration/
    npe1_shim: bool = Field(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================================================== short test summary info ===========================================================================================================
SKIPPED [310] linearmodels/conftest.py:42: skipping due to --skip-slow
SKIPPED [288] linearmodels/tests/iv/test_against_stata.py:194: Comparison result not available
SKIPPED [192] linearmodels/tests/iv/test_against_stata.py:167: Weighted GMM differs slightly
SKIPPED [192] linearmodels/tests/iv/test_against_stata.py:174: Weighted GMM differs slightly
SKIPPED [192] linearmodels/tests/iv/test_against_stata.py:181: Weighted GMM differs slightly
SKIPPED [192] linearmodels/tests/iv/test_against_stata.py:186: Weighted GMM differs slightly
SKIPPED [192] linearmodels/tests/iv/test_against_stata.py:191: Weighted GMM differs slightly
SKIPPED [192] linearmodels/tests/iv/test_against_stata.py:198: Weighted GMM differs slightly
SKIPPED [192] linearmodels/tests/iv/test_against_stata.py:204: Weighted GMM differs slightly
SKIPPED [192] linearmodels/tests/iv/test_against_stata.py:210: Weighted GMM differs slightly
SKIPPED [192] linearmodels/tests/iv/test_against_stata.py:217: Weighted GMM differs slightly
SKIPPED [192] linearmodels/tests/iv/test_against_stata.py:228: Weighted GMM differs slightly
SKIPPED [192] linearmodels/tests/iv/test_against_stata.py:235: Weighted GMM differs slightly
SKIPPED [4] linearmodels/tests/panel/test_formula.py:305: Cannot test with numpy arrays
SKIPPED [12] linearmodels/tests/panel/test_results.py:366: Cannot test with missing values
SKIPPED [45] linearmodels/tests/panel/test_simulated_against_stata.py:145: Result not available for testing
============================================================================= 6 failed, 22966 passed, 2771 skipped, 47 xfailed, 22 warnings in 450.45s (0:07:30) =============================================================================
*** Error code 1
//docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================================================== short test summary info ===========================================================================================================
SKIPPED [310] linearmodels/conftest.py:42: skipping due to --skip-slow
SKIPPED [288] linearmodels/tests/iv/test_against_stata.py:194: Comparison result not available
SKIPPED [192] linearmodels/tests/iv/test_against_stata.py:167: Weighted GMM differs slightly
SKIPPED [192] linearmodels/tests/iv/test_against_stata.py:174: Weighted GMM differs slightly
SKIPPED [192] linearmodels/tests/iv/test_against_stata.py:181: Weighted GMM differs slightly
SKIPPED [192] linearmodels/tests/iv/test_against_stata.py:186: Weighted GMM differs slightly
SKIPPED [192] linearmodels/tests/iv/test_against_stata.py:191: Weighted GMM differs slightly
SKIPPED [192] linearmodels/tests/iv/test_against_stata.py:198: Weighted GMM differs slightly
SKIPPED [192] linearmodels/tests/iv/test_against_stata.py:204: Weighted GMM differs slightly
SKIPPED [192] linearmodels/tests/iv/test_against_stata.py:210: Weighted GMM differs slightly
SKIPPED [192] linearmodels/tests/iv/test_against_stata.py:217: Weighted GMM differs slightly
SKIPPED [192] linearmodels/tests/iv/test_against_stata.py:228: Weighted GMM differs slightly
SKIPPED [192] linearmodels/tests/iv/test_against_stata.py:235: Weighted GMM differs slightly
SKIPPED [4] linearmodels/tests/panel/test_formula.py:305: Cannot test with numpy arrays
SKIPPED [12] linearmodels/tests/panel/test_results.py:366: Cannot test with missing values
SKIPPED [45] linearmodels/tests/panel/test_simulated_against_stata.py:145: Result not available for testing
============================================================================= 6 failed, 22966 passed, 2771 skipped, 47 xfailed, 22 warnings in 450.45s (0:07:30) =============================================================================
*** Error code 1

Version: 7.1

Activity

  1. bashtage commented on Oct 22, 2026

    @bashtage
    Owner

    These probably fall into those that are near-singular but depending on the compiler, compiler flags, blas used, and perhaps OS specifics, can be pushed over. They probably should be made more robust. What is the compiler? Clang? Am I right this is on FreeBSD?

  2. yurivict commented on Oct 22, 2026

    @yurivict
    Author

    Yes: FreeBSD, Clang-21

  3. bashtage commented on Oct 22, 2026

    @bashtage
    Owner

    These tests were knife-edge singular but passed on other platforms by luck. These tests were changed in #854, so they are less problematic. I have also added some additional instructions in the README for running tests.

  4. yurivict commented on Oct 22, 2026

    @yurivict
    Author

    Do other platforms do FP operations differently?
    How is this possible since hardware is the same and FP operations are performed by the CPU?
    Where does the "luck" come from?

  5. bashtage commented on Oct 22, 2026

    @bashtage
    Owner

    No, but the instructions used to implement a math op and the order of the instructions may differ accross compilers and system libraries (if used). Suppose we have a math op that we know is analytically 0. We could end up with a number like 1e-16, or even 1e-13 depending on the operation and the input data. If you have an exact 0, 1/0 is an error. If you have 1e-13, 1/1e-13 is not an error.

    Basically the tests were too close to 0, and occasionally gave exactly 0, hence the singular errors. These will be fixed soon so that they are all far enough from 0 that they should not raise on any platforms.

  6. bashtage commented on Oct 22, 2026

    @bashtage
    Owner

    In terms of linearmodels 7.1 passing on FreeBSD, you could either disable these tests or pull in the relevant patch from #854. All fixes are test only fixes, not changing the actual code that is run.

  7. bashtage commented on Oct 22, 2026

    @bashtage
    Owner

    I'm going to close as fixed. If you have other problems after this, please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions