Skip to content

The numpy version in the setup_requires is wrong #974

Open
@vnmabus

Description

@vnmabus

The NumPy version in setup_requires should be the oldest supported NumPy version. This way GPy is compiled with that oldest version and you can then use any newer version, as they are ABI compatible.

For that you can specify oldest-supported-numpy as a build dependency in setup_requires instead of numpy, as explained here: https://numpy.org/devdocs/user/depending_on_numpy.html?highlight=mean#build-time-dependency.

The problem if you don't do that is that, if you install GPy along with any other package (such as numba) which cannot use the latest NumPy version, in an environment without NumPy, then GPy will be compiled against the latest NumPy version and THEN the NumPy version will be downgraded, giving the following error on import:

import GPy
  File "/home/carlos/Programas/Utilidades/Lenguajes/miniconda3/envs/test_numba/lib/python3.8/site-packages/GPy/__init__.py", line 6, in <module>
    from . import core
  File "/home/carlos/Programas/Utilidades/Lenguajes/miniconda3/envs/test_numba/lib/python3.8/site-packages/GPy/core/__init__.py", line 49, in <module>
    from .gp import GP
  File "/home/carlos/Programas/Utilidades/Lenguajes/miniconda3/envs/test_numba/lib/python3.8/site-packages/GPy/core/gp.py", line 8, in <module>
    from .. import likelihoods
  File "/home/carlos/Programas/Utilidades/Lenguajes/miniconda3/envs/test_numba/lib/python3.8/site-packages/GPy/likelihoods/__init__.py", line 25, in <module>
    from .bernoulli import Bernoulli
  File "/home/carlos/Programas/Utilidades/Lenguajes/miniconda3/envs/test_numba/lib/python3.8/site-packages/GPy/likelihoods/bernoulli.py", line 5, in <module>
    from ..util.univariate_Gaussian import std_norm_pdf, std_norm_cdf, derivLogCdfNormal, logCdfNormal
  File "/home/carlos/Programas/Utilidades/Lenguajes/miniconda3/envs/test_numba/lib/python3.8/site-packages/GPy/util/__init__.py", line 11, in <module>
    from . import linalg
  File "/home/carlos/Programas/Utilidades/Lenguajes/miniconda3/envs/test_numba/lib/python3.8/site-packages/GPy/util/linalg.py", line 15, in <module>
    from . import linalg_cython
  File "GPy/util/linalg_cython.pyx", line 1, in init GPy.util.linalg_cython
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 80 from PyObject

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions