question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error building docker image

See original GitHub issue

From now on, we recommend using our discussion forum (https://github.com/rusty1s/pytorch_geometric/discussions) for general questions.

❓ Questions & Help

I am using the Dockerfile within this repo. However, when I try to build the image myself. I encountered the ‘gcc error’. pyG temporal docker error

The full error log would be:

  ERROR: Command errored out with exit status 1:
   command: /home/user/miniconda/envs/py36/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fssw7td4/torch-scatter_0d58cd9527cc4f64bcb7fe55c6dd4e85/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fssw7td4/torch-scatter_0d58cd9527cc4f64bcb7fe55c6dd4e85/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-0dqbqa0s
       cwd: /tmp/pip-install-fssw7td4/torch-scatter_0d58cd9527cc4f64bcb7fe55c6dd4e85/
  Complete output (58 lines):
  No CUDA runtime is found, using CUDA_HOME='/usr/local/cuda'
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.6
  creating build/lib.linux-x86_64-3.6/torch_scatter
  copying torch_scatter/segment_csr.py -> build/lib.linux-x86_64-3.6/torch_scatter
  copying torch_scatter/scatter.py -> build/lib.linux-x86_64-3.6/torch_scatter
  copying torch_scatter/segment_coo.py -> build/lib.linux-x86_64-3.6/torch_scatter
  copying torch_scatter/utils.py -> build/lib.linux-x86_64-3.6/torch_scatter
  copying torch_scatter/__init__.py -> build/lib.linux-x86_64-3.6/torch_scatter
  copying torch_scatter/placeholder.py -> build/lib.linux-x86_64-3.6/torch_scatter
  creating build/lib.linux-x86_64-3.6/torch_scatter/composite
  copying torch_scatter/composite/logsumexp.py -> build/lib.linux-x86_64-3.6/torch_scatter/composite
  copying torch_scatter/composite/std.py -> build/lib.linux-x86_64-3.6/torch_scatter/composite
  copying torch_scatter/composite/__init__.py -> build/lib.linux-x86_64-3.6/torch_scatter/composite
  copying torch_scatter/composite/softmax.py -> build/lib.linux-x86_64-3.6/torch_scatter/composite
  running build_ext
  building 'torch_scatter._version_cpu' extension
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/tmp
  creating build/temp.linux-x86_64-3.6/tmp/pip-install-fssw7td4
  creating build/temp.linux-x86_64-3.6/tmp/pip-install-fssw7td4/torch-scatter_0d58cd9527cc4f64bcb7fe55c6dd4e85
  creating build/temp.linux-x86_64-3.6/tmp/pip-install-fssw7td4/torch-scatter_0d58cd9527cc4f64bcb7fe55c6dd4e85/csrc
  gcc -pthread -B /home/user/miniconda/envs/py36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-install-fssw7td4/torch-scatter_0d58cd9527cc4f64bcb7fe55c6dd4e85/csrc -I/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include -I/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/TH -I/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/THC -I/home/user/miniconda/envs/py36/include/python3.6m -c /tmp/pip-install-fssw7td4/torch-scatter_0d58cd9527cc4f64bcb7fe55c6dd4e85/csrc/version.cpp -o build/temp.linux-x86_64-3.6/tmp/pip-install-fssw7td4/torch-scatter_0d58cd9527cc4f64bcb7fe55c6dd4e85/csrc/version.o -O2 -DAT_PARALLEL_OPENMP -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_version_cpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
  cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
  In file included from /home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/ATen/core/boxing/KernelFunction.h:5:0,
                   from /home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/ATen/core/dispatch/DispatchTable.h:10,
                   from /home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/ATen/core/dispatch/OperatorEntry.h:3,
                   from /home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/ATen/core/dispatch/Dispatcher.h:3,
                   from /home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/ATen/core/TensorMethods.h:10,
                   from /home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/ATen/Tensor.h:12,
                   from /home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/ATen/Context.h:4,
                   from /home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/ATen/ATen.h:5,
                   from /home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
                   from /home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/torch/script.h:3,
                   from /tmp/pip-install-fssw7td4/torch-scatter_0d58cd9527cc4f64bcb7fe55c6dd4e85/csrc/version.cpp:2:
  /home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/ATen/core/boxing/kernel_functor.h: In instantiation of 'typename c10::guts::infer_function_traits<Functor>::type::return_type c10::detail::call_functor_with_args_from_stack_(Functor*, c10::Stack*, c10::guts::index_sequence<INDEX ...>) [with Functor = c10::detail::WrapRuntimeKernelFunctor_<long int (*)(), long int, c10::guts::typelist::typelist<> >; bool AllowDeprecatedTypes = true; long unsigned int ...ivalue_arg_indices = {}; typename c10::guts::infer_function_traits<Functor>::type::return_type = long int; c10::Stack = std::vector<c10::IValue, std::allocator<c10::IValue> >; c10::guts::index_sequence<INDEX ...> = c10::guts::integer_sequence<long unsigned int>]':
  /home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/ATen/core/boxing/kernel_functor.h:202:77:   required from 'typename c10::guts::infer_function_traits<Functor>::type::return_type c10::detail::call_functor_with_args_from_stack(Functor*, c10::Stack*) [with Functor = c10::detail::WrapRuntimeKernelFunctor_<long int (*)(), long int, c10::guts::typelist::typelist<> >; bool AllowDeprecatedTypes = true; typename c10::guts::infer_function_traits<Functor>::type::return_type = long int; c10::Stack = std::vector<c10::IValue, std::allocator<c10::IValue> >]'
  /home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/ATen/core/boxing/kernel_functor.h:234:91:   required from 'static void c10::detail::wrap_kernel_functor_boxed<KernelFunctor, AllowDeprecatedTypes, typename std::enable_if<(! std::is_same<void, typename c10::guts::infer_function_traits<Functor>::type::return_type>::value), void>::type>::call(c10::OperatorKernel*, c10::Stack*) [with KernelFunctor = c10::detail::WrapRuntimeKernelFunctor_<long int (*)(), long int, c10::guts::typelist::typelist<> >; bool AllowDeprecatedTypes = true; c10::Stack = std::vector<c10::IValue, std::allocator<c10::IValue> >]'
  /home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/ATen/core/boxing/KernelFunction.h:172:7:   required from 'static c10::KernelFunction c10::KernelFunction::makeFromUnboxedFunctor(std::unique_ptr<c10::OperatorKernel>) [with bool AllowLegacyTypes = true; KernelFunctor = c10::detail::WrapRuntimeKernelFunctor_<long int (*)(), long int, c10::guts::typelist::typelist<> >]'
  /home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/ATen/core/boxing/KernelFunction.h:313:111:   required from 'static c10::KernelFunction c10::KernelFunction::makeFromUnboxedRuntimeFunction(FuncType*) [with bool AllowLegacyTypes = true; FuncType = long int()]'
  /home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/ATen/core/op_registration/op_registration.h:517:72:   required from 'c10::guts::enable_if_t<(c10::guts::is_function_type<T>::value && (! std::is_same<FuncType, void(c10::OperatorKernel*, std::vector<c10::IValue, std::allocator<c10::IValue> >*)>::value)), c10::RegisterOperators&&> c10::RegisterOperators::op(const string&, FuncType*, c10::RegisterOperators::Options&&) && [with FuncType = long int(); c10::guts::enable_if_t<(c10::guts::is_function_type<T>::value && (! std::is_same<FuncType, void(c10::OperatorKernel*, std::vector<c10::IValue, std::allocator<c10::IValue> >*)>::value)), c10::RegisterOperators&&> = c10::RegisterOperators&&; std::string = std::basic_string<char>]'
  /tmp/pip-install-fssw7td4/torch-scatter_0d58cd9527cc4f64bcb7fe55c6dd4e85/csrc/version.cpp:25:79:   required from here
  /home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/ATen/core/boxing/kernel_functor.h:191:22: warning: variable 'num_ivalue_args' set but not used [-Wunused-but-set-variable]
       constexpr size_t num_ivalue_args = sizeof...(ivalue_arg_indices);
                        ^~~~~~~~~~~~~~~
  g++ -pthread -shared -B /home/user/miniconda/envs/py36/compiler_compat -L/home/user/miniconda/envs/py36/lib -Wl,-rpath=/home/user/miniconda/envs/py36/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/tmp/pip-install-fssw7td4/torch-scatter_0d58cd9527cc4f64bcb7fe55c6dd4e85/csrc/version.o -o build/lib.linux-x86_64-3.6/torch_scatter/_version_cpu.so -s
  building 'torch_scatter._segment_coo_cpu' extension
  creating build/temp.linux-x86_64-3.6/tmp/pip-install-fssw7td4/torch-scatter_0d58cd9527cc4f64bcb7fe55c6dd4e85/csrc/cpu
  gcc -pthread -B /home/user/miniconda/envs/py36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-install-fssw7td4/torch-scatter_0d58cd9527cc4f64bcb7fe55c6dd4e85/csrc -I/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include -I/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/TH -I/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/include/THC -I/home/user/miniconda/envs/py36/include/python3.6m -c /tmp/pip-install-fssw7td4/torch-scatter_0d58cd9527cc4f64bcb7fe55c6dd4e85/csrc/segment_coo.cpp -o build/temp.linux-x86_64-3.6/tmp/pip-install-fssw7td4/torch-scatter_0d58cd9527cc4f64bcb7fe55c6dd4e85/csrc/segment_coo.o -O2 -DAT_PARALLEL_OPENMP -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_segment_coo_cpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
  cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
  /tmp/pip-install-fssw7td4/torch-scatter_0d58cd9527cc4f64bcb7fe55c6dd4e85/csrc/segment_coo.cpp: In static member function 'static torch::autograd::variable_list SegmentMeanCOO::backward(torch::autograd::AutogradContext*, torch::autograd::variable_list)':
  /tmp/pip-install-fssw7td4/torch-scatter_0d58cd9527cc4f64bcb7fe55c6dd4e85/csrc/segment_coo.cpp:104:13: error: 'class at::Tensor' has no member named 'true_divide_'
       grad_in.true_divide_(count);
               ^~~~~~~~~~~~
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for torch-scatter

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
johnny12150commented, May 15, 2021
FROM nvidia/cuda:11.1.1-base-ubuntu20.04

# Install some basic utilities
RUN apt-get update && apt-get install -y \
    curl \
    ca-certificates \
    sudo \
    git \
    bzip2 \
    libx11-6 \
 && rm -rf /var/lib/apt/lists/*

# Create a working directory
RUN mkdir /app
WORKDIR /app

# Create a non-root user and switch to it
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
 && chown -R user:user /app
RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
USER user

# All users can use /home/user as their home directory
ENV HOME=/home/user
RUN chmod 777 /home/user

# Install Miniconda and Python 3.8
ENV CONDA_AUTO_UPDATE_CONDA=false
ENV PATH=/home/user/miniconda/bin:$PATH
RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py38_4.8.3-Linux-x86_64.sh \
 && chmod +x ~/miniconda.sh \
 && ~/miniconda.sh -b -p ~/miniconda \
 && rm ~/miniconda.sh \
 && conda install -y python==3.8.3 \
 && conda clean -ya

# CUDA 11.1-specific steps
RUN conda install -y -c conda-forge cudatoolkit=11.1.1 \
 && conda install -y -c pytorch \
    "pytorch=1.8.1=py3.8_cuda11.1_cudnn8.0.5_0" \
    "torchvision=0.9.1=py38_cu111" \
 && conda clean -ya

# Install PyTorch Geometric.
RUN CPATH=/usr/local/cuda/include:$CPATH \
 && LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH \
 && DYLD_LIBRARY_PATH=/usr/local/cuda/lib:$DYLD_LIBRARY_PATH

RUN pip install scipy

RUN pip install --no-index torch-scatter -f https://pytorch-geometric.com/whl/torch-1.8.0+cu111.html \
 && pip install --no-index torch-sparse -f https://pytorch-geometric.com/whl/torch-1.8.0+cu111.html \
 && pip install --no-index torch-cluster -f https://pytorch-geometric.com/whl/torch-1.8.0+cu111.html \
 && pip install --no-index torch-spline-conv -f https://pytorch-geometric.com/whl/torch-1.8.0+cu111.html \
 && pip install torch-geometric

# Set the default command to python3
CMD ["python3"]

This works for me. Hope it will help someone who needs an image of this.

0reactions
Haggaimcommented, Sep 5, 2021

Worked for me as well. Thanks fo sharing!

Read more comments on GitHub >

github_iconTop Results From Across the Web

docker - Error on building Dockerfile to Image
The error means it can't find the directory which mean it probably doesn't exist or you are doing it the wrong way.
Read more >
Unable to build my docker image
I have a created a project as well as dockerfiles inside it. I'm trying to run it from docker but I keep getting...
Read more >
Docker: “build” Requires 1 Argument Error
The most common reason for “Docker build Requires 1 Argument” error is when we try to build the image without providing sufficient arguments....
Read more >
Error building docker image for different platform/arch on ...
It seems that this error occurs only when having scratch image as a base and ARG as a second command. After swapping ARG...
Read more >
Use kaniko to build Docker images - GitLab Docs
kaniko is a tool to build container images from a Dockerfile, inside a container or Kubernetes cluster. kaniko solves two problems with using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found