I am working with the provided method to create the executable for my Python FastAPI project. Since it is an AI-based project, It contains the vector database to handle the embeddings. I am using chromadb
package to deal with embeddings. When I create the build, it gets created successfully. But when I try to run the exe file of my project it reaches the line import chromadb
. It generates the exception like this:
File "chromadb\utils\embedding_functions\__init__.py", line 57, in DefaultEmbeddingFunction
NameError: name 'ONNXMiniLM_L6_V2' is not defined
[PYI-12904:ERROR] Failed to execute script 'main' due to unhandled exception!
I have manually checked that I can run my project, both with standard uvicorn
and using Docker
as well. But when I try to package my project using pyinstaller
, it generates an exception.
P.S. I am activating the environment at the time of creating the executable so that all packages get bonded into my application (tried without it too).
If any further information is required, I can do that too.
Best, Muhammad Hassan
Here is how I am trying to create the executable of my project:
pyinstaller --name tempname --onefile --specpath . main.py
I have also tried:
pyinstaller -F main.py --clean
I have manually checked for ONNXMiniLM_L6_V2
error, and I can see that these embeddings are available.
I have the supporting package onnxruntime
installed as well.
Expectations
I am expecting my executable to run when i create it for my FastAPI application with the environment activated when the exe is created with the help of pyinstaller
.