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

feat+fix: adds compatibility to run.sh for pyenv and let pyenv install python 3.8 if it's not installed #2201

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/sh

# Changes the working directory to the one where the bash script is located.
cd $(dirname -- $(readlink -fn -- "$0"))

if [ "$(uname)" = "Darwin" ]; then
# macOS specific env:
export PYTORCH_ENABLE_MPS_FALLBACK=1
Expand All @@ -17,13 +20,17 @@ else
requirements_file="requirements.txt"

# Check if Python 3.8 is installed
if ! command -v python3.8 >/dev/null 2>&1 || pyenv versions --bare | grep -q "3.8"; then
if ! command -v python3.8 >/dev/null 2>&1 || pyenv version --bare | grep -qv "3.8"; then
echo "Python 3 not found. Attempting to install 3.8..."
if [ "$(uname)" = "Darwin" ] && command -v brew >/dev/null 2>&1; then
brew install [email protected]
elif [ "$(uname)" = "Linux" ] && command -v apt-get >/dev/null 2>&1; then
sudo apt-get update
sudo apt-get install python3.8
elif [ "$(uname)" = "Linux" ] && command -v pyenv >/dev/null 2>&1; then
pyenv install 3.8
pyenv local 3.8
alias python3.8=python
else
echo "Please install Python 3.8 manually."
exit 1
Expand Down