Skip to content

Support for RTX 4090Β #27

Closed
Closed

Description

@shingarey

The current Dockerfile uses an image with outdated CUDA library cudagl:11.3.0-devel which does not support RTX 4090. To fix this, the docker image and torch version in the Dockerfile can be updated. Following changes worked for me.

  1. Update docker image and torch version in docker/dockerfile:
FROM nvidia/cuda:12.1.0-devel-ubuntu20.04

...

RUN conda init bash &&\
    echo "conda activate my" >> ~/.bashrc &&\
    conda activate my &&\
    pip install torchvision==0.16.0+cu121 torchaudio==2.1.0 torch==2.1.0+cu121 --index-url https://download.pytorch.org/whl/cu121 &&\
...
  1. Additionally, update the compiler flags in bundlesdf/mycuda/setup.py from c++14 to c++17:
nvcc_flags = ['-Xcompiler', '-O3', '-std=c++17', '-U__CUDA_NO_HALF_OPERATORS__', '-U__CUDA_NO_HALF_CONVERSIONS__', '-U__CUDA_NO_HALF2_OPERATORS__']
c_flags = ['-O3', '-std=c++17']

With these fixes, I was able to successfully build and run the provided examples: run_demo.py and bundlesdf/run_nerf.py.

Activity

  1. wenbowen123 commented on Apr 4, 2024

    @wenbowen123
    Contributor

    Perfect, thanks for sharing this!

  2. longwoo commented on Apr 8, 2024

    @longwoo

    @shingarey could you share the docker environment for 4090? For some reason, I failed to build docker from dockerfile. It would be great to download the environment by docker pull

  3. shingarey commented on Apr 9, 2024

    @shingarey
    Author
  4. monajalal commented on Apr 9, 2024

    @monajalal

    @shingarey I pulled your docker but could you please share how you incorporate it into run_container.sh?

    (base) mona@ada:/data/FoundationPose$ docker pull shingarey/foundationpose_custom_cuda121:latest
    latest: Pulling from shingarey/foundationpose_custom_cuda121
    96d54c3075c9: Pull complete 
    755e535b54a3: Pull complete 
    24ff69e0a1e4: Pull complete 
    76a627ca5e65: Pull complete 
    35817692a87e: Pull complete 
    84b6a42e847a: Pull complete 
    4639b7cd68e5: Pull complete 
    a7bc10701a5b: Pull complete 
    7d32a9230f8f: Pull complete 
    8c35a1861813: Pull complete 
    e3f63d7242f5: Pull complete 
    7d4b097a7e9d: Pull complete 
    4612d657f431: Pull complete 
    730e1cd9723b: Pull complete 
    b4a75e4ece39: Pull complete 
    fe0293ccd76c: Pull complete 
    ed1a8048ef98: Pull complete 
    1308be50bc97: Pull complete 
    4412cb55cd12: Pull complete 
    013df3150cc3: Pull complete 
    8441b9a1ff80: Pull complete 
    ad30346aeadc: Pull complete 
    9c24ef1ac2af: Pull complete 
    Digest: sha256:288252092889a52a2e3f1c0087e4a380a601beedf54615c18312ab59cf1f3fb5
    Status: Downloaded newer image for shingarey/foundationpose_custom_cuda121:latest
    docker.io/shingarey/foundationpose_custom_cuda121:latest
    
    
    (base) mona@ada:/data/FoundationPose/docker$ cat run_container.sh
    docker rm -f foundationpose
    CATGRASP_DIR=$(pwd)/../
    xhost +  && docker run --gpus all --env NVIDIA_DISABLE_REQUIRE=1 -it --network=host --name foundationpose shingarey/foundationpose_custom_cuda121:latest  --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v /data:/data -v /mnt:/mnt -v /tmp/.X11-unix:/tmp/.X11-unix -v /tmp:/tmp  --ipc=host -e DISPLAY=${DISPLAY} -e GIT_INDEX_FILE foundationpose:latest bash
    
    
    (base) mona@ada:/data/FoundationPose/docker$ bash run_container.sh 
    fp
    access control disabled, clients can connect from any host
    
    ==========
    == CUDA ==
    ==========
    
    CUDA Version 12.1.0
    
    Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
    
    This container image and its contents are governed by the NVIDIA Deep Learning Container License.
    By pulling and using the container, you accept the terms and conditions of this license:
    https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license
    
    A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience.
    
    *************************
    ** DEPRECATION NOTICE! **
    *************************
    THIS IMAGE IS DEPRECATED and is scheduled for DELETION.
        https://gitlab.com/nvidia/container-images/cuda/blob/master/doc/support-policy.md
    
    /opt/nvidia/nvidia_entrypoint.sh: line 67: exec: --: invalid option
    exec: usage: exec [-cl] [-a name] [command [arguments ...]] [redirection ...]
    
    
    (base) mona@ada:/data/FoundationPose/docker$ bash run_container.sh
    foundationpose
    access control disabled, clients can connect from any host
    
    ==========
    == CUDA ==
    ==========
    
    CUDA Version 12.1.0
    
    Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
    
    This container image and its contents are governed by the NVIDIA Deep Learning Container License.
    By pulling and using the container, you accept the terms and conditions of this license:
    https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license
    
    A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience.
    
    *************************
    ** DEPRECATION NOTICE! **
    *************************
    THIS IMAGE IS DEPRECATED and is scheduled for DELETION.
        https://gitlab.com/nvidia/container-images/cuda/blob/master/doc/support-policy.md
    
    /opt/nvidia/nvidia_entrypoint.sh: line 67: exec: --: invalid option
    exec: usage: exec [-cl] [-a name] [command [arguments ...]] [redirection ...]
    (base) mona@ada:/data/FoundationPose/docker$ cat run_container.sh
    docker rm -f foundationpose
    CATGRASP_DIR=$(pwd)/../
    xhost +  && docker run --gpus all --env NVIDIA_DISABLE_REQUIRE=1 -it --network=host --name foundationpose docker.io/shingarey/foundationpose_custom_cuda121:latest  --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v /data:/data -v /mnt:/mnt -v /tmp/.X11-unix:/tmp/.X11-unix -v /tmp:/tmp  --ipc=host -e DISPLAY=${DISPLAY} -e GIT_INDEX_FILE foundationpose:latest bash
    
    
  5. shingarey commented on Apr 9, 2024

    @shingarey
    Author
    docker rm -f foundationpose
    CATGRASP_DIR=$(pwd)/../
    xhost +  && docker run --gpus all --env NVIDIA_DISABLE_REQUIRE=1 -it --network=host --name foundationpose  --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v __PATH_TO_FOUNDATIONPOSE_ON_HOST_PC__:__PATH_ON_CONTAINER__ -v /mnt:/mnt -v /tmp/.X11-unix:/tmp/.X11-unix -v /tmp:/tmp  --ipc=host -e DISPLAY=${DISPLAY} -e GIT_INDEX_FILE foundationpose:latest bash
    
    

    __PATH_TO_FOUNDATIONPOSE_ON_HOST_PC__ - is the path to the directory on your host system
    __PATH_ON_CONTAINER__ - where to mount inside the container, e.g. /home/your_name

    foundationpose:latest might need to be adapted if you use different image.

  6. Jarvan-hhh commented on Apr 11, 2024

    @Jarvan-hhh

    PATH_TO_FOUNDATIONPOSE_ON_HOST_PC Is this path referring to the path of FoundationPose-main? I don't quite understand, thank you.

  7. monajalal commented on Apr 11, 2024

    @monajalal

    @shingarey

    can you show all the steps including the docker pull?
    do you use same command as below?
    docker pull shingarey/foundationpose_custom_cuda121:latest

  8. shingarey commented on Apr 12, 2024

    @shingarey
    Author

    Yes, it refers to the path to the FoundationPose directory on your host PC.
    I use it as described in the initial post.

  9. Jarvan-hhh commented on Apr 15, 2024

    @Jarvan-hhh

    Thank you for your reply, it is very helpful to me.

  10. StevePotter commented on May 2, 2024

    @StevePotter

    What are the reasons for not making a PR and making this update available in the main branch? Why keep it at 11.3? Also, cudagl and cuda images are at different docker repos. CudaGL adds support for OpenGL, but doesn't have images past cuda 11.4. Do we need OpenGL support?

  11. Cheney-36 commented on Jul 21, 2024

    @Cheney-36

    Thank you very much for your discussion. In the end, I resolved the issue using the following commanddocker rm -f foundationpose DIR=$(pwd)/..// xhost + && docker run --gpus all --env NVIDIA_DISABLE_REQUIRE=1 -it --network=host --name foundationpose --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v $DIR:$DIR -v /mnt:/mnt -v /tmp/.X11-unix:/tmp/.X11-unix -v /tmp:/tmp --ipc=host -e DISPLAY=${DISPLAY} -e GIT_INDEX_FILE shingarey/foundationpose_custom_cuda121:latest bash -c "cd $DIR && bash"

  12. zhaowangji commented on Oct 6, 2024

    @zhaowangji

    Thank you!
    I also met the problem that simply modifying the docker file and rebuilding didn't work, but after pull your image(and solved the "mycpp" issue, which is solved by using other methods provided in the issues), it finally works.

  13. DavidePeron19 commented on Oct 22, 2024

    @DavidePeron19

    @shingarey would it be possible for you to share the Dockerfile you used to create the image since I would like to work on that updating it to Ubuntu 22 and adding ROS dependencies? It is my first time working with Docker and I am a bit lost on how to create the image and Dockerfile from scratch

  14. Boey-li commented on Feb 18, 2025

    @Boey-li

    @shingarey Thank you so much for your sharing! I have tried to use your method and run the run_contrainer.sh:

    docker rm -f foundationpose
    CATGRASP_DIR=$(pwd)/../
    xhost +  && docker run --gpus all --env NVIDIA_DISABLE_REQUIRE=1 -it --network=host --name foundationpose  --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v /home/baoyu/projects/hand_dynamics/src/data_process/FoundationPose -v /mnt:/mnt -v /tmp/.X11-unix:/tmp/.X11-unix -v /tmp:/tmp  --ipc=host -e DISPLAY=${DISPLAY} -e GIT_INDEX_FILE shingarey/foundationpose_custom_cuda121:latest bash
    

    However, when I enter the container, the Foundation folder is empty,

    (foundationpose) ➜  FoundationPose git:(main) βœ— sudo bash docker/run_container.sh
    Error response from daemon: No such container: foundationpose
    access control disabled, clients can connect from any host
    
    ==========
    == CUDA ==
    ==========
    
    CUDA Version 12.1.0
    
    Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
    
    This container image and its contents are governed by the NVIDIA Deep Learning Container License.
    By pulling and using the container, you accept the terms and conditions of this license:
    https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license
    
    A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience.
    
    *************************
    ** DEPRECATION NOTICE! **
    *************************
    THIS IMAGE IS DEPRECATED and is scheduled for DELETION.
        https://gitlab.com/nvidia/container-images/cuda/blob/master/doc/support-policy.md
    
    (my) root@baoyuli-uiuc:/# ls
    NGC-DL-CONTAINER-LICENSE  bin  boot  dev  eigen-3.4.0  eigen-3.4.0.tar.gz  etc  home  kaolin  lib  lib32  lib64  libx32  media  miniconda.sh  mnt  nvdiffrast  opt  proc  pybind11  root  run  sbin  srv  sys  tmp  usr  var
    (my) root@baoyuli-uiuc:/# cd home
    (my) root@baoyuli-uiuc:/home# ls
    baoyu  dmitriy
    (my) root@baoyuli-uiuc:/home# cd baoyu
    (my) root@baoyuli-uiuc:/home/baoyu# ls
    projects
    (my) root@baoyuli-uiuc:/home/baoyu# cd projects
    (my) root@baoyuli-uiuc:/home/baoyu/projects# ls
    hand_dynamics
    (my) root@baoyuli-uiuc:/home/baoyu/projects# cd hand_dynamics
    (my) root@baoyuli-uiuc:/home/baoyu/projects/hand_dynamics# cd src
    (my) root@baoyuli-uiuc:/home/baoyu/projects/hand_dynamics/src# cd data_process
    (my) root@baoyuli-uiuc:/home/baoyu/projects/hand_dynamics/src/data_process# cd FoundationPose/
    (my) root@baoyuli-uiuc:/home/baoyu/projects/hand_dynamics/src/data_process/FoundationPose# bash build_all.sh
    bash: build_all.sh: No such file or directory
    (my) root@baoyuli-uiuc:/home/baoyu/projects/hand_dynamics/src/data_process/FoundationPose# ls
    (my) root@baoyuli-uiuc:/home/baoyu/projects/hand_dynamics/src/data_process/FoundationPose# cd ..
    (my) root@baoyuli-uiuc:/home/baoyu/projects/hand_dynamics/src/data_process# ls
    FoundationPose
    (my) root@baoyuli-uiuc:/home/baoyu/projects/hand_dynamics/src/data_process# cd FoundationPose/
    (my) root@baoyuli-uiuc:/home/baoyu/projects/hand_dynamics/src/data_process/FoundationPose# ls
    (my) root@baoyuli-uiuc:/home/baoyu/projects/hand_dynamics/src/data_process/FoundationPose# 
    

    I am not quite familiar with Docker and not sure what mistakes I had made. Do you have any suggestions on it?

    Besides, I also wonder have you tried to set up the conda environment instead of docker in RTX 4090?

  15. wenbowen123 commented on Feb 18, 2025

    @wenbowen123
    Contributor

    @Boey-li see this for 4090 setup https://github.com/NVlabs/FoundationPose?tab=readme-ov-file#troubleshooting

    For the docker issue, have you tried removing sudo from sudo bash docker/run_container.sh?

  16. yanglicb commented on Aug 21, 2025

    @yanglicb

    For RTX5090 and in WSL using docker, it works by combining pull request #369 with this. I have encountered the error: Segmentation fault (core dumped) from line mycpp.cluster_poses() (see #293).
    I uploaded the docker image: foundationpose-cuda12.8

  17. wenbowen123 commented on Aug 21, 2025

    @wenbowen123
    Contributor

    @yanglicb, the cluster_poses is very simple. you can rewrite this into python (ask chatgpt) if that helps to debug.

  18. AliHaroonT commented on Dec 31, 2025

    @AliHaroonT

    For RTX5090 and in WSL using docker, it works by combining pull request #369 with this. I have encountered the error: Segmentation fault (core dumped) from line mycpp.cluster_poses() (see #293). I uploaded the docker image: foundationpose-cuda12.8

    I was facing the same issue but after running the docker container, I ran the build_all.sh file, it resolved this error.

  19. fjremnav commented on Jan 5, 2026

    @fjremnav

    @yanglicb

    I have rtx 5070ti , cuda 13.0 and ubuntu 24.04. When I ran your container and do build_all.sh inside the docker, I encountered the following issue:

    cd /kaolin && rm -rf build egg && pip install -e .
    Obtaining file:///kaolin
    Preparing metadata (setup.py) ... error
    error: subprocess-exited-with-error

    Γ— python setup.py egg_info did not run successfully.
    β”‚ exit code: 1
    ╰─> [19 lines of output]
    /kaolin/setup.py:12: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    from pkg_resources import parse_version
    Traceback (most recent call last):
    File "", line 2, in
    exec(compile('''
    ~~~~^^^^^^^^^^^^
    # This is -- a caller that pip uses to run setup.py
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<32 lines>...
    exec(compile(setup_py_code, filename, "exec"))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ''' % ('/kaolin/setup.py',), "", "exec"))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "", line 35, in
    File "/kaolin/setup.py", line 30, in
    raise ImportError(
    ...<2 lines>...
    )
    ImportError: Kaolin requires PyTorch >= 1.6.0, <= 2.8.0. Please install it before proceeding.
    [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
    error: metadata-generation-failed

    Γ— Encountered error while generating package metadata.
    ╰─> See above for output.

    note: This is an issue with the package mentioned above, not pip.
    hint: See above for details.

  20. GuoXiaolong2018 commented on Apr 16, 2026

    @GuoXiaolong2018

    My machine has a single 4090 graphics card, and I'm using CUDA 11.8 as the environment. I'm installing it using conda. You might encounter some issues with the installation packages, but don't worry, just let the cursor automatically create the environment. You only need to grant execute permissions to the cursor. Then, everything will be fine. Here's my prompt:

    I've already created the conda environment: /home/fiveages/anaconda3/envs/foundationpose/bin/python

    and you need to temporarily import CUDA 11.8.

    Please help me with the following:

    // Install Eigen3 3.4.0 under conda environment
    conda install conda-forge::eigen=3.4.0
    export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH:/eigen/path/under/conda"

    // install dependencies
    python -m pip install -r requirements.txt

    // Install NVDiffRast
    python -m pip install --quiet --no-cache-dir git+https://github.com/NVlabs/nvdiffrast.git

    // Kaolin (Optional, needed if running model-free setup)
    python -m pip install --quiet --no-cache-dir kaolin==0.15.0 -f https://nvidia-kaolin.s3.us-east-2.amazonaws.com/torch-2.0.0_cu118.html

    // PyTorch3D
    python -m pip install --quiet --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py39_cu118_pyt200/download.html

    // Build extensions
    CMAKE_PREFIX_PATH=$CONDA_PREFIX/lib/python3.9/site-packages/pybind11/share/cmake/pybind11 bash build_all_conda.sh

    Please set up the Foundation Pose runtime environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions