mage icon indicating copy to clipboard operation
mage copied to clipboard

[BUG] Compilation problem when installing python3.9 environment by anaconda

Open csqjxiao opened this issue 7 months ago • 2 comments

I am a university researcher, and would like to develop several new graph mining algorithms based on mage. So I have to install mage from source code. The following compilation error is encoutered however.

In file included from /home/qingjunxiao.linux/mage/cpp/biconnected_components_module/biconnected_components_module.cpp:1:
/home/qingjunxiao.linux/mage/cpp/memgraph/include/mg_exceptions.hpp:79:44: error: expected ‘)’ before ‘identifier’
   79 |   explicit InvalidIDException(std::uint64_t identifier) : message_{StringSerialize("Invalid ID =", identifier)} {}
      |                              ~             ^~~~~~~~~~~
      |                                            )
/home/qingjunxiao.linux/mage/cpp/memgraph/include/mg_exceptions.hpp:79:113: error: expected unqualified-id before ‘{’ token
   79 |   explicit InvalidIDException(std::uint64_t identifier) : message_{StringSerialize("Invalid ID =", identifier)} {}
      |                                                                                                                 ^
In file included from /home/qingjunxiao.linux/mage/cpp/bipartite_matching_module/bipartite_matching_module.cpp:1:
/home/qingjunxiao.linux/mage/cpp/memgraph/include/mg_exceptions.hpp:79:44: error: expected ‘)’ before ‘identifier’
   79 |   explicit InvalidIDException(std::uint64_t identifier) : message_{StringSerialize("Invalid ID =", identifier)} {}
      |                              ~             ^~~~~~~~~~~
      |                                            )
/home/qingjunxiao.linux/mage/cpp/memgraph/include/mg_exceptions.hpp:79:113: error: expected unqualified-id before ‘{’ token
   79 |   explicit InvalidIDException(std::uint64_t identifier) : message_{StringSerialize("Invalid ID =", identifier)} {}
      |                                                                                                                 ^
make[2]: *** [biconnected_components_module/CMakeFiles/biconnected_components.dir/build.make:76: biconnected_components_module/CMakeFiles/biconnected_components.dir/biconnected_components_module.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1772: biconnected_components_module/CMakeFiles/biconnected_components.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[2]: *** [bipartite_matching_module/CMakeFiles/bipartite_matching.dir/build.make:76: bipartite_matching_module/CMakeFiles/bipartite_matching.dir/bipartite_matching_module.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:1824: bipartite_matching_module/CMakeFiles/bipartite_matching.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
2024-06-25 07:42:53,611 [ERROR]: [Terminal] Running command ['make', '-j4'] failed.
2024-06-25 07:42:53,611 [ERROR]: [Terminal] (1/8) Building C++ modules failed.
2024-06-25 07:42:53,611 [ERROR]: [Terminal] An error occurred while building. Check the output message for more information.

My platform is Ubuntu 24.04 (i.e., MacOS installed with lima and ubuntu-lts). The CPU chip on my computer is Apple M1 Pro with ARM instruction set.

Firstly, I cloned the v1.17-memgraph-2.17 branch of mage project.

git clone --recurse-submodules -b v1.17-memgraph-2.17 https://github.com/memgraph/mage

Then, I installed the project's dependencies by the following commands. Note that libpython3.9 is not availble on Ubuntu 24.04. So I have to install a python3.9 virtual environment by anaconda.

sudo apt install python3 python3-dev python3-setuptools python3-pip libcurl4 libssl-dev openssl build-essential make cmake curl g++ clang unixodbc
# this a must
sudo apt install unixodbc-dev

wget https://repo.anaconda.com/archive/Anaconda3-2024.02-1-Linux-aarch64.sh
bash Anaconda3-2024.02-1-Linux-aarch64.sh
source ~/.bashrc
conda update conda
conda update anaconda
conda create --name python39 python=3.9
conda activate python39

curl https://sh.rustup.rs -sSf | sh -s -- -y \
&& export PATH="/root/.cargo/bin:${PATH}"

cd ~/mage
pip3 install -r ./python/requirements.txt 
pip3 install -r ./python/tests/requirements.txt 
pip3 install torch-sparse torch-cluster torch-spline-conv torch-geometric torch-scatter -f https://data.pyg.org/whl/torch-1.12.0+cu102.html

I have also installed the toolchain.

$ source /opt/toolchain-vXYZ/activate
(toolchain-v5) (python39) $ which gcc
/opt/toolchain-v5/bin/gcc
(toolchain-v5) (python39) $ which g++
/opt/toolchain-v5/bin/g++
(toolchain-v5) (python39) $ which clang
/opt/toolchain-v5/bin/clang
(toolchain-v5) (python39) $ which clang++
/opt/toolchain-v5/bin/clang++

Everything was fine until this step.

Thirdly, I complied the probject by:

python3 setup build -p /usr/lib/memgraph/query_modules

The C++ compiliation error appeared as mentioned at the beginning.

[ 23%] Building CXX object biconnected_components_module/CMakeFiles/biconnected_components.dir/biconnected_components_module.cpp.o
In file included from /home/qingjunxiao.linux/mage/cpp/biconnected_components_module/biconnected_components_module.cpp:1:
/home/qingjunxiao.linux/mage/cpp/memgraph/include/mg_exceptions.hpp:79:44: error: expected ‘)’ before ‘identifier’
   79 |   explicit InvalidIDException(std::uint64_t identifier) : message_{StringSerialize("Invalid ID =", identifier)} {}
      |                              ~             ^~~~~~~~~~~
      |                                            )
/home/qingjunxiao.linux/mage/cpp/memgraph/include/mg_exceptions.hpp:79:113: error: expected unqualified-id before ‘{’ token
   79 |   explicit InvalidIDException(std::uint64_t identifier) : message_{StringSerialize("Invalid ID =", identifier)} {}
      |                                                                                                                 ^
make[2]: *** [biconnected_components_module/CMakeFiles/biconnected_components.dir/build.make:76: biconnected_components_module/CMakeFiles/biconnected_components.dir/biconnected_components_module.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1772: biconnected_components_module/CMakeFiles/biconnected_components.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

csqjxiao avatar Jun 25 '24 00:06 csqjxiao