marius-team / marius

Large scale graph learning on a single machine.
https://marius-project.org
Apache License 2.0
160 stars 45 forks source link

Fix docker build issue on Ubuntu VM #142

Closed sarda-devesh closed 7 months ago

sarda-devesh commented 1 year ago

Hello,

I was recently trying to setup Marius on a VM whose OS image is ubuntu-2204-jammy-v20230727. I installed Docker (Docker version 24.0.5, build ced0996) onto my VM and followed the steps in the Docker Installation Guide. I was able to build the cpu_ubuntu Dockerfile into an image and was able to run it but when I tried to run pip3 install . --no-build-isolation I got the error that:

Building wheel for marius (pyproject.toml) ... error
  error: subprocess-exited-with-error
  ...
 subprocess.CalledProcessError: Command '['cmake', '/working_dir/marius', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/working_dir/marius/build/lib.linux-x86_64-3.10/marius', '-DPYTHON_EXECUTABLE=/usr/bin/python3', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE', '-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE', '-DCMAKE_INSTALL_RPATH=$ORIGIN']' returned non-zero exit status 1.
 ...
 ERROR: Could not build wheels for marius, which is required to install pyproject.toml-based projects

Running the cmake command manually revealed that it failed due to the error that `fatal: detected dubious ownership in repository at '/working_dir/marius’. I was able to resolve that error by adding the following lines to the Dockerfile:

# Ensure that marius is considered a safe directory
RUN git config --global --add safe.directory /working_dir/marius

I ran through the steps in the installation guide after implementing and this time ran into the error that:

Building wheel for marius (pyproject.toml) ... error
  error: subprocess-exited-with-error
  ...
 subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'bindings', '--config', 'Release', '--', '-j4']' returned non-zero exit status 2.
 ...
 ERROR: Could not build wheels for marius, which is required to install pyproject.toml-based projects

However, I was able to run the command without error using both manually as well using the subprocess library by doing something like:

$ python3
>>> import subprocess
>>> subprocess.run(['cmake', '--build', '.', '--target', 'bindings', '--config', 'Release', '--', '-j4'])

Looking through the subprocess library docs, they also recommend using run over other methods and thus I changed the setup.py file to use subprocess.run wherever applicable. Making these two changes allowed me to successfully build marius on CPU.

I don't have access to a GPU but I would assume that these changes shouldn't make a difference when compiling on a GPU since it is host-related issues rather than a GPU device-related issue.