FenTechSolutions / CausalDiscoveryToolbox

Package for causal inference in graphs and in the pairwise settings. Tools for graph structure recovery and dependencies are included.
https://fentechsolutions.github.io/CausalDiscoveryToolbox/html/index.html
MIT License
1.12k stars 197 forks source link

CPU Dockers not working "groups: cannot find name for group ID 1000" #91

Open RichardShea opened 3 years ago

RichardShea commented 3 years ago

I used the commands from the Advanced Tutorial on both Python 3.6 and 3.7 CPU Docker images. I keep getting a group error. I'm running Unbuntu 20.04.1 LTS on Vitrual Box on Mac Mohave OS.

richard@richard-VirtualBox:~$ sudo docker run -it --init --ipc=host --rm -u=$(id -u):$(id -g) divkal/cdt-py3.7:latest /bin/bash groups: cannot find name for group ID 1000 I have no name!@799281c9b236:/$ whoami whoami: cannot find name for user ID 1000 I have no name!@799281c9b236:/$

diviyank commented 3 years ago

Hello ! This error stems from the docker image that does not possess your /etc/group and /etc/passwd (as it is personal and configuration-dependent). A way to solve your error message is to add the -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro to your docker run arguments, thus making :

docker run -it --init --ipc=host --rm -u=$(id -u):$(id -g) -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro  divkal/cdt-py3.7:latest /bin/bash

Please note : divkal/cdt-py3.7:latest is not the latest docker image ( the doc hasn't be updated on this one, sorry!) but use fentechai/cdt:latest instead

I'll keep this issue open to remind myself to update the doc. Best, Diviyan

RichardShea commented 3 years ago

Ok, I pulled the fentechai/cdt:latest and ran your command.

richard@richard-VirtualBox:~$ sudo docker run -it --init --ipc=host --rm -u=$(id -u):$(id -g) -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro fentechai/cdt:latest /bin/bash [sudo] password for richard: richard@6ae42756957d:/$ whoami richard richard@6ae42756957d:/$

No more group error, but I can't get to an ipython console or workspace directory as stated in the tutorial.

richard@6ae42756957d:/$ cd workspace bash: cd: workspace: No such file or directory

richard@6ae42756957d:/$ ipython bash: ipython: command not found

richard@77b4480a3dd5:/$ find / -type d -name "workspace" find: '/root': Permission denied find: '/etc/polkit-1/localauthority': Permission denied find: '/etc/ssl/private': Permission denied find: '/var/log/private': Permission denied find: '/var/log/unattended-upgrades': Permission denied find: '/var/lib/apt/lists/partial': Permission denied find: '/var/lib/polkit-1': Permission denied find: '/var/lib/private': Permission denied find: '/var/cache/ldconfig': Permission denied find: '/var/cache/apt/archives/partial': Permission denied find: '/var/cache/private': Permission denied find: '/proc/tty/driver': Permission denied find: '/tmp/tmpw_248u_h': Permission denied find: '/tmp/tmpa7jg7wqk': Permission denied

richard@77b4480a3dd5:/$ find / -type d -name "ipython" find: '/root': Permission denied find: '/etc/polkit-1/localauthority': Permission denied find: '/etc/ssl/private': Permission denied find: '/var/log/private': Permission denied find: '/var/log/unattended-upgrades': Permission denied find: '/var/lib/apt/lists/partial': Permission denied find: '/var/lib/polkit-1': Permission denied find: '/var/lib/private': Permission denied find: '/var/cache/ldconfig': Permission denied find: '/var/cache/apt/archives/partial': Permission denied find: '/var/cache/private': Permission denied find: '/proc/tty/driver': Permission denied find: '/tmp/tmpw_248u_h': Permission denied find: '/tmp/tmpa7jg7wqk': Permission denied

richard@6ae42756957d:/$ find / -type f -name "ipython*" find: '/root': Permission denied find: '/etc/polkit-1/localauthority': Permission denied find: '/etc/ssl/private': Permission denied find: '/var/log/private': Permission denied find: '/var/log/unattended-upgrades': Permission denied find: '/var/lib/apt/lists/partial': Permission denied find: '/var/lib/polkit-1': Permission denied find: '/var/lib/private': Permission denied find: '/var/cache/ldconfig': Permission denied find: '/var/cache/apt/archives/partial': Permission denied find: '/var/cache/private': Permission denied find: '/proc/tty/driver': Permission denied find: '/tmp/tmpw_248u_h': Permission denied find: '/tmp/tmpa7jg7wqk': Permission denied

Thank you, Richard

diviyank commented 3 years ago

Ah yes, I forgot to recreate the link in the docker (we don't have a .bashrc, so the path links are not there) To have a python console, run usr/bin/python3, and to have an ipython, you must install it first

/usr/bin/python3 -m pip install ipython

Hope that solves your issue, Best, Diviyan

RichardShea commented 3 years ago

The usr/bin/python3 got me started.

For installing ipython, there seems to be a permission issue:

/usr/bin/python3 -m pip install ipython

WARNING: The directory '/home/richard/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

It downloads, but then I get

ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/home/richard' Check the permissions.

Adding --no-cache-dir gets rid of the WARNING, but I still get the same ERROR. /usr/bin/python3 -m pip install ipython --no-cache-dir

I also tried adding --user with no luck.

/usr/bin/python3 -m pip install ipython --no-cache-dir --user

Thank you, Richard

diviyank commented 3 years ago

Ah right ! Sorry, I think we need to create a new Docker image ;

/ ## Dockerfile

FROM fentechai/cdt:latest

RUN /usr/bin/python3 -m pip install ipython
CMD /bin/bash
#Command line execution
docker build  -t richardshea/cdt:latest .

And then run your docker image.

An alternative would be to run the original docker container as root :

docker run -it --init --ipc=host --rm  fentechai/cdt:latest /bin/bash

I should definitely be more explicit on the documentation....