Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker/singularity container doesn't seem to contain ns-* commands #2952

Open
cousins opened this issue Feb 23, 2024 · 7 comments
Open

Docker/singularity container doesn't seem to contain ns-* commands #2952

cousins opened this issue Feb 23, 2024 · 7 comments

Comments

@cousins
Copy link

cousins commented Feb 23, 2024

Describe the bug

I built a singularity container from the Dockerhub address listed on the web page and then ran "singularity run --nv nerf.simg" and tried to find the ns-* files but I am unable to find them.

To Reproduce

Run:

singularity build nerf.simg docker://dromni/nerfstudio:1.0.2

singularity run --nv nerf.sif ns-process-data video --data /workspace/video.mp4

Expected behavior

No errors

** Result:

== CUDA ==

CUDA Version 11.8.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.

/opt/nvidia/nvidia_entrypoint.sh: line 67: exec: ns-process-data: not found

@FabioLddo
Copy link

I have a similar problem, when executing the container with singularity shell I cannot access the nerfstudio commands. from and initial analysis this is due to the fact that I don't have permissions to access the \usr folder.

@thawn
Copy link

thawn commented Jul 15, 2024

I also have a problem using your docker container with singularity. When I try to build the container v 1.1.3, singularity hangs at "creating SIF file".
Before that, singularity complains about permissions set in the docker container.
Is there a specific reason why nerfstudio is installed in the user directory of user 1000? Also, is there a specific reason why the cli is installed in /workspace?

I would expect, that inside the container, nerfstudio is simply installed in the system python environment and the cli scripts are installed under /usr/local/bin

@FabioLddo
Copy link

FabioLddo commented Jul 15, 2024

I also have a problem using your docker container with singularity. When I try to build the container v 1.1.3, singularity hangs at "creating SIF file". Before that, singularity complains about permissions set in the docker container. Is there a specific reason why nerfstudio is installed in the user directory of user 1000? Also, is there a specific reason why the cli is installed in /workspace?

I would expect, that inside the container, nerfstudio is simply installed in the system python environment and the cli scripts are installed under /usr/local/bin

Hi, I think I found a workaround for this problem, I hope it also applies to your case.

I am currently working with the nerfstudio image 1.1.0.

I create the container using the following .def file:

`
Bootstrap: docker
From: dromni/nerfstudio:1.1.0

%post
sudo chmod 777 /home/user
sudo rm -rf /usr/lib/x86_64-linux-gnu/libcuda.so.1 /usr/lib/x86_64-linux-gnu/libnvidia-*.so.1 /usr/lib/x86_64-linux-gnu/libnvcuvid.so.1 /usr/lib/x86_64-linux-gnu/libcudadebugger.so.1
`
After this when I run the container with singularity I make sure to run the following command before the actual nerf command:

export PYTHONPATH=$PYTHONPATH:/home/user/pyceres:/home/user/.local/lib/python3.10/site-packages:/home/user/pixel-perfect-sfm:/home/user/nerfstudio:/home/user/Hierarchical-Localization:/home/user/garfield:/home/user/nf_bionerf

If I try it inside the singularity shell I can also see the nerfstudio commands.

For additional reference, my exec command looks like this:

singularity exec --nv /singularity/nerfstudio.sif /bin/bash -c 'export PYTHONPATH=$PYTHONPATH:/home/user/pyceres:/home/user/.local/lib/python3.10/site-packages:/home/user/pixel-perfect-sfm:/home/user/nerfstudio:/home/user/Hierarchical-Localization:/home/user/garfield:/home/user/nf_bionerf && cd /workspace && ns-train ...'

This allowed me to work with my singularity configuration, I hope this was helpful.

@thawn
Copy link

thawn commented Aug 1, 2024

@SwirtaB I saw you made the latest changes to the dockerfile. Question from my side: what is the design choice behind working as a user inside the dockerfile?

This makes it impossible to use the docker container with singularity/apptainer, since inside a singularity container, I still work under my own user and hence do not have access to the directory /home/user.

@FabioLddo s approach may work, but feels hacky to me.

The normal docker way would be to install nerfstudio as a system app under /usr/local. This would make the docker container usable with singularity/apptainer, which is the standard container software on most HPC clusters.

@SwirtaB
Copy link
Contributor

SwirtaB commented Aug 1, 2024

Hi @thawn,
Note that I am not the part of the team working on nerfstudio project. I have suggested and committed changes to Dockerfile in May, which is way after the initial issue (so no problem there) and I did not modify the ways in which the container works.

The way I see it, this image serves as a simple way to obtain a stable development environment and not as the go-to development workspace (requires adjustment from the end user if one wishes to use it in more complex scenarios).

If user inside container is a problem, you can change the user via --build-args (available args are: USERNAME, USER_UID, USER_GID) and run it as local user (Docker CE allows for such operation, see documentation ).

If this not solves your problem, feel free to implement changes and contribute to the repository.

@thawn
Copy link

thawn commented Aug 1, 2024

Hi @SwirtaB ,
thanks for the quick reply.
I cannot solve the problem with docker, since I am forced to use singularity on our cluster (allowing docker in a multi-user environment would be a huge security risk).

I created a docker file that solved the problem for me. I will submit a pull request.

Cheers,

thawn added a commit to thawn/nerfstudio that referenced this issue Aug 1, 2024
On HPC systems, singularity/apptainer is used instead of docker as the container solution.

The current dockerfile does not work under singularity, since nerfstudio is installed under /home/user, which is not accessible when the container is run in singularity/apptainer. The problem is that under singularity, the user inside the container has the same rights as outside the container and thus cannot access the contents of the folder belonging to another user. This makes singularity containers secure to use in a multi-user environment.

The proposed changes install nerfstudio in the system environment, making it available to all users.

I have tested this container and it works. The container is available on hub.docker.com/thawn/nerfstudio

closes nerfstudio-project#2952
@thawn
Copy link

thawn commented Sep 5, 2024

This can be closed as fixed by #3283

I pulled docker://ghcr.io/nerfstudio-project/nerfstudio:pr-3283 with singularity and it works well 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants