-
Notifications
You must be signed in to change notification settings - Fork 38
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
p4p incompatible with NumPy 2.0 #145
Comments
Oh goody... Any idea how to accommodate both numpy 1.x and 2.x series without (somehow) doubling the .whl files? fyi. the error comes from cython. |
Unsure... @coretl might have some ideas... |
I've done some digging and it looks like Numpy is pulling some magic under the covers to make 2.0 builds compatible with 1.* builds. They have a guide here, which seems to simply say that you build against 2.* and it'll work for 1.*. There's a caveat about what Python versions it may work with though; Numpy 2.0 is Python3.9+, so care will have to be taken to continue supporting older Python versions. |
until epics-base/p4p#145 is fixed
For reference, look at how scipy or Matplotlib are doing this. For unsupported versions of Python (<=3.8) you will need to fallback to |
p4p now seems to require numpy 2.0. Is this intended? It appears to make p4p impossible to install.
This shows up in setup.py:
I wonder if this is inheriting a numpy 2.0 dependence somehow? Yep, the problem is here. The problem code appears to have been committed by @OCopping 10 hours ago. |
@finnoshea Which version of python are you using? Which platform? Do you expect/want to use a pre-built wheel? I think you are correct that the The original logic was to build wheels against a fairly old numpy, which was in practice ABI compatible with newer versions at runtime. For numpy 2.x, I'm not sure what the oldest backwards compatible version is wrt. ABI. install_requires = [ ... ] # existing deps excluding numpy
if numpy.lib.NumpyVersion(numpy.__version__) >= '2.0.0b1':
install_requires += ['numpy >= 1.7', 'numpy < 3']
else:
install_requires += ['numpy >=%s'%numpy.version.short_version, 'numpy < 2'] I pick #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION |
Please read the manual (also already linked above): https://numpy.org/devdocs/dev/depending_on_numpy.html#adding-a-dependency-on-numpy |
I did last month, and I have again now. I admit that I was confusing the existing This document does not address also supporting source builds against 1.x, which I think P4P needs to support. So I think the condition I wrote above will be necessary, with the addition of defining the per-processor macro |
Apologies for the verbose dump in this comment. I've been trying to install p4p in a Docker container. Here is the Dockerfile I inherited:
I've had to excise the poetry stuff from there, because it does not play well with pytorch. The two files of interest to you are requirements.txt:
and p4p_reqs.txt:
Below is the error I get when trying to
I've tried cloning the p4p repo and adjusting the contents of setup.py and pyproject.toml, but then I run into incompatibility issues with pvxslibs. I don't know how necessary those required dependencies are, so I don't want to just bulldoze through them all. |
At the risk of commenting too much, when I change
in a cloned repo, I get the following error:
|
This verbosity can be avoided by attaching as a text file. |
On attempting to load p4p with the latest release of NumPy raises errors due to being compiled against the previous version.
The text was updated successfully, but these errors were encountered: