tensorflow / tflite-support

TFLite Support is a toolkit that helps users to develop ML and deploy TFLite models onto mobile / ioT devices.
Apache License 2.0
378 stars 128 forks source link

Fix Python 3.12 compatibility - use importlib.util.find_spec("numpy") instead of imp #986

Open nicklasb opened 2 months ago

nicklasb commented 2 months ago

Hi!

In the pip distribution (at least on windows), in flatbuffers\compat.py, it uses imp, which is removed in python 3.12, so I had to monkey patch it to use importlib instead to make the library work properly.

I couldn't find that code anywhere, so I suppose it is in some pip package source somewhere, otherwise I'd made a PR.