Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] deps: Add setuptools for running from source #19

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

digitalf0x
Copy link
Contributor

In short

  • Add setuptools to requirements.txt for running BridgeApp from source in Virtual Environment
    • Fixes OpenVR raising an error when running on Python 3.12 with Kubuntu 24.04
    • Might not be the most correct solution

Examples

Fixed error message

Traceback (most recent call last):
  File "[...]/VRC-Haptic-Pancake/BridgeApp/main.py", line 6, in <module>
    from target_ovr import OpenVRTracker
  File "[...]/VRC-Haptic-Pancake/BridgeApp/target_ovr.py", line 1, in <module>
    import openvr
  File "[...]/ignored-from-repo-venv/lib/python3.12/site-packages/openvr/__init__.py", line 8, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

Run-from-source script

#!/bin/bash

# Find path
_LOCAL_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# Fetch repository with GitHub source code download, or…
# git clone "https://github.com/Z4urce/VRC-Haptic-Pancake.git"
# cd "VRC-Haptic-Pancake"

# Enter software directory
cd "$_LOCAL_DIR/VRC-Haptic-Pancake/"

# Build and activate a Python virtual environment to keep your system clean
if [ ! -d "ignored-from-repo-venv" ]; then
    python3 -m venv "ignored-from-repo-venv"
fi
source "ignored-from-repo-venv/bin/activate"

# Install/update dependencies into the venv
pip3 install -r "BridgeApp/requirements.txt"

# Run app
python3 BridgeApp/main.py

# NOTE₁: You need to be inside the Python venv for this to work.  Redo the
#    "source […]" command if you're running this a second time, or just save this as
#    a "run-linux.sh" command in the root of the repository.

# NOTE₂: the app might segfault without tracing enabled for some reason
#    You might need to run it like so - this slows it down:
#
#python3 -m trace --count --coverdir=/dev/null BridgeApp/main.py

Add "setuptools" to requirements.txt for running the BridgeApp from
source code in a Python Virtual Environment.  This fixes OpenVR
raising an error when running on Python 3.12 with Kubuntu 24.04.

See https://setuptools.pypa.io/en/latest/userguide/quickstart.html

Example error:
Traceback (most recent call last):
  File "[...]/VRC-Haptic-Pancake/BridgeApp/main.py", line 6, in <module>
    from target_ovr import OpenVRTracker
  File "[...]/VRC-Haptic-Pancake/BridgeApp/target_ovr.py", line 1, in <module>
    import openvr
  File "[...]/ignored-from-repo-venv/lib/python3.12/site-packages/openvr/__init__.py", line 8, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'
@Z4urce Z4urce merged commit c4e13c7 into Z4urce:main Nov 13, 2024
2 checks passed
@digitalf0x digitalf0x deleted the fix-py3.12-standalone branch November 14, 2024 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants