Propose a script to start on Linux, managing library path
- Dominant language
- Python
- Stars
- 133k
- Forks
- 15.7k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 158
Description
### Feature Idea
Using Fedora 41, with a virtualenv, I always have problems using Nvidia packages. It's usual, when I train my models, or when I need to compile something with CUDA, not only with ComfyUI, it's a problem.
I already proposed a solution to Tensorflow team. But I think it could be cool for ComfyUI too.
This is the (curated) script I use to start ComfyUI if I use a virtual env in "venv" directory:
```bash
cd $(dirname $0)
VENV_DIR=./venv
source ${VENV_DIR}/bin/activate
# the magic command
export LD_LIBRARY_PATH=$(find ${VENV_DIR} -name "*.so*" | grep nvidia | xargs dirname - | sort -u | paste -d":" -s -)
# and start comfy
python main.py $@
```
The first command is the needed one to ensure that all NVIDIA libraries can be loaded.
Without this command, ONNX models (for example) cannot be loaded in CUDA device.
Of course, if the user has installed CUDA in the system, `CUDA_HOME` can be set and added to `LD_LIBRARY_PATH`.
My script is not perfect, it assumes that `venv` is the virtual env path. And it assumes that CUDA is used. But, maybe we can find a way to detect the basis?
### Existing Solutions
_No response_
### Other
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.