|
| 1 | +# Installation |
| 2 | + |
| 3 | +## Installation Videotutorials (as of 5/16/2022) |
| 4 | + |
| 5 | +* [Installing WSL2](https://ub.hosted.panopto.com/Panopto/Pages/Embed.aspx?id=02184b70-7745-4eb4-a776-ae92014c652a&autoplay=false&offerviewer=true&showtitle=true&showbrand=true&captions=false&interactivity=all) |
| 6 | + |
| 7 | +* [Installing WSL2: After reboot](https://ub.hosted.panopto.com/Panopto/Pages/Embed.aspx?id=972aef79-e235-4a90-9ce1-ae92014d34db&autoplay=false&offerviewer=true&showtitle=true&showbrand=true&captions=false&interactivity=all) |
| 8 | + |
| 9 | +* [Installing Ubuntu on Windows 11](https://ub.hosted.panopto.com/Panopto/Pages/Embed.aspx?id=31a63536-f333-4242-9b56-ae92015ece64&autoplay=false&offerviewer=true&showtitle=true&showbrand=true&captions=false&interactivity=all) |
| 10 | + |
| 11 | +* [Creating Conda environment for Libra](https://ub.hosted.panopto.com/Panopto/Pages/Embed.aspx?id=d6ada23e-7e16-4b7a-b290-ae920188627c&autoplay=false&offerviewer=true&showtitle=true&showbrand=true&captions=false&interactivity=all) |
| 12 | + |
| 13 | +* [Installing Libra](https://ub.hosted.panopto.com/Panopto/Pages/Embed.aspx?id=7f8dd8c4-9f58-4ca0-a8cb-ae930166b7ec&autoplay=false&offerviewer=true&showtitle=true&showbrand=true&captions=false&interactivity=all) |
| 14 | + |
| 15 | + |
| 16 | +## Installation (as of after 3/23/2023) |
| 17 | + |
| 18 | +### 1. Install miniconda (for Python 3.9) and activate Conda |
| 19 | + |
| 20 | +#### 1.1 Download and install |
| 21 | + |
| 22 | + mkdir Conda |
| 23 | + cd Conda/ |
| 24 | + wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.12.0-Linux-x86_64.sh . |
| 25 | + sh ./Miniconda3-py39_4.12.0-Linux-x86_64.sh -b -u -p <install_dir> |
| 26 | + |
| 27 | + Here, |
| 28 | + |
| 29 | + * the `-b` option will accept the license agreement and will skip all the prompts |
| 30 | + * the `-u` option will tell the installer to do all the needed updates |
| 31 | + * the `-p` option followed by the installation directory path (will be created), tells |
| 32 | + the installed where to install the package. |
| 33 | + |
| 34 | + Test it is working by doing: |
| 35 | + |
| 36 | + which conda |
| 37 | + |
| 38 | + |
| 39 | +#### 1.2 Update the conda |
| 40 | + |
| 41 | + Actually, let's not do this: |
| 42 | + |
| 43 | + conda update -n base -c defaults conda |
| 44 | + |
| 45 | +#### 1.3 Activate the environment |
| 46 | + |
| 47 | + Add the following line to you `.bashrc` or `.bash_profile` scripts: |
| 48 | + |
| 49 | + eval "$(<path to bin/conda> shell.bash hook)" |
| 50 | + |
| 51 | + For instance, |
| 52 | + |
| 53 | + eval "$(/projects/academic/cyberwksp21/SOFTWARE/Conda/bin/conda shell.bash hook)" |
| 54 | + |
| 55 | + Restart your terminal or reload the `.bashrc` script: |
| 56 | + |
| 57 | + source ~/.bashrc |
| 58 | + |
| 59 | + When you do this, your command line should show up the (base) in front, indicating that |
| 60 | + the base environment is ready |
| 61 | + |
| 62 | + Test it is working by doing: |
| 63 | + |
| 64 | + which conda |
| 65 | + |
| 66 | + |
| 67 | +### 2. Create the environment equipped with all Libra needs |
| 68 | + |
| 69 | +#### 2.1 Create the `libra` environment |
| 70 | + |
| 71 | + In fact, you can call it whatever you like: |
| 72 | + |
| 73 | + conda create -n libra python=3.7 |
| 74 | + |
| 75 | +#### 2.2 Activate this environment |
| 76 | + |
| 77 | + conda activate libra |
| 78 | + |
| 79 | +This is very important step - when activated, all the installs will go into that folder. |
| 80 | + |
| 81 | +**In case you mess up with an environment**, you can remove it with: |
| 82 | + |
| 83 | + conda remove --name libra --all |
| 84 | + |
| 85 | + |
| 86 | +#### 2.3 Now, equip your environment with the required packages |
| 87 | + |
| 88 | +Do this **one by one, and in this order**, (should not matter too much, but who knows...) |
| 89 | + |
| 90 | + > To automate the below procedures, you can use `-y` option to accept prompts (sometimes this will override) |
| 91 | + > previous packages/conflicts, so be careful |
| 92 | + > |
| 93 | + > You can also use `-q` to get rid of all the messages to the output, although i'd keep it to keep track of what's going on |
| 94 | + |
| 95 | + |
| 96 | +First let's install the most general packages: |
| 97 | + |
| 98 | + conda install -y -c conda-forge numpy scipy matplotlib imageio |
| 99 | + |
| 100 | + |
| 101 | +Next, all what we actually need: |
| 102 | + |
| 103 | + conda install -y conda-build make |
| 104 | + conda install -y anaconda::py-boost |
| 105 | + conda install -y -c conda-forge gcc_linux-64=12.2.0 gxx_linux-64=12.2.0 cmake=3.24.2 python-devtools llvm-openmp |
| 106 | + conda install -y -c conda-forge/label/gcc7 eigen mpfr |
| 107 | + conda install -y -c psi4/label/dev libint2=2.7.1 |
| 108 | + conda install -y -c anaconda h5py gmp |
| 109 | + |
| 110 | +Install Jupyter Lab or traditional Jupyter notebook as explainted [here](https://jupyter.org/install): |
| 111 | + |
| 112 | + pip install -U jupyterlab |
| 113 | + |
| 114 | + or |
| 115 | + |
| 116 | + pip install -U notebook |
| 117 | + |
| 118 | + |
| 119 | +Install py3Dmol for viewing molecular structures: |
| 120 | + |
| 121 | + pip install -U py3Dmol |
| 122 | + |
| 123 | + |
| 124 | +Installation instruction of Scikit-learn from its official website: |
| 125 | + |
| 126 | + pip install -U scikit-learn |
| 127 | + |
| 128 | + |
| 129 | + > |
| 130 | + > YES - IT GOT SMALLER AND MORE COMPACT ! |
| 131 | + > |
| 132 | + |
| 133 | +Install PyTorch - since the current versions of Libra have a growing number of |
| 134 | +functions/modules written with PyTorch. The general instructions can be found [here](https://pytorch.org/get-started/locally/) |
| 135 | + |
| 136 | +As a simple (most common case, peraps), we install PyTorch for CPU on Linux with: |
| 137 | + |
| 138 | + pip install -U torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu |
| 139 | + |
| 140 | +or |
| 141 | + |
| 142 | + conda install pytorch cpuonly -c pytorch |
| 143 | + |
| 144 | + |
| 145 | +### 3. Download and build Libra |
| 146 | + |
| 147 | +#### 3.1 Get it from the GitHub and choose the right branch |
| 148 | + |
| 149 | + Clone the repo from the GitHub |
| 150 | + |
| 151 | + git clone https://github.com/Quantum-Dynamics-Hub/libra-code.git libra |
| 152 | + |
| 153 | + and switch to the correct branch or tag - usually, it would be `devel` branch |
| 154 | + |
| 155 | + cd libra |
| 156 | + git checkout devel |
| 157 | + |
| 158 | +#### 3.2 Create the build directory and make the Makefiles |
| 159 | + |
| 160 | + Then in the `libra` directory, create the build directory: |
| 161 | + |
| 162 | + mkdir _build |
| 163 | + cd _build |
| 164 | + cmake ../ |
| 165 | + |
| 166 | +#### 3.3 Compile the package |
| 167 | + |
| 168 | + make -j4 |
| 169 | + |
| 170 | + |
| 171 | +### 4. Make it ready to use |
| 172 | + |
| 173 | + Add the following exports to your `.bash_profile` file |
| 174 | + |
| 175 | + export PYTHONPATH=<path to the ppackage>/libra/_build/src:$PYTHONPATH |
| 176 | + |
| 177 | + |
| 178 | + Restart the terminal or source the bash profile and activate libra conda environment |
| 179 | + |
| 180 | + source .bash_profile |
| 181 | + conda activate libra |
| 182 | + |
| 183 | + And you should be ready to use Libra. |
| 184 | + |
| 185 | + |
| 186 | +## Useful notes: |
| 187 | + |
| 188 | +### 1. 2/15/2025 (from Liz Stippell): |
| 189 | + |
| 190 | +Notes on making Libra if you have python v3.7+ installed anywhere on your system (Linux): |
| 191 | +Although the libra environment is made with python 3.7, during the `cmake ../` step it will search for any python, |
| 192 | +including versions outside of the libra environment. (Ex: my system kept finding python v3.9 in my |
| 193 | +Miniconda here: `/path/to/Conda/Miniconda3/include/python3.9` instead of searching within the libra |
| 194 | +environment: `/path/to/Conda/Miniconda3/envs/libra` ) |
| 195 | + |
| 196 | +To avoid this issue, you can add the following lines in the CMakeLists.txt file in your libra source code directory around line 44: |
| 197 | + |
| 198 | +""" |
| 199 | +set(Python3_ROOT_DIR "/path/to/Conda/Miniconda3/envs/libra") |
| 200 | +set(Python3_EXECUTABLE "/path/to/Conda/Miniconda3/envs/libra/bin/python3") |
| 201 | +set(Python3_LIBRARY "/path/to/Conda/Miniconda3/envs/libra/lib/libpython3.7m.so") |
| 202 | +set(Python3_INCLUDE_DIR "/path/to/Conda/Miniconda3/envs/libra/include/python3.7m") |
| 203 | +FIND_PACKAGE(Python3 3.6 REQUIRED COMPONENTS Development) |
| 204 | +""" |
| 205 | + |
| 206 | +This will force the make to search within the libra environment in the specified locations where you know the files exist. |
| 207 | + |
| 208 | + |
| 209 | +### 2. 4/17/2025 (Alexey Akimov) |
| 210 | + |
| 211 | +A good way to setup the conda environment to have Boost and Python version consistent is this: |
| 212 | + |
| 213 | + |
| 214 | + conda install -c conda-forge boost=1.82 python=3.10 |
| 215 | + |
| 216 | + |
| 217 | +### 3. 4/17/2025 (Alexey Akimov) |
| 218 | + |
| 219 | +Another useful recipe for setting up jupyter notebook specific to a selected Conda environment: |
| 220 | + |
| 221 | +Step 1: Activate the environment |
| 222 | + |
| 223 | + conda activate libra |
| 224 | + |
| 225 | + |
| 226 | +Step 2: Install ipykernel and register the kernel |
| 227 | + |
| 228 | + |
| 229 | + conda install ipykernel |
| 230 | + python -m ipykernel install --user --name=libra --display-name "Python (libra)" |
| 231 | + |
| 232 | + |
| 233 | +Now, in Jupyter, you'll see a new kernel called "Python (libra)". Select that in your notebook. |
| 234 | + |
| 235 | +### 4. 7/31/2025 (from Daeho Han) |
| 236 | + |
| 237 | +Here are some installation instructions from **Daeho Han** that may be used as a good summary of the above content: |
| 238 | + |
| 239 | + conda create -n libra |
| 240 | + conda install -c conda-forge boost=1.82 python=3.10 |
| 241 | + conda install -y -c conda-forge numpy scipy matplotlib imageio |
| 242 | + |
| 243 | + conda install -y conda-build make |
| 244 | + conda install -y -c conda-forge gcc_linux-64=12.2.0 gxx_linux-64=12.2.0 cmake=3.24.2 python-devtools llvm-openmp |
| 245 | + conda install -y -c conda-forge/label/gcc7 eigen mpfr |
| 246 | + conda install -y -c psi4/label/dev libint2=2.7.1 |
| 247 | + conda install -y -c anaconda h5py gmp |
| 248 | + |
| 249 | + pip install -U jupyterlab |
| 250 | + pip install -U py3Dmol |
| 251 | + pip install -U scikit-learn |
| 252 | + pip install -U torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu |
0 commit comments