Failed to install when using the docker

Stories before: https://discuss.pytorch.org/t/failed-when-trying-to-install-pytorch-from-source/8603/15

And now, after some days’ costed by reinstalled Ubuntu (in fact, the computer itself have had to be repaired twice), I’m here trying to install it, using the docker.
Things seemed going well at first, but then failed at this command.

Step 10/14 : RUN git submodule update --init

It says,

fatal: Not a git repository (or any of the parent directories): .git
The command ‘/bin/sh -c git submodule update --init’ returned a non-zero code: 128

Mr. Google suggested me to run git init. Of course, it didn’t work.
Hope for a fast answer, since it has cost me REALLY a looooong time on it.
Thanks to everybody. I love you.

If you can live with Python 2.7 my docker works great:

1 Like

Solved this particular problem. It’s caused by a ridiculous reason: I was trying to install it using docker pull pytorch/pytorch, and download Dockerfile from github separately. And after a git clone and docker build, it works.

Well, but…
After I successfully installed it, I found nothing changed - I mean, there’s no pytorch packages under conda list and import torch still returns sth. like “ModuleNotFound”.
So what the ceiling did I do during the last 5 hours?

EDIT: Alright, it seems that I’m completely new to docker and did not really get to know it. But I just want a pytorch, please, sir and madam…

EDIT2: Learned some docker, and by using sudo docker run -t -i pytorch /bin/bash I finally found pytorch package in my python. But that’s all my good luck.

import torch
Traceback (most recent call last):
File “”, line 1, in
File “/opt/conda/envs/pytorch-py3.6/lib/python3.6/site-packages/torch/init.py”, line 53, in
from torch._C import *
ImportError: libcuda.so.1: cannot open shared object file: No such file or directory

Ehhhhh. Well, no matter where the bug actually is, before that, I do NOT have a NVIDIA GPU, and do NOT want to install a CUDA ver of pytorch…
And it is faching just the same with the final bug I met in the other issue (see the hyperlink above) !

EDIT3: the result of find \ -name "cuda" is

/usr/local/cuda-8.0/targets/x86_64-linux/include/thrust/system/cuda
/usr/local/cuda
/opt/pytorch/test/ffi/src/cuda
/opt/pytorch/torch/csrc/cuda
/opt/pytorch/torch/cuda
/opt/conda/envs/pytorch-py3.6/lib/python3.6/site-packages/torch/cuda

still know nothing about how to debug it.

1 Like

Set environment variable NO_CUDA=1 before build if you don’t have NVidia GPUs.

I’ve tried writing it into .bashrc, but in fact, the Dockerfile has some lines wrote for CUDA, so it seems useless.
EDIT: And surely it didn’t work, with a same return.

Where is your docker file? Can you upload it to git?

I used the dockerfile here: https://github.com/pytorch/pytorch/blob/master/Dockerfile

And how did you build and run it?

As I mentioned above, first git clone the whole sources git clone --recursive https://github.com/pytorch/pytorch, and then just do docker build -t pytorch .

You need to declare the variable inside Dockerfile. Your .bashrc won’t affect the Docker internal environment.

Take 30 minutes to check out Docker tutorials. Docker is an absolute life saver.

1 Like