- Added a timeout of 7 seconds to the package installation process using subprocess.check_call. If any package installation exceeds this duration, it's terminated, and a timeout message is displayed.
- Improved error handling during package installation. If a package fails to install, the specific reason is now displayed to the user.
Split the error message into two lines for better readability: one line indicates the failure, and the next line provides the specific error message.
- Instead of relying solely on pip freeze to determine installed packages, added a function to check if a package is installed by attempting to import it. This provides a more direct and reliable way to verify if a package is available for use.
- Removed the use of subprocess.getoutput which was causing hangs for some users and replaced it with subprocess.run.
Streamlined the logic to determine whether to use the embedded Python executable or the system's Python for installations.
This PR addresses an issue where the code could potentially use a global version of pip not associated with the running Python interpreter, leading to errors such as "module pip not found".
This commit includes many changes:
- Improved installation of required python packages and improved logic when installation fails
- Moved VAE tile option from node_settings.json to the Efficient KSampler's "vae_decode" input
- Changed preview image logic, now its much less buggy
Refined the server_logic function to better manage WebSocket disruptions:
- Integrated `handle_websocket_failure()` directly into `server_logic` to capture and inform about unexpected disconnection scenarios.
- Added conditionals to reset the `latest_image` when the WebSocket connection is deemed inactive.
- Ensured that the error handling mechanism is more resilient to abrupt connection terminations, especially in the context of receiving messages.
- Introduced `handle_websocket_failure()` to consolidate error handling and messaging.
- Removed redundant `websocket_status` checks in the server initialization function.
- Enhanced the `send_command_to_frontend()` function to handle potential WebSocket failures.
- Ensured error messages related to WebSocket failures are displayed only once.
This commit introduces a fallback mechanism for the package installation process.
- If the `python_embedded` directory is not found, the installation defaults to the current Python environment.
- This ensures that packages are installed successfully regardless of the setup, enhancing compatibility across different machines.
Auto required package isntaller package now uses the "requirements.txt" folder as reference for what packages to install.
Packages are also now installed straight to the ComfyUI's python embedded site-packages folder via relative pathing.
Updated messages to be cleaner on console aswell.