Unable to Install CPU Version of l4casadi with pip install . --no-build-isolation
tlt18 opened this issue · 2 comments
I've been attempting to install the CPU version of the code using the following commands:
pip install . --no-build-isolation
or
pip install l4casadi --no-build-isolation
However, I've encountered some issues during the installation process:
Processing /home/tlt22/project/l4casadi
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: torch in /home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages (from l4casadi==2.0.0) (2.3.0.post101)
Collecting casadi>=3.6 (from l4casadi==2.0.0)
Using cached casadi-3.6.6-cp38-none-manylinux2014_x86_64.whl.metadata (2.2 kB)
Requirement already satisfied: jinja2>=3.1 in /home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages (from l4casadi==2.0.0) (3.1.4)
Requirement already satisfied: numpy in /home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages (from casadi>=3.6->l4casadi==2.0.0) (1.24.3)
Requirement already satisfied: MarkupSafe>=2.0 in /home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages (from jinja2>=3.1->l4casadi==2.0.0) (2.1.3)
Requirement already satisfied: filelock in /home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages (from torch->l4casadi==2.0.0) (3.13.1)
Requirement already satisfied: typing-extensions>=4.8.0 in /home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages (from torch->l4casadi==2.0.0) (4.11.0)
Requirement already satisfied: sympy in /home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages (from torch->l4casadi==2.0.0) (1.13.2)
Requirement already satisfied: networkx in /home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages (from torch->l4casadi==2.0.0) (3.1)
Requirement already satisfied: fsspec in /home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages (from torch->l4casadi==2.0.0) (2024.6.1)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in /home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages (from sympy->torch->l4casadi==2.0.0) (1.3.0)
Using cached casadi-3.6.6-cp38-none-manylinux2014_x86_64.whl (75.8 MB)
Building wheels for collected packages: l4casadi
Building wheel for l4casadi (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for l4casadi (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [123 lines of output]
--------------------------------------------------------------------------------
-- Trying 'Ninja' generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
Not searching for unused variables given on the command line.
-- The C compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/tlt22/miniconda3/envs/tracking/bin/x86_64-conda-linux-gnu-cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- The CXX compiler identification is GNU 11.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/tlt22/miniconda3/envs/tracking/bin/x86_64-conda-linux-gnu-c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (0.9s)
-- Generating done (0.0s)
-- Build files have been written to: /home/tlt22/project/l4casadi/_cmake_test_compile/build
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying 'Ninja' generator - success
--------------------------------------------------------------------------------
Configuring Project
Working directory:
/home/tlt22/project/l4casadi/_skbuild/linux-x86_64-3.8/cmake-build
Command:
/home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages/cmake/data/bin/cmake /home/tlt22/project/l4casadi/libl4casadi -G Ninja -DCMAKE_MAKE_PROGRAM:FILEPATH=/home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages/ninja/data/bin/ninja --no-warn-unused-cli -DCMAKE_INSTALL_PREFIX:PATH=/home/tlt22/project/l4casadi/_skbuild/linux-x86_64-3.8/cmake-install -DPYTHON_VERSION_STRING:STRING=3.8.19 -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages/skbuild/resources/cmake -DPYTHON_EXECUTABLE:PATH=/home/tlt22/miniconda3/envs/tracking/bin/python -DPYTHON_INCLUDE_DIR:PATH=/home/tlt22/miniconda3/envs/tracking/include/python3.8 -DPYTHON_LIBRARY:PATH=/home/tlt22/miniconda3/envs/tracking/lib/libpython3.8.so -DPython_EXECUTABLE:PATH=/home/tlt22/miniconda3/envs/tracking/bin/python -DPython_ROOT_DIR:PATH=/home/tlt22/miniconda3/envs/tracking -DPython_FIND_REGISTRY:STRING=NEVER -DPython_INCLUDE_DIR:PATH=/home/tlt22/miniconda3/envs/tracking/include/python3.8 -DPython_NumPy_INCLUDE_DIRS:PATH=/home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages/numpy/core/include -DPython3_EXECUTABLE:PATH=/home/tlt22/miniconda3/envs/tracking/bin/python -DPython3_ROOT_DIR:PATH=/home/tlt22/miniconda3/envs/tracking -DPython3_FIND_REGISTRY:STRING=NEVER -DPython3_INCLUDE_DIR:PATH=/home/tlt22/miniconda3/envs/tracking/include/python3.8 -DPython3_NumPy_INCLUDE_DIRS:PATH=/home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages/numpy/core/include -DCMAKE_MAKE_PROGRAM:FILEPATH=/home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages/ninja/data/bin/ninja -DCMAKE_LINKER=/home/tlt22/miniconda3/envs/tracking/bin/x86_64-conda-linux-gnu-ld -DCMAKE_STRIP=/home/tlt22/miniconda3/envs/tracking/bin/x86_64-conda-linux-gnu-strip -DCMAKE_BUILD_TYPE=Release -DCMAKE_TORCH_PATH=/home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages/torch -DCMAKE_LINKER=/home/tlt22/miniconda3/envs/tracking/bin/x86_64-conda-linux-gnu-ld -DCMAKE_STRIP=/home/tlt22/miniconda3/envs/tracking/bin/x86_64-conda-linux-gnu-strip
CMake Deprecation Warning at CMakeLists.txt:5 (cmake_minimum_required):
Compatibility with CMake < 3.5 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
Not searching for unused variables given on the command line.
-- Caffe2: Found protobuf with new-style protobuf targets.
-- Caffe2: Protobuf version 25.3.0
-- Caffe2: CUDA detected: 12.0
-- Caffe2: CUDA nvcc is: /usr/bin/nvcc
-- Caffe2: CUDA toolkit directory: /usr
CMake Error at /home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages/torch/share/cmake/Caffe2/public/cuda.cmake:110 (message):
Caffe2: Couldn't determine version from header: Change Dir:
'/home/tlt22/project/l4casadi/_skbuild/linux-x86_64-3.8/cmake-build/CMakeFiles/CMakeTmp'
Run Build Command(s):
/home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages/ninja/data/bin/ninja
-v cmTC_6319b
[1/2] /home/tlt22/miniconda3/envs/tracking/bin/x86_64-conda-linux-gnu-c++
-fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -march=nocona
-mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2
-ffunction-sections -pipe -isystem
/home/tlt22/miniconda3/envs/tracking/include -o
CMakeFiles/cmTC_6319b.dir/detect_cuda_version.cc.o -c
/home/tlt22/project/l4casadi/_skbuild/linux-x86_64-3.8/cmake-build/detect_cuda_version.cc
FAILED: CMakeFiles/cmTC_6319b.dir/detect_cuda_version.cc.o
/home/tlt22/miniconda3/envs/tracking/bin/x86_64-conda-linux-gnu-c++
-fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -march=nocona
-mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2
-ffunction-sections -pipe -isystem
/home/tlt22/miniconda3/envs/tracking/include -o
CMakeFiles/cmTC_6319b.dir/detect_cuda_version.cc.o -c
/home/tlt22/project/l4casadi/_skbuild/linux-x86_64-3.8/cmake-build/detect_cuda_version.cc
/home/tlt22/project/l4casadi/_skbuild/linux-x86_64-3.8/cmake-build/detect_cuda_version.cc:1:10:
fatal error: cuda.h: No such file or directory
1 | #include <cuda.h>
| ^~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
Call Stack (most recent call first):
/home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages/torch/share/cmake/Caffe2/Caffe2Config.cmake:87 (include)
/home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
CMakeLists.txt:18 (find_package)
-- Configuring incomplete, errors occurred!
Traceback (most recent call last):
File "/home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages/skbuild/setuptools_wrap.py", line 660, in setup
env = cmkr.configure(
File "/home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages/skbuild/cmaker.py", line 354, in configure
raise SKBuildError(msg)
An error occurred while configuring with CMake.
Command:
/home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages/cmake/data/bin/cmake /home/tlt22/project/l4casadi/libl4casadi -G Ninja -DCMAKE_MAKE_PROGRAM:FILEPATH=/home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages/ninja/data/bin/ninja --no-warn-unused-cli -DCMAKE_INSTALL_PREFIX:PATH=/home/tlt22/project/l4casadi/_skbuild/linux-x86_64-3.8/cmake-install -DPYTHON_VERSION_STRING:STRING=3.8.19 -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages/skbuild/resources/cmake -DPYTHON_EXECUTABLE:PATH=/home/tlt22/miniconda3/envs/tracking/bin/python -DPYTHON_INCLUDE_DIR:PATH=/home/tlt22/miniconda3/envs/tracking/include/python3.8 -DPYTHON_LIBRARY:PATH=/home/tlt22/miniconda3/envs/tracking/lib/libpython3.8.so -DPython_EXECUTABLE:PATH=/home/tlt22/miniconda3/envs/tracking/bin/python -DPython_ROOT_DIR:PATH=/home/tlt22/miniconda3/envs/tracking -DPython_FIND_REGISTRY:STRING=NEVER -DPython_INCLUDE_DIR:PATH=/home/tlt22/miniconda3/envs/tracking/include/python3.8 -DPython_NumPy_INCLUDE_DIRS:PATH=/home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages/numpy/core/include -DPython3_EXECUTABLE:PATH=/home/tlt22/miniconda3/envs/tracking/bin/python -DPython3_ROOT_DIR:PATH=/home/tlt22/miniconda3/envs/tracking -DPython3_FIND_REGISTRY:STRING=NEVER -DPython3_INCLUDE_DIR:PATH=/home/tlt22/miniconda3/envs/tracking/include/python3.8 -DPython3_NumPy_INCLUDE_DIRS:PATH=/home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages/numpy/core/include -DCMAKE_MAKE_PROGRAM:FILEPATH=/home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages/ninja/data/bin/ninja -DCMAKE_LINKER=/home/tlt22/miniconda3/envs/tracking/bin/x86_64-conda-linux-gnu-ld -DCMAKE_STRIP=/home/tlt22/miniconda3/envs/tracking/bin/x86_64-conda-linux-gnu-strip -DCMAKE_BUILD_TYPE=Release -DCMAKE_TORCH_PATH=/home/tlt22/miniconda3/envs/tracking/lib/python3.8/site-packages/torch -DCMAKE_LINKER=/home/tlt22/miniconda3/envs/tracking/bin/x86_64-conda-linux-gnu-ld -DCMAKE_STRIP=/home/tlt22/miniconda3/envs/tracking/bin/x86_64-conda-linux-gnu-strip
Source directory:
/home/tlt22/project/l4casadi/libl4casadi
Working directory:
/home/tlt22/project/l4casadi/_skbuild/linux-x86_64-3.8/cmake-build
Please see CMake's output for more information.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for l4casadi
Failed to build l4casadi
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (l4casadi)
I've tried the following solutions based on other similar issues:
- Running the command with
CUDACXX=/usr/bin/nvc
:
CUDACXX=/usr/bin/nvcc pip install . --no-build-isolation
- Adding paths to
./bashrc
:
export CUDACXX=/usr/bin/nvcc
export CUDA_HOME=/usr/lib/cuda
- Adding the following lines at the beginning of
./l4casadi/libl4casadi/CMakeLists.txt
:
set(CMAKE_CUDA_COMPILER "/usr/bin/nvcc")
set(CUDAToolkit_ROOT "/usr/lib/cuda")
include_directories("/usr/include")
Unfortunately, none of these solutions have worked for me. I'd appreciate any help or suggestions on how to resolve this issue. Thank you!
Which torch version do you have installed? Please make sure the cpu torch version is installed
pip3 install torch --index-url https://download.pytorch.org/whl/cpu
Thank you for your suggestions! After further investigation, I realized that the issue was related to having the GPU version of PyTorch installed. I was able to resolve the problem by uninstalling the GPU version and reinstalling PyTorch for CPU.