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

research/python3.12-on-terra #47

Open
bwalsh opened this issue Mar 10, 2024 · 1 comment
Open

research/python3.12-on-terra #47

bwalsh opened this issue Mar 10, 2024 · 1 comment
Labels
enhancement New feature or request priority

Comments

@bwalsh
Copy link
Member

bwalsh commented Mar 10, 2024

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)

  • Contact terra support
  • This untested script may work
#!/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

@bwalsh bwalsh mentioned this issue Mar 10, 2024
@quinnwai quinnwai self-assigned this Mar 13, 2024
@quinnwai quinnwai added enhancement New feature or request priority labels Mar 13, 2024
@quinnwai
Copy link
Member

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 ….

@quinnwai quinnwai removed their assignment Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority
Projects
None yet
Development

No branches or pull requests

2 participants