-
Notifications
You must be signed in to change notification settings - Fork 1
Tutorial 10
This guide will help you set up a Python Virtual Environment (PVE) on both:
- ๐ป Your Mac
- โ๏ธ The POWER cluster
By the end, you'll have an isolated and clean Python environment running smoothly on both machines. ๐ฏ
First, open your Terminal and install Homebrew, a package manager that makes software installation easy:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"๐ You'll be prompted to add some lines to your shell's PATH. Follow the on-screen instructions.
This will be useful later, especially for scientific Python packages:
brew install gccMicromamba is a fast and lightweight package and environment manager. Install it via Homebrew:
brew install micromambaOnce installed, you'll again be prompted to add Micromamba to your shell:
/opt/homebrew/opt/micromamba/bin/micromamba shell init -s zsh -p ~/micromambaTo simplify usage, alias mamba to micromamba:
-
Open your zprofile file:
vim ~/.zprofile -
Add this line to the bottom:
alias mamba="micromamba"
๐ก Now you can use mamba commands on both your Mac and the POWER cluster with the same syntax!
Letโs configure your virtual environment on the POWER cluster. ๐ช
Add this line to the end of your .bashrc file:
module load mamba > /dev/nullThen apply the change:
source ~/.bashrcโ Youโre now ready to create environments with Mamba on POWER!
Run the following command (replace <youraccountname> with your username):
mamba create --prefix /leeburton-data/<youraccountname>/envs/my_env python=3.8๐ฏ Itโs important to use Python 3.8 โ later tools like USPEX depend on it.
mamba activate /bmd/<youraccountname>/envs/my_envYou'll now see the environment name in your terminal prompt. ๐ข
Inside the environment, install these useful Python modules:
mamba install spglib
mamba install ase
mamba install numpy
mamba install scipyEach module plays a role in atomic simulations and numerical operations.
When you're done:
mamba deactivate๐ You can reactivate the same environment anytime using the mamba activate command again.
You now have working Python virtual environments on both your Mac ๐ and the POWER cluster โ๏ธ. Enjoy clean and reproducible scientific computing!
โก๏ธ Move on to Tutorial 11 for the next step in your journey! ๐