Skip to content

Instantly share code, notes, and snippets.

@omarfsosa
Last active February 21, 2022 06:33
Show Gist options
  • Save omarfsosa/5ad5107d45dff8e7e8a7ff4faa85cba9 to your computer and use it in GitHub Desktop.
Save omarfsosa/5ad5107d45dff8e7e8a7ff4faa85cba9 to your computer and use it in GitHub Desktop.
Install Python via Pyenv and Pyenv-Virtualenv on an Ubuntu EC2 (AWS)
#!/bin/bash
pip install matplotlib numpy pandas scipy scikit-learn
pip install jax numpyro
#!/bin/bash
# --- Install Pyenv
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
cd ~/.pyenv && src/configure && make -C src
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile
echo 'eval "$(pyenv init --path)"' >>~/.profile
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
source ~/.profile
source ~/.bashrc
# --- Install Python Build dependencies before installing any python version
sudo apt-get update; yes Y | sudo apt-get install make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
# --- Install a Python version
pyenv install 3.8.12
# --- Install Pyenv VirtualEnv
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
source ~/.bashrc
source ~/.profile
# --- Create DS Environment
pyenv virtualenv 3.8.12 datascience
pyenv global datascience
# --- Reset the shell
exec "$SHELL"
# --- Install python libraries
pip install --upgrade pip
pip install ipython jupyter jupyterlab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment