Today I got OpenTAP 9.18.4 running on my Raspberry Pi 4, with the TUI and the new Python 3.0.0-beta.3 plugin!
Here is a summary of what I had to do to get it running:
- Install Raspbian Bullseye on a Raspberry Pi 4. No reason it shouldn’t work on other versions of the Pi or other Linux flavors, with minor tweaks.
- Install .NET 6 SDK using the simple instructions at: Install the .NET 6.0 SDK on a Raspberry Pi in Two Easy Steps | by John Mills | Jul, 2022 | Level Up Coding
- Clone and build OpenTAP 9.18.4 from source, using the instructions in the README.md
- Set environment variables in my ~/.bashrc so the system knows where dotnet and tap are installed
# at the bottom of ~/.bashrc
export TAP_PATH=$HOME/src/opentap/bin/Release
export DOTNET_ROOT=$HOME/.dotnet
export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools:$TAP_PATH
# then reload the settings by running
source ~/.bashrc
- Install Python plugin, using the -f option because TAP didn’t seem to like missing dependencies
tap package install --version beta -f Python
- Install TUI plugin, using the -f option because TAP didn’t seem to like missing dependencies
tap package install --version beta -f TUI
- In the Python plugin settings in TAP, set the Python Path to (uses Python 3.9 on this system):
/usr/bin/python
- I struggled to figure out what TAP wanted for the Python Library Path. After some sleuthing, I came up with the right .so for my installation.
/usr/lib/aarch64-linux-gnu/libpython3.9.so
After a bit more investigation, I came up with the following Python code that works in both Raspbian and my x64 Mac to find the correct path. Maybe the plugin could run a script like this when the user sets the Python Path and auto-detect the Python Library Path? It would obviously need to be tested on all supported OS’s / bitness / venv’s…
# attempt to find the Python Library Path for current Python
def find_python_library_path():
import glob
import os
import platform
import sysconfig
plat = platform.system()
if plat == 'Darwin':
extension = 'dylib'
elif plat == 'Linux':
extension = 'so'
elif plat == 'Windows':
extension = 'dll'
else:
extension = ''
directory = sysconfig.get_config_var('LIBPL')
files = glob.glob(os.path.join(directory, 'libpython*' + extension))
if len(files) > 0:
return files[0]
else:
return ''
print(find_python_library_path())
- I couldn’t get the TUI to actually set the Python Library Path, so I had to manually set it in my $TAP_PATH/settings/Python.xml file
- Restart TAP, add the Python Charge step and its instrument, and off it goes!
I did see some odd errors / warnings when running TAP/TUI, but it seemed to recover OK and ran this simple plan!