-
Notifications
You must be signed in to change notification settings - Fork 4
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
"numpy.ndarray size changed" error when installing pydivsufsort
together with tensorflow==2.6.0
#30
Comments
pydivsufsort
together with tensorflow==2.6.0pydivsufsort
together with tensorflow==2.6.0
pydivsufsort
together with tensorflow==2.6.0pydivsufsort
together with tensorflow==2.6.0
Hi, thank you for the report. Could you try installing with the |
Hi! Thanks for the fast reply. I have tried to, but the build fails with a compilation error I do not understand:
|
I can reproduce on colab but don't understand either. I was able to install on colab with
I hope it can work for you! |
I have followed the advice on upgrading |
Also, can you provide a code example for your bug? |
Yes, thank you. Sorry, yes, the code example is just importing:
Before your last suggestion, on a
However now, after your
So I guess it is a good thing that it does not complain about the Are you able to reproduce? I have the same result on 2 different Ubuntu machines. |
Btw, it seems like we have already discussed a similar topic here |
No, I cannot reproduce on Ubuntu: https://colab.research.google.com/drive/1jCyYm41NbYE5TjhV3-PKcJQToriXU0As?usp=sharing Maybe you can try to clone and run those installation steps: https://github.com/louisabraham/pydivsufsort/blob/master/.travis.yml#L43-L47 They are used on linux arm64 because the standard pip way fails. |
@Alexander-Serov Out of curiosity, what happens if you create a clean/separate environment and only install |
@seanlaw Yes, it does. Everything is fine. In my opinion, it is because
However if I downgrade
Apparently, the wheel version available on pip has an implicit requirement of |
But it's true, I don't know how it works on the |
I know exactly why the program fails with the wheels: as you said pydivsufsort was compiled for a different version of NumPy. Hence the best solution is to install directly from the sources and try to solve the path issue. Did you try the other steps? |
I am looking into the .yml steps, yes. |
Well, I have played around a bit with the .yml and the path problem, and it seems like there are no
files in my installation folder. Even if I git clone directly the repository for github and init the submodules, the
So naturally, when you do a glob on the folder, there are no files matching the pattern. There is a folder |
@Alexander-Serov When installing from source, I have had some success doing the following:
On my machine, this installed:
Can you try this? |
Hi @seanlaw, This does indeed work, thank you! The libdiv files are built and the correctly installed (with For those trying after me, not that you have to So thanks again! I just need to find a way now to integrate it into my pipelines! |
Great! I'm glad you figured it out.
Yes, this is because Python will try to import from the local |
Thanks for the fast replies. The issue is solved, I am closing! |
Thank you @seanlaw !!! |
By the way, is there a way I can contribute to the repository, so that it also builds automatically a version for this numpy version? That could help other people facing the problem and me with integration into my pipelines. |
No I don't think there is a possibility for specifying requirements like
this on pypi and have pre built versions.
So the source install should be used, by using the no binary option, and
will work once Sean is done with his changes.
…On Fri, Nov 5, 2021, 11:16 Alexander Serov ***@***.***> wrote:
By the way, is there a way I can contribute to the repository, so that it
also builds automatically a version for this numpy version? That could help
other people facing the problem and me with integration into my pipelines.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#30 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADEQQFIK64LC7W26Q742JG3UKOVG5ANCNFSM5G7KCJEA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
@louisabraham I am not well educated on this so please educate me. Is there a reason why this package needs to be tied to a specific version of NumPy? I understand having a minimum supported version but I didn't realize the wheels were pinned to a specific NumPy version? To ask the question differently, can you think of a way to resolve this so that the wheels are compatible with versions of NumPy that are newer than the one packaged with the wheels? But, firstly, I'd like to educate myself on why this is a problem as I'm not well versed here. |
@louisabraham Isn't it possible to have one pre-compiled version of pydivsufsort for strictly numpy>=1.20 and one for strictly numpy<1.20. This could allow us to specify which wheel should be used, no? @seanlaw The problem seems to come from a change in the numpy C interface in the version 1.20. My understanding is that apparently some part of a compiled binary code (perhaps from |
Where can I follow @seanlaw 's changes? |
I have a naive question. Instead of focusing on the specific NumPy version, is there something that change or add like a
What I am doing isn't necessarily focused on the NumPy version but to figure out how to separate the frontend from the backend. Some work is starting in #34 |
I don't think we are talking about the same things here. So basically you would need to just release a, say, |
I don't think a try except would do anything. @Alexander-Serov it's just not how pip works. pip just tries to download the latest version and apply its requirements. The base of the issue is this: https://numpy.org/devdocs/release/1.20.0-notes.html#size-of-np-ndarray-and-np-void-changed However, this blog post is interesting: https://ymd_h.gitlab.io/ymd_blog/posts/numpy_1_20_abi_change/ It indicates that we might be able to deliver pre-built packages that are compatible with all versions of NumPy if we build them with the older API. I also found this: https://stackoverflow.com/a/40846742/5133167 Apparently, Cython does its job too well and the exception is just a warning that we can ignore in the specific case of numpy that ensures binary compability. I think the second solution is a better idea. Do you want to propose a PR? |
@louisabraham I am positive that
I think it worked like you say a year ago but has since evolved. But I don't insist. |
Oh very interesting!!! Sorry, I didn't know, thanks for the information. However I'm not sure deploying two versions each time with two different sets of requirements is the best idea. It seems that the exception can actually be ignored, so this is definitely the best way. |
As for the second solution you are suggesting, it looks interesting. But in the stackexchange post you are referring, the message is indeed a warning and the code seems to run. While in my case, it is clearly a ValueError and a specific size mismatch is cited (80 v. 88). Do you think it still applies? Also, following on the same SE solution you cited, one of the conclusions of the scipy authors seems to be:
If we applied it here, again, we would return to the idea of building against the lowest valid supported version of numpy. I would tend to interpret this as |
What I meant is you don't need to deploy 2 versions every time. Just deploy once a version |
We have a possible solution that would allow everyone to benefit from the last updates so let's try it! I don't want to support 2 versions of the package if I can avoid it. |
The SO question definitely has an error. We can try it, else I don't mind using an older version of numpy, I'm using basic features. |
Which possible solution of the 2 I mentioned do you have in mind? :) Otherwise, I can make a PR, no problem. I will also reopen this issue, just to keep track. |
On StackExchange, they are able to ignore the warning exactly because it is a warning, I feel (https://stackoverflow.com/a/40846742/2470337):
Their original message:
says warning. |
it's actually a cython problem so I asked there cython/cython#4452 |
Good idea! Let's see what they say. |
This is a great discussion and I am learning a lot so thank you both!
I agree that we'd want to avoid deploying two versions. I hope the Cython folks have a solution that solves all of our needs! 🤞 |
@Alexander-Serov Is this something that you have experience with or would be willing to help assist with? It'll take some time for me to wrap my head around it and then find an opportunity to address it. It's at least somewhat stable but far from ready. |
Just to copy what I posted on the Cython issue:
|
Perfect! That's a simple solution. From what I've seen, pydiv does not use any new new numpy functionality. How low can the numpy version we can build it with then be, you think? |
Apparently the proposed numpy version is not optimal for some configs. Re-opening until built correctly. |
Oops Cannot re-open. :) |
Please see #35 (comment) |
There seems to be some incompatibility between the C-interface of
pydivsufsort
and that of numpy.The observations are:
After some extensive searching on the internet, I have found out it is likely related to the
numpy
's change of the C-interface:https://stackoverflow.com/questions/66060487/valueerror-numpy-ndarray-size-changed-may-indicate-binary-incompatibility-exp
And in particular this answer, which also avoid updating
numpy
(it is imposed by my Tensorflow):https://stackoverflow.com/a/69528768/2470337
So I was wondering if you have any idea of what this error may mean and how it could be corrected?
Ubuntu`pip freeze`
I only have this problem on Ubuntu systems. On Windows everything works just fine. My Windows
pip freeze
:Windows `pip freeze`
The text was updated successfully, but these errors were encountered: