Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
hpc-compendium
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ZIH
hpcsupport
hpc-compendium
Commits
af972700
Commit
af972700
authored
1 year ago
by
Martin Schroschk
Browse files
Options
Downloads
Patches
Plain Diff
Fix paths to workspace
parent
313ef99d
No related branches found
No related tags found
2 merge requests
!938
Automated merge from preview to main
,
!936
Update to Five-Cluster-Operation
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc.zih.tu-dresden.de/docs/software/python_virtual_environments.md
+12
-12
12 additions, 12 deletions
...u-dresden.de/docs/software/python_virtual_environments.md
with
12 additions
and
12 deletions
doc.zih.tu-dresden.de/docs/software/python_virtual_environments.md
+
12
−
12
View file @
af972700
...
...
@@ -50,11 +50,11 @@ Then create the virtual environment and activate it.
```
console
marie@compute$
ws_allocate python_virtual_environment 1
Info: creating workspace.
/horse/ws/marie-python_virtual_environment
/data
/horse/ws/marie-python_virtual_environment
[...]
marie@compute$
virtualenv
--system-site-packages
/horse/ws/marie-python_virtual_environment/env
#Create virtual environment
marie@compute$
virtualenv
--system-site-packages
/data
/horse/ws/marie-python_virtual_environment/env
#Create virtual environment
[...]
marie@compute$
source
/horse/ws/marie-python_virtual_environment/env/bin/activate
#Activate virtual environment. Example output: (env) bash-4.2$
marie@compute$
source
/data
/horse/ws/marie-python_virtual_environment/env/bin/activate
#Activate virtual environment. Example output: (env) bash-4.2$
```
Now you can work in this isolated environment, without interfering with other
...
...
@@ -73,7 +73,7 @@ the environment as follows:
```console
marie@login.alpha$ srun --nodes=1 --gres=gpu:1 --time=01:00:00 --pty bash
marie@alpha$ ws_allocate my_python_virtualenv 100 # use a workspace for the environment
marie@alpha$ cd /horse/ws/marie-my_python_virtualenv
marie@alpha$ cd
/data
/horse/ws/marie-my_python_virtualenv
marie@alpha$ module load modenv/hiera GCC/10.2.0 CUDA/11.1.1 OpenMPI/4.0.5 PyTorch/1.9.0
Module GCC/10.2.0, CUDA/11.1.1, OpenMPI/4.0.5, PyTorch/1.9.0 and 54 dependencies loaded.
marie@alpha$ which python
...
...
@@ -113,9 +113,9 @@ packages from the file:
```
console
marie@compute$
module load Python
#Load default Python
[...]
marie@compute$
virtualenv
--system-site-packages
/horse/ws/marie-python_virtual_environment/env_post
#Create virtual environment
marie@compute$
virtualenv
--system-site-packages
/data
/horse/ws/marie-python_virtual_environment/env_post
#Create virtual environment
[...]
marie@compute$
source
/horse/ws/marie-python_virtual_environment/env/bin/activate
#Activate virtual environment. Example output: (env_post) bash-4.2$
marie@compute$
source
/data
/horse/ws/marie-python_virtual_environment/env/bin/activate
#Activate virtual environment. Example output: (env_post) bash-4.2$
(env_post) marie@compute$
pip
install
-r
requirements.txt
#Install packages from the created requirements.txt file
```
...
...
@@ -147,7 +147,7 @@ directory for the conda virtual environment:
```
console
marie@compute$
ws_allocate conda_virtual_environment 1
Info: creating workspace.
/horse/ws/marie-conda_virtual_environment
/data
/horse/ws/marie-conda_virtual_environment
[...]
```
...
...
@@ -156,8 +156,8 @@ environment:
```
console
marie@compute$
module load Anaconda3
#load Anaconda module
marie@compute$
conda create
--prefix
/horse/ws/marie-conda_virtual_environment/conda-env
python
=
3.6
#create virtual environment with Python version 3.6
marie@compute$
conda activate /horse/ws/marie-conda_virtual_environment/conda-env
#activate conda-env virtual environment
marie@compute$
conda create
--prefix
/data
/horse/ws/marie-conda_virtual_environment/conda-env
python
=
3.6
#create virtual environment with Python version 3.6
marie@compute$
conda activate
/data
/horse/ws/marie-conda_virtual_environment/conda-env
#activate conda-env virtual environment
```
Now you can work in this isolated environment, without interfering with other
...
...
@@ -185,7 +185,7 @@ can deactivate the conda environment as follows:
```console
marie@login.alpha$ srun --nodes=1 --gres=gpu:1 --time=01:00:00 --pty bash
marie@alpha$ ws_allocate my_conda_virtualenv 100 # use a workspace for the environment
marie@alpha$ cd /horse/ws/marie-my_conda_virtualenv
marie@alpha$ cd
/data
/horse/ws/marie-my_conda_virtualenv
marie@alpha$ module load Anaconda3
Module Anaconda3/2021.11 loaded.
marie@alpha$ conda create --prefix my-torch-env python=3.8
...
...
@@ -250,8 +250,8 @@ Recreate the conda virtual environment with the packages from the created
`environment.yml`
file:
```
console
marie@compute$
mkdir
/horse/ws/marie-conda_virtual_environment/conda-env
#Create directory for environment
marie@compute$
mkdir
/data
/horse/ws/marie-conda_virtual_environment/conda-env
#Create directory for environment
marie@compute$
module load Anaconda3
#Load Anaconda
marie@compute$
conda config
--set
channel_priority strict
marie@compute$
conda
env
create
--prefix
/horse/ws/marie-conda_virtual_environment/conda-env
--file
environment.yml
#Create conda env in directory with packages from environment.yml file
marie@compute$
conda
env
create
--prefix
/data
/horse/ws/marie-conda_virtual_environment/conda-env
--file
environment.yml
#Create conda env in directory with packages from environment.yml file
```
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment