ohsu-comp-bio / vrs_anvil_toolkit

Extract clinical variant interpretations from VCF using GA4GH VRS IDs
MIT License
2 stars 0 forks source link

research/python3.12-on-terra #47

Open bwalsh opened 7 months ago

bwalsh commented 7 months ago

It would be nice to have "latest-and-greatest" python on terra. A terra VM is essentially a docker container. There are no sudo privileges. (Based on previous attempts, this may not be realistic and we will need to settle for 3.10)

#!/bin/bash

# Set the desired Python version
PYTHON_VERSION="3.12.0"

# Set the installation directory
INSTALL_DIR="$HOME/python$PYTHON_VERSION"

# URL to the Python source code tarball
PYTHON_URL="https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz"

# Download Python source code
wget "$PYTHON_URL" -O Python-$PYTHON_VERSION.tar.xz

# Extract the tarball
tar -xvf Python-$PYTHON_VERSION.tar.xz

# Navigate to the extracted directory
cd Python-$PYTHON_VERSION

# Configure and install Python locally
./configure --prefix="$INSTALL_DIR"
make
make install

# Update PATH
echo 'export PATH=$HOME/python'"$PYTHON_VERSION"'/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

# Display Python version
python3.12 --version

# Clean up - remove the downloaded tarball and extracted directory
cd ..
rm -rf Python-$PYTHON_VERSION
rm Python-$PYTHON_VERSION.tar.xz
quinnwai commented 7 months ago

Copying over some info from @bwalsh:

Use pyenv to set python 3.12 on terra.

# install pyenv
curl https://pyenv.run/ | bash

# setup your path
cat ~/.bashrc
>>> export PYENV_ROOT="$HOME/.pyenv"
>>> [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"

source  ~/.bashrc

# confirm installation ok
pyenv versions

# install 3.12
pyenv install 3.12

# update 3.12 for our project
cd  /home/jupyter/vrs-python-testing
pyenv local 3.12

# re-create vent
rm -r vent

# setup venv …. pip install ….