anibali/docker-pytorch

python3: can't open file 'script.py': [Errno 2] No such file or directory

jihadrahmawan opened this issue ยท 4 comments

i already finish create new docker image but i tried to run my script error like the docker can't found my script?
how actualy use the docker image for runing a script?
docker run --rm -it --init
--gpus=all
--ipc=host
--volume="$PWD:/home/data/AI/pytroch/deeplabv3"
envpytorch17cu11 python3 script.py

i used that command for runing my script. thank you

The first part of the --volume option is the host path, and the second part is the path inside the container. So if you want to mount /home/data/AI/pytroch/deeplabv3 on your host to /app in the container (which is the default working directory), you need to write --volume="/home/data/AI/pytroch/deeplabv3:/app".

I recommend that you look into how Docker works a bit more since this is not specific to docker-pytorch.

Thank you @anibali, i solved that problem. but when i run my program i see error ๐Ÿ‘
ModuleNotFoundError: No module named 'pandas'
i'm sure python inside the container is include pandas library.
thank you

You can always run bash to explore inside the container a bit. For example, you can check what packages pip sees like so:

$ docker run --rm -it --init --gpus=all --ipc=host --volume="/home/data/AI/pytroch/deeplabv3:/app" envpytorch17cu11 bash
$ pip list
Package                Version            
---------------------- -------------------
...

Thank you, I tried re build the docker images with extra Python Library. And i solved that problem.