etiennedub / pyk4a

Python 3 wrapper for Azure-Kinect-Sensor-SDK
MIT License
289 stars 81 forks source link

Unable to Install - WSL2 Ubuntu 18.04 Linux #153

Closed earlev4 closed 2 years ago

earlev4 commented 2 years ago

Hello! First off, thank you very much for the creator and contributors to this project. Your effort and work is greatly appreciated!

I am trying to install pyk4a using pipon WSL2 Ubuntu 18.04 and receiving the following error message.

ERROR: Command errored out with exit status 1: /home/user/anaconda3/envs/pyk4a/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1av56osq/pyk4a_edee96e37c4b41b2a67afe24ade30c1d/setup.py'"'"'; file='"'"'/tmp/pip-install-1av56osq/pyk4a_edee96e37c4b41b2a67afe24ade30c1d/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' build_ext -I/usr/include/k4a/ -L/usr/lib/x86_64-linux-gnu/ install --record /tmp/pip-record-zazo79oo/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/anaconda3/envs/pyk4a/include/python3.8/pyk4a Check the logs for full command output.

Just to note, pip install works for other packages.

To get to this step... I performed a fresh install of WSL2 Ubuntu 18.04 and performed the necessary sudo apt updateand sudo apt upgrade to get current. Also installed Anaconda and an environment (pyk4a) using Python 3.8.12.

Installed the Azure Kinect Sensor SDK (only supported for Ubuntu 18.04) using the Microsoft Package Repository and:

sudo apt install k4a-tools

Also installed the Azure Kinect Body Tracking SDK and:

sudo apt install libk4a1.4-dev sudo apt install libk4abt1.1-dev

Once the Microsoft files were successfully installed, I found the appropriate directories in WSL Ubuntu.

The include files (i.e. k4a.h) were located here: /usr/include/k4a/ The lib files (i.e. lib4ka.so) were located here: /usr/lib/x86_64-linux-gnu/

I then set and confirmed the LD_LIBRARY_PATH to the directory for the lib files in WSL Ubuntu.

export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu echo $LD_LIBRARY_PATH

Lastly, I used pip installwith the global-options set to the include and lib file paths.

pip install pyk4a --global-option=build_ext --global-option="-I/usr/include/k4a/" --global-option="-L/usr/lib/x86_64-linux-gnu/"

Any help, guidance, or suggestions would be greatly appreciated.

Thanks so much!

earlev4 commented 2 years ago

Hello! Was able to resolve this issue. An oversight on my part. Hopefully, this issue can serve as a tutorial for those installing pyk4a on WSL2 Ubuntu 18.04 Linux.

gcc --version

Command 'gcc' not found, but can be installed with:

sudo apt install gcc

Performed the following:

sudo apt install build-essential

gcc --version

gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

pip install pyk4a

Successfully built pyk4a Installing collected packages: python-version, pyk4a Successfully installed pyk4a-1.3.0 python-version-0.0.2

By the way, when performing these steps, the LD_LIBRARY_PATH was not set. Just something to note.

Thanks so much!