# User practices: Installation and use of python packages on UPPMAX ## Using [python-venv](https://docs.python.org/3.7/library/venv.html) ### Installation 1. Load python version ``` bash $ module load module load python/3.7.2 ``` 2. Create virtual environment in you project folder ``` bash $ python3 -m venv /proj/snicXXXX/venv_name ``` _New folder with the name `venv_name` will be created._ 3. Activate the virtual environment ``` bash $ source /proj/snicXXXX/venv_name/bin/activate ``` 4. Make sure you have the latest pip and setuptools (venv_name) pip install -U pip setuptools ``` 5. Install your packages ``` bash (venv_name) pip install torch==1.4.0 torchvision==0.5.0 OpenNMT-py==1.1.1 sacrebleu ``` ### Running the installed code 1. Make sure you load the same module version as when you installed the packages. ``` bash $ module load module load python/3.7.2` ``` 2. Activate the virtual environment ``` bash $ source /proj/snicXXXX/folder_name/bin/activate ``` 3. Run your code ``` bash (venv_name) run.py ``` ## Using Conda Follow the short [user guide at UPPMAX](https://uppmax.uu.se/support/user-guides/conda-user-guide/) --- - [UPPMAX](https://www.uppmax.uu.se/) ![](https://snic.se/digitalAssets/603/c_603880-l_1-k_image.png =122x38) ![](https://live.webb.uu.se/digitalAssets/207/c_207717-l_3-k_bg-city.png) ###### tags: `UPPMAX`, `SNIC`, `User practices`