pyinstaller / pyinstaller-hooks-contrib

Community maintained hooks for PyInstaller.
Other
96 stars 126 forks source link

hooks: add hook for opentelemetry #725

Closed rokm closed 7 months ago

rokm commented 7 months ago

Add hook for opentelemetry that collects all entry-points with opentelemetry_ prefix.

Closes pyinstaller/pyinstaller#8413.

Aybfr commented 7 months ago

Hi guys, I have a persisting issue with the latest version of pyinstaller and opentelemetry, I developed a local AI app that runs perfectly on python but once I created its exe it keeps sending the same errors while executing:

Traceback (most recent call last): File "langchain_community\vectorstores\chroma.py", line 81, in init File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module File "chromadbinit.py", line 5, in File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module File "chromadb\auth\tokeninit.py", line 26, in File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module File "chromadb\telemetry\opentelemetryinit.py", line 6, in File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module File "opentelemetry\sdk\resourcesinit.py", line 144, in File "importlib_metadatainit.py", line 900, in version File "importlib_metadatainit.py", line 873, in distribution File "importlib_metadatainit.py", line 391, in from_name importlib_metadata.PackageNotFoundError: No package metadata was found for opentelemetry-sdk

Could anyone help me if possible? Thank you!

rokm commented 7 months ago

What version of pyinstaller-hooks-contrib do you have installed?

Aybfr commented 7 months ago

What version of pyinstaller-hooks-contrib do you have installed?

I have the 6.6.0 of pyinstaller and just re-installed pyinstaller-hooks-contrib yesterday again.

rokm commented 7 months ago

What version of pyinstaller-hooks-contrib do you have installed?

I have the 6.6.0 of pyinstaller and just re-installed pyinstaller-hooks-contrib yesterday again.

If you have pyinstaller-hooks-contrib 2024.5, then the hook that was added in this PR should do the trick (the opentelemetry-sdk metadata should be collected as part of the entry points that the hook collect).

But even so, you can force collection of that metadata by adding --copy-metadata opentelemetry-sdk to your PyInstaller command, and see if it gets you any further.

Aybfr commented 7 months ago

What version of pyinstaller-hooks-contrib do you have installed?

I have the 6.6.0 of pyinstaller and just re-installed pyinstaller-hooks-contrib yesterday again.

If you have pyinstaller-hooks-contrib 2024.5, then the hook that was added in this PR should do the trick (the opentelemetry-sdk metadata should be collected as part of the entry points that the hook collect).

But even so, you can force collection of that metadata by adding --copy-metadata opentelemetry-sdk to your PyInstaller command, and see if it gets you any further.

I forced the add but the issue persists, I already have the 2024.5 version. I will try to redo the whole thing from scratch and see if the issue is still there. Thank you

rokm commented 7 months ago

What version of pyinstaller-hooks-contrib do you have installed?

I have the 6.6.0 of pyinstaller and just re-installed pyinstaller-hooks-contrib yesterday again.

If you have pyinstaller-hooks-contrib 2024.5, then the hook that was added in this PR should do the trick (the opentelemetry-sdk metadata should be collected as part of the entry points that the hook collect). But even so, you can force collection of that metadata by adding --copy-metadata opentelemetry-sdk to your PyInstaller command, and see if it gets you any further.

I forced the add but the issue persists, I already have the 2024.5 version. I will try to redo the whole thing from scratch and see if the issue is still there. Thank you

Try rebuilding with --clean option added, then.

Aybfr commented 7 months ago

What version of pyinstaller-hooks-contrib do you have installed?

I have the 6.6.0 of pyinstaller and just re-installed pyinstaller-hooks-contrib yesterday again.

If you have pyinstaller-hooks-contrib 2024.5, then the hook that was added in this PR should do the trick (the opentelemetry-sdk metadata should be collected as part of the entry points that the hook collect). But even so, you can force collection of that metadata by adding --copy-metadata opentelemetry-sdk to your PyInstaller command, and see if it gets you any further.

I forced the add but the issue persists, I already have the 2024.5 version. I will try to redo the whole thing from scratch and see if the issue is still there. Thank you

Try rebuilding with --clean option added, then.

I did use clean but separately, would you be kind to give me a sequence to follow in order to build my exe correctly. Thank you in advance!!

rokm commented 7 months ago

What version of pyinstaller-hooks-contrib do you have installed?

I have the 6.6.0 of pyinstaller and just re-installed pyinstaller-hooks-contrib yesterday again.

If you have pyinstaller-hooks-contrib 2024.5, then the hook that was added in this PR should do the trick (the opentelemetry-sdk metadata should be collected as part of the entry points that the hook collect). But even so, you can force collection of that metadata by adding --copy-metadata opentelemetry-sdk to your PyInstaller command, and see if it gets you any further.

I forced the add but the issue persists, I already have the 2024.5 version. I will try to redo the whole thing from scratch and see if the issue is still there. Thank you

Try rebuilding with --clean option added, then.

I did use clean but separately, would you be kind to give me a sequence to follow in order to build my exe correctly. Thank you in advance!!

Run pyinstaller --clean --copy-metadata opentelemetry-sdk [the rest of your options]; then copy full build log and the error message here (or in a new issue).

Aybfr commented 7 months ago

What version of pyinstaller-hooks-contrib do you have installed?

I have the 6.6.0 of pyinstaller and just re-installed pyinstaller-hooks-contrib yesterday again.

If you have pyinstaller-hooks-contrib 2024.5, then the hook that was added in this PR should do the trick (the opentelemetry-sdk metadata should be collected as part of the entry points that the hook collect). But even so, you can force collection of that metadata by adding --copy-metadata opentelemetry-sdk to your PyInstaller command, and see if it gets you any further.

I forced the add but the issue persists, I already have the 2024.5 version. I will try to redo the whole thing from scratch and see if the issue is still there. Thank you

Try rebuilding with --clean option added, then.

I did use clean but separately, would you be kind to give me a sequence to follow in order to build my exe correctly. Thank you in advance!!

Run pyinstaller --clean --copy-metadata opentelemetry-sdk [the rest of your options]; then copy full build log and the error message here (or in a new issue).

So that issue is resolved but I keep getting issues with not found modules like: ModuleNotFoundError: No module named 'pypika' ModuleNotFoundError: No module named 'chromadb.telemetry.product.posthog' etc so I think that the issue is that it seems like the packages are not accessible.

rokm commented 7 months ago

There's a lot of indirect imports going on in chromadb, so you will need to specify those missing modules as hidden imports.