Installing Optional Dependencies - a-hurst/klibs GitHub Wiki
Most features in KLibs are available without any extra installation, but there are currently some exceptions. Here are the modules requiring additional dependencies, and instructions on how to install them:
AudioResponse
In order to use the AudioResponse ResponseCollector class to record responses via microphone (or other audio input), you will need to install the PyAudio library for Python. However, depending on your OS and Python version, this can involve some extra dependencies and headaches, and is thus not part of a standard KLibs install.
macOS & Linux
On macOS & Linux, you will need to install the PortAudio library on your system and have a working C compiler to build PyAudio. For macOS, you can achieve both by installing the Homebrew package manager and using it to install portaudio:
brew install portaudio
On Linux, you can install portaudio using your distro's package manager:
sudo apt-get install portaudio19-dev # For Ubuntu/Debian/Mint/etc.
sudo yum install portaudio # For Fedora & CentOS
sudo pacman -S portaudio # For Arch Linux
Then, you can install PyAudio using pip install pyaudio
.
Windows
To install PyAudio on Windows for Python 2.7, 3.5, and 3.6, all you need to do is run
pip install pyaudio
at a command prompt.
There are no official pre-built binaries on PyPI for Python 3.7 or 3.8, however, so you will need to install the pipwin
package for installing unofficial binaries and install PyAudio using that:
pip install pipwin
pipwin install pyaudio
KLEyeLink
In order to use KLibs with an SR Research EyeLink eye tracker, you will need to install the EyeLink Developer's Kit for your system (available on the SR Support forums) along with the pylink
Python library.
Custom Pylink
Due to incompatibilities with virtual environments and newer Python versions, installing Pylink can be a bit of a pain. On macOS and Linux, we recommend installing Pylink using the custom pip-installable version available in this thread, which also fixes some annoying (but non-fatal) SDL-related warnings when using Pylink with KLibs and other SDL-based libraries. This version of PyLink can be installed on Windows too, but will require a C compiler to be installed (see here for more info) as it needs to be built from source.
First, download and extract the pylink-pipinstallable.zip
attachment from the first post in the linked thread. You should now have a folder containing a setup.py
file. Then, you can build and install the library by running:
pip install /path/to/pylink/folder --install-option='no-sdl'
replacing /path/to/pylink/folder
with the actual path to the folder with the setup.py
you extracted from the download (e.g. ~/Downloads/pylink
).
Additionally, if you are running on a newer computer with a higher-resolution display, you can add optional flag
--install-option='img-scale=3'
to the install command. This will make the calibration view larger on the display computer during EyeLink setup.