Pack working for me after the following changes
I had a lot of issues getting this pack to work in linux in a docker container,
however after many hours of slow progress I finally got it to work. Here are the changes I needed to make:
-
Don't use prebuilt wheels, it gives errors, I had to build them manually, I'm using "pytorch/pytorch:2.4.0-cuda12.1-cudnn9-devel" as base image
-
Do not use autobuild, it will pull the wrong dependencies for pytorch 2.4.0, I installed
torch-scatterwithpip install torch-scatter==2.1.2 -f https://data.pyg.org/whl/torch-2.4.0+cu121.htmlandxformers==0.0.27.post2through pip and torch-vision was already installed -
I built the diff-gaussian-rasterization, gaussian-splatting -> submodules/simple-knn (had to git clone this one), kiuikit, nvdiffrast and pytorch3d all through their respective
python setup.py install. -
Don't use OpenGL, I could not get it to work and kept getting eglInitialize() failed errors. So I had to replace all
RasterizeGLContextwithRasterizeCudaContext -
I had to change the requirements: needed to make sure of
pygltflib==1.16.2and had to adddataclasses-json
At this point the container started with the 3d pack loaded succesfully
Buuuuut I still had issues in the frontend as well, even on the latest ComfyUI version:
-
The threeVisualiser preview loads in an iframe. For reasons I don't fully understand it tries to import the comfyUI api from window.comfyUI, but this window context is the child window, not the parent window. So I had to patch the comfyUI
scripts/api.jsshim withexport const api = window.comfyAPI?.api?.api || parent.window.comfyAPI?.api?.api; -
That loaded the node preview without exceptions but threeVisualiser.js uses api.apiURL, which refers to the /api/viewfile and not to the extension path, so I had to patch that:
- currentURL = api.apiURL('/viewfile?' + new URLSearchParams(params));
+ currentURL = api.fileURL('/extensions/ComfyUI-3D-Pack/html/viewfile?' + new URLSearchParams(params));
And
- mtlLoader.setPath(api.apiURL('/viewfile?' + new URLSearchParams({"filepath": mtlFolderpath})));
+ mtlLoader.setPath(api.apiURL('/extensions/ComfyUI-3D-Pack/html/viewfile?' + new URLSearchParams({"filepath": mtlFolderpath})));
I don't really know what went wrong in the frontend there, but that fixed it for me, I now have a fully working workflow and a preview
Not sure if it will help anyone but I've pushed my image, run it with:
docker run -d \
--name comfyui_3d \
-p 8188:8188 \
--gpus=all \
--restart unless-stopped \
-v $(pwd)/data/input:/comfyui/input \
-v $(pwd)/data/models:/comfyui/models \
-v $(pwd)/data/output:/comfyui/output \
-v $(pwd)/data/custom_nodes:/comfyui/custom_nodes \
-v $(pwd)/data/my_workflows:/comfyui/my_workflows \
drake7707/comfyui:3d
make sure your data folder exist for the bind mount:
mkdir -p data/input
mkdir -p data/output
mkdir -p data/models
mkdir -p data/custom_nodes
mkdir -p data/my_workflows
I've commited my changes on my fork: https://github.com/drake7707/ComfyUI-3D-Pack/commit/4aa5e86218b10403a7fe9de47cbdfa0731192fbc
So if you pull https://github.com/drake7707/ComfyUI-3D-Pack.git into your data/custom_nodes folder, run pip install -r requirements in the container and restart, it should all work
torch-scatter needs to be installed with pip install torch-scatter==2.1.2 -f https://data.pyg.org/whl/torch-2.4.0+cu121.html or it's not pulling the CUDA support.
Also needed diffusers==0.29.0 to prevent errors in _get_model_file
Hi @drake7707 thanks for the guide you wrote
I just rebuilt all the wheels for Windows, python 3.10, 3.11, 3.12, cuda 11.8. 12.1, pytorch 2.4.0
Also I removed the comfyUI api import from 3d preview js file and changed it to JS native location variable
Please let me know if there are any other problems 👍
@drake7707 thank you so much for this! this saved me so much headache trying to get this built! it worked flawlessly.
Thanks a lot for this modifications, it worked after a lot of time wasted. Wheel building worked for me running the auto_build_all.py file after provinding the correct packages version. Only things to note, i didnt need to modify the threeVisualiser.js at all but instead (given that i containerized everthing ) I had problems with the ip security check in the server.py. I also had to modify the download button because it gave me files without extensions, not nice but now works:
downloadButton.addEventListener('click', e => { const a = document.createElement('a'); a.href = currentURL;
const filepathSplit = currentURL.split('.');
const fileExt = filepathSplit.pop().toLowerCase();
a.download = "mesh."+fileExt;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
// console.log(currentURL)
// window.open(currentURL, '_blank');
});