google-coral / pycoral

Python API for ML inferencing and transfer-learning on Coral devices
https://coral.ai
Apache License 2.0
359 stars 146 forks source link

Python 3.10 and 3.11 support? #85

Open baudneo opened 2 years ago

baudneo commented 2 years ago

Anyone compiled pycoral for 3.10 and 3.11? I am attempting to build them but I was wondering if someone else has already done this?

David-OConnor commented 12 months ago

It appears to work on Windows, from Pip, with Python 3.11, and pycoral 0.2.0.

Edit: nvm; incorrect.

oberluz commented 12 months ago

I've created https://github.com/google-coral/pycoral/pull/128 to upgrade pycoral from 2.2.0 to 2.7.0 with support for python 3.10+

Anyone interested in wheels can either:

  1. Download them from the releases page: https://github.com/oberluz/libcoral/releases/tag/2.7.0

or

  1. Clone my repo https://github.com/oberluz/pycoral recursively and build them using the same methods used in google-coral/pycoral
David-OConnor commented 12 months ago

Hero.

FYI: It looks like those are source code, vice wheels in the link.

oberluz commented 12 months ago

I haven't uploaded them up yet, still bakeing. I'll post here when done in the next hour or so

baudneo commented 12 months ago

Sick, good thing the community took the time to support a multi billion dollar companies hardware.

Thank you @oberluz

Edit: Also, this is a textbook example of why OSS is so important. Once the company looses interest, the community can pick it back up.

oberluz commented 12 months ago

Sick, good thing the community took the time to support a multi billion dollar companies hardware.

Thank you @oberluz

No worries.

If anyone has cloned the repo since i made the announcement please do:

$ git pull $ git submodules update --init --recursive

as I've added a commit that modifies the libcoral submodule.

I'm rebuilding the wheels and will upload them shortly.

@baudneo you mentioned you where interested in 3.11 which I haven't tested yet. I'll add it shortly using debian bookworm to build it...

oberluz commented 12 months ago

@David-OConnor @baudneo Here are the wheels. Let me know how you go...:

https://github.com/oberluz/pycoral/releases/tag/2.7.0

David-OConnor commented 12 months ago

Love it. Should I be able to build a wheel for Windows using the source versions you posted and PyCoral instructions?

oberluz commented 12 months ago

Love it. Should I be able to build a wheel for Windows using the source versions you posted and PyCoral instructions?

I don't have a windows machine or VM. All I can say is try it. I haven't modified the way it build so if you were able to do it before you should be able to now.

If you do it would be good if we can include the windows wheels in the release for others.

David-OConnor commented 12 months ago

Awesome; I'll post back once I try if it works

David-OConnor commented 12 months ago

On Ubuntu 20, Python 3.11, installing either the pycoral or tfliteruntime wheels results in Error: pycoral...wheel is not a supported wheel on this platform. I wonder if I could build for 3.11 using your sources though.

David-OConnor commented 12 months ago

I attempted to build on Windows/Py3.11, and Ubuntu/Py3.11. Same error on both:

ERROR: Could not find a version that satisfies the requirement tflite-runtime==2.7.0.post1 (from pycoral) (from versions: none)
ERROR: No matching distribution found for tflite-runtime==2.7.0.post1

I wonder if the fact the assets are split into pycoral and tflite_runtime wheels is relevant? Of note, I don't know how this system works, and was previously confused about the difference between the two libs.

oberluz commented 12 months ago

Yes, I'm still adding support for 3.11. I'll need to try the next tensorflow version that has a recent version of pybind11 in its bazel configuration.

There is a branch for 3.11 but us failing due to the reasons I've explained

Can you try building the wheels for 3.6, 3.7, 3.8, 3.9 and 3.10? Those should work.

On Thu, 2 Nov 2023, 23:11 David-OConnor, @.***> wrote:

I attempted to build on Windows/Py3.11, and Ubuntu/Py3.11. Same error on both:

ERROR: Could not find a version that satisfies the requirement tflite-runtime==2.7.0.post1 (from pycoral) (from versions: none) ERROR: No matching distribution found for tflite-runtime==2.7.0.post1

— Reply to this email directly, view it on GitHub https://github.com/google-coral/pycoral/issues/85#issuecomment-1791633890, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKFR7SEOPYF2XEFAOV5UWDYCQLAVAVCNFSM56DDBEI2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZZGE3DGMZYHEYA . You are receiving this because you were mentioned.Message ID: @.***>

oberluz commented 11 months ago

I attempted to build on Windows/Py3.11, and Ubuntu/Py3.11. Same error on both:

ERROR: Could not find a version that satisfies the requirement tflite-runtime==2.7.0.post1 (from pycoral) (from versions: none)
ERROR: No matching distribution found for tflite-runtime==2.7.0.post1

I wonder if the fact the assets are split into pycoral and tflite_runtime wheels is relevant? Of note, I don't know how this system works, and was previously confused about the difference between the two libs.

I guess they split them originally so that tflite-runtime could be used for other things then pycoral.

Regarding your error, you need to install tflite-runtime before pycoral..

oberluz commented 11 months ago

I attempted to build on Windows/Py3.11, and Ubuntu/Py3.11. Same error on both:

ERROR: Could not find a version that satisfies the requirement tflite-runtime==2.7.0.post1 (from pycoral) (from versions: none)
ERROR: No matching distribution found for tflite-runtime==2.7.0.post1

I wonder if the fact the assets are split into pycoral and tflite_runtime wheels is relevant? Of note, I don't know how this system works, and was previously confused about the difference between the two libs.

I guess they split them originally so that tflite-runtime could be used for other things then pycoral.

Regarding your error, you need to install tflite-runtime before pycoral..

David-OConnor commented 11 months ago

I appreciate the info; I have it installed.

oberluz commented 11 months ago

@David-OConnor @baudneo

Pycoral for Tensorflow 2.13.0 has been released and includes wheels for python 3.11: https://github.com/oberluz/pycoral/releases

Tensorflow Python 3.11 support was introduced in v2.12.0 : https://github.com/tensorflow/tensorflow/releases/tag/v2.12.0 so it is not possible to create pycoral wheels for any release previous to v2.12.0

I'll be making a release for 2.12.0 and 2.14.0 soon.

If you build it on any arch other then amd64 (k8) or aarch64 please let me know and I'll add them to the releases.

Cheers

oberluz commented 11 months ago

Just a as a final followup. All of the google projects I've had to work on to get this going (pycoral, libcoral and libedgetpu) seem to have been stopped for quite a while. I don't hold any hope they may be retaken so from now on if you need anything please use the discussions page in my repo: https://github.com/oberluz/pycoral/discussions to make further requests or anything else. I won't be following this discussion here any longer. Cheers

David-OConnor commented 11 months ago

Great! Do you know how to solve the issue, when installing from the wheel: ERROR: Could not find a version that satisfies the requirement tflite-runtime==2.13.0 ? Ty. I have tensorflow==2.13.0 installed. Of note, this is similar to the error I received when attempting to build the wheels myself.

edit: It appears that tflite-runtime doesn't support 2.13.0 on Py3.11. Open to ideas to workaround this. I'm curious how you got it to work on your system. I think I'll hold off until your 2.14 release, since this error should hopefully go away then.

oberluz commented 11 months ago

Raise an issue in my repo and state the exact wheels you are trying to install

On Sun, 5 Nov 2023 at 16:19, David-OConnor @.***> wrote:

Great! Do you know how to solve the issue, when installing from the wheel: ERROR: Could not find a version that satisfies the requirement tflite-runtime==2.13.0 ? Ty. I have tensofrlow==2.13.0 installed. Of note, this is similar to the error I received when attempting to build the wheels myself.

— Reply to this email directly, view it on GitHub https://github.com/google-coral/pycoral/issues/85#issuecomment-1793766317, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKFR7ST63PDX53QG7VT34TYC6N7NAVCNFSM56DDBEI2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZZGM3TMNRTGE3Q . You are receiving this because you were mentioned.Message ID: @.***>

oberluz commented 11 months ago

apologies, I hadn't enabled the issues tab, try now...

On Sun, 5 Nov 2023 at 16:29, Paul Nader @.***> wrote:

Raise an issue in my repo and state the exact wheels you are trying to install

On Sun, 5 Nov 2023 at 16:19, David-OConnor @.***> wrote:

Great! Do you know how to solve the issue, when installing from the wheel: ERROR: Could not find a version that satisfies the requirement tflite-runtime==2.13.0 ? Ty. I have tensofrlow==2.13.0 installed. Of note, this is similar to the error I received when attempting to build the wheels myself.

— Reply to this email directly, view it on GitHub https://github.com/google-coral/pycoral/issues/85#issuecomment-1793766317, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKFR7ST63PDX53QG7VT34TYC6N7NAVCNFSM56DDBEI2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZZGM3TMNRTGE3Q . You are receiving this because you were mentioned.Message ID: @.***>

nmaas87 commented 11 months ago

Any idea on how to build this on windows? It seems like both the Docker and Bazle way seem not to work at all with 3.10 nor 3.11 using Oberluz Tags/Repo - but it seems to be an initial problem with Googles Windows scripts.

oberluz commented 11 months ago

Hi,

As I mentioned in my last post please raise an issue in my repo. Explain in detail your environment and what you ae doing and I might be able to help you. I won't be answering questions from this thread any longer...

On Sun, 5 Nov 2023 at 19:41, Nico Maas @.***> wrote:

Any idea on how to build this on windows? It seems like both the Docker and Bazle way seem not to work at all with 3.10 nor 3.11 using Oberluz Tags/Repo - but it seems to be an initial problem with Googles Windows scripts.

— Reply to this email directly, view it on GitHub https://github.com/google-coral/pycoral/issues/85#issuecomment-1793813551, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKFR7WPDOFDD52I7VVLZCDYC7MUDAVCNFSM56DDBEI2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZZGM4DCMZVGUYQ . You are receiving this because you were mentioned.Message ID: @.***>

nmaas87 commented 11 months ago

To all the people interested in the windows builds, I am talking this over all oberluz repo: https://github.com/oberluz/pycoral/issues/3 - looks like it does not work for me, but if you have any inputs or ideas you can give them there.

arne182 commented 10 months ago

I have a new raspberry Pi 5 and it comes with 3.11 is there any update on this?

baudneo commented 10 months ago

I have a new raspberry Pi 5 and it comes with 3.11 is there any update on this?

See the work that @oberluz has done on this issue.

vinzbarbuto commented 7 months ago

Hello everyone, I'm reaching out for an update regarding the official wheels. Currently, I urgently require Python 3.10 to integrate with an external framework. However, I'm encountering a roadblock with pycoral on my Dev Board, which operates on Python 3.7. To address this, I installed Python 3.10, but unfortunately, I'm facing difficulties in downloading the pycoral API as it seems to be unsupported by Python 3.10 at the moment.

I attempted to install pycoral using the provided link for the wheels. Despite successful installation, I encountered the following error message: ImportError: /lib/aarch64-linux-gnu/libc.so.6: version GLIBC_2.32' not found. Upon investigating further by executing ldd --version on my machine, it indicates ldd (Debian GLIBC 2.28-10) 2.28.

Does anyone have any insights or suggestions on how to overcome these challenges?

adelmiljkovic commented 7 months ago

Does anyone have any insights or suggestions on how to overcome these challenges?

Releases for Python 3.10 can be found here but I didn't test https://github.com/oberluz/pycoral/releases

baudneo commented 7 months ago

Hello everyone, I'm reaching out for an update regarding the official wheels. Currently, I urgently require Python 3.10 to integrate with an external framework. However, I'm encountering a roadblock with pycoral on my Dev Board, which operates on Python 3.7. To address this, I installed Python 3.10, but unfortunately, I'm facing difficulties in downloading the pycoral API as it seems to be unsupported by Python 3.10 at the moment.

I attempted to install pycoral using the provided link for the wheels. Despite successful installation, I encountered the following error message: ImportError: /lib/aarch64-linux-gnu/libc.so.6: version GLIBC_2.32' not found. Upon investigating further by executing ldd --version on my machine, it indicates ldd (Debian GLIBC 2.28-10) 2.28.

Does anyone have any insights or suggestions on how to overcome these challenges?

You need to build it yourself on your machine, thats the only reliable way to make sure it will work for your system. See the head of this issue for building instructions and some workarounds needed to build.

virnik0 commented 2 months ago

Any love for Python 3.12 in regard to pycoral? I tried to build it myself like it did in prior setups (which are still running in PROD for me), but those were using python3.10 and python3.11 respectively. Both native as well as docker builds fails.

Or maybe not ready-to-use product, but a howto - from someone who was dealing with the same issue? I am on Ubuntu 24.04 and downgrading to Python3.11 has so many caveats, that it is simply not worth it.

baudneo commented 2 months ago

Any love for Python 3.12 in regard to pycoral? I tried to build it myself like it did in prior setups (which are still running in PROD for me), but those were using python3.10 and python3.11 respectively. Both native as well as docker builds fails.

Or maybe not ready-to-use product, but a howto - from someone who was dealing with the same issue? I am on Ubuntu 24.04 and downgrading to Python3.11 has so many caveats, that it is simply not worth it.

From Google? Never. They refused to show us love before they were convicted of being a monopoly. Now, it's up to us, like it always is.

Just remember this shi* the next time a Google service or product comes up in budget meetings.

And remember..... "Don't be evil"

virnik0 commented 2 months ago

Any love for Python 3.12 in regard to pycoral? I tried to build it myself like it did in prior setups (which are still running in PROD for me), but those were using python3.10 and python3.11 respectively. Both native as well as docker builds fails.

Or maybe not ready-to-use product, but a howto - from someone who was dealing with the same issue? I am on Ubuntu 24.04 and downgrading to Python3.11 has so many caveats, that it is simply not worth it.

From Google? Never. They refused to show us love before they were convicted of being a monopoly. Now, it's up to us, like it always is.

Just remember this shi* the next time a Google service or product comes up in budget meetings.

And remember..... "Don't be evil"

Nah, with help of @Feranick and a bit of trying, I managed to patch the tree and build it myself. Works.

See here: https://github.com/virnik0/pycoral_builds

feranick commented 2 months ago

I created a fork of the official repo (which was partially merged with the official from Google early this only to miss the latest support). The current forked repo provides working wheels for a variety of platforms (amd64 and arm64), OS (Ubuntu, Debian, MacOS), and python versions (including 3.10, 3.11, 3.12). Instructions are provided to build the binaries yourselves and if you follow them closely step by step, they work very well.

https://github.com/feranick/pycoral

Along with the needed corollary libraries: https://github.com/feranick/libedgetpu https://github.com/feranick/TFlite-builds

We can have it at Google all we want, but it is not going to change the fact that the edgetpu is basically discontinued. I am trying still to get it merged with main, but I hold no hope. Sometimes you gotta do the work yourself, if you are invested in a platform.

baudneo commented 2 months ago

I created a fork of the official repo (which was partially merged with the official from Google early this only to miss the latest support). The current forked repo provides working wheels for a variety of platforms (amd64 and arm64), OS (Ubuntu, Debian), and python versions (including 3.10, 3.11, 2.12). Instructions are provided to build the binaries yourselves and if you followed them closely, they works well.

https://github.com/feranick/pycoral

We can have it at Google all we want, but it is not going to change the fact that the edgetpu is basically discontinued. I am trying still to get it merged with main, but I hold no hope. Sometimes you gotta do the work yourself, if you are invested in a platform.

Hell yeah, the community steps up again. Thanks @feranick.

I could be a little more forgiving if Google would actually communicate to the people who bought their hardware that they have officially stopped supporting it and it is discontinued. Then we know it's on us and we can act accordingly.

Instead, they kept the production line rolling and abandoned the software side of things a couple years ago and went radio silent.

Is it our fault for buying Google hardware? I guess, but that doesn't make this sting any less and a valuable lesson is learned yet again in regards to Google's hardware/software.

feranick commented 2 months ago

A little story from my end. I bought the first edgetpu immediately after they were presented and a few others soon after that. I started developing for them custom code, scripts, production products. As the support started lacking or stopped in 2022 or so, ai decided to start doing the work, as I needed to keep my software going.

That said just like you, I was pissed that they were selling the boards with no support. So I started contacting the tech teams. No answers. So I went to the business sale team, which, as it turns out is ASUS. After a few exchanges, they declared that Google was absolutely committed and they were plenty happy to provide bulk batches of such boards. A bad joke, of course. I required escalation to the management, as there is clearly no way to run the boards with any modern system. They pointed to the official documentation (outdated). Basically they went as short to say they have no control of the support, and they will escalate.

So, Google is fully disinvested. ASUS, in charge of distribution has no clue, but of course is happy to sell you anything.

Earlier this year, to my most biggest surprise, a couple of googlers started to look into my PRs to the official repo. One of them (who was not part of the dev team, basically got access to the main repo to push these updates. The original dev team is long gone, the repo is just there abandoned. The PR requests that got pushed were only for libedgetpu, pycoral required a version of TF not available at the time. So at this stage, we could only have libedgetpu supporting TF2.16.1, which works well if you access the TPU directly via TensorFlow. Pycoral was left behind because we were waiting for TF 2.17. the current fork is pretty much up to date, and ready to be merged, but again ,I don't hold any hope. In the meantime, I hope the binaries are there for people in need. All this is possible because Google eventually open sources everything related to pycoral, so there is that. We could be in a position where the libraries were closed sources and we could just throw away the boards.

Truly, my 2 cents.

feranick commented 2 months ago

I'd note that in the age where everybody and their mothers are pushing out NPUs or TPUs, none of them are open source. What Google did at the time was fantastic and foundational to the current tensor chips. Too bad they let the edgeTPU where it is, but at least we have the source to keep it up ourselves.

baudneo commented 2 months ago

Yeah, I'm just a bit sour about this. You are making valid points though, if they hadn't open sourced their work, we'd be really up the creek.

Again, thank you for your work @feranick and long live OSS!