Strumenti Utente

Strumenti Sito


calcoloscientifico:userguide:python

Differenze

Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.

Link a questa pagina di confronto

Entrambe le parti precedenti la revisioneRevisione precedente
Prossima revisione
Revisione precedente
calcoloscientifico:userguide:python [27/08/2025 17:41] fabio.spatarocalcoloscientifico:userguide:python [10/07/2026 15:39] (versione attuale) – [Python 3.11.13 virtualenv] federico.prost
Linea 10: Linea 10:
   - python/3.9.10   - python/3.9.10
   - python/3.11.5   - python/3.11.5
 +  - python/3.11.13
  
-==== Python virtualenv ====+===== Python virtualenv =====
  
 [[https://virtualenv.pypa.io/en/stable|Virtualenv]] is a tool to create isolated Python environments. [[https://virtualenv.pypa.io/en/stable|Virtualenv]] is a tool to create isolated Python environments.
  
-=== Python 2.7.14 virtualenv ===+==== Python 2.7.14 virtualenv ====
  
-Create a virtual environment for "machine-learning":+Create a virtual environment for ''machine-learning'':
  
 <code> <code>
Linea 31: Linea 32:
 </code> </code>
  
-Activate "machine-learningvirtual environment:+Activate ''machine-learning'' virtual environment:
  
 <code> <code>
Linea 37: Linea 38:
 </code> </code>
  
-Install packages in "machine-learningvirtual environment:+Install packages in ''machine-learning'' virtual environment:
  
 <code> <code>
Linea 43: Linea 44:
 </code> </code>
  
-Deactivate "machine-learningvirtual environment:+Deactivate ''machine-learning'' virtual environment:
  
 <code> <code>
Linea 49: Linea 50:
 </code> </code>
  
-=== Python 3.6.3 virtualenv ===+==== Python 3.6.3 virtualenv ====
  
 Available virtual environments for Python 3.6.3: Available virtual environments for Python 3.6.3:
Linea 56: Linea 57:
   * tensorflow-gpu   * tensorflow-gpu
  
-== Site installation ==+=== Site installation ===
  
-Activate "opencvvirtual environment:+Activate ''opencv'' virtual environment:
  
 <code> <code>
Linea 69: Linea 70:
 ---- ----
  
-Activate "tensorflowvirtual environment:+Activate ''tensorflow'' virtual environment:
  
 <code> <code>
Linea 80: Linea 81:
 ---- ----
  
-Activate "tensorflow-gpuvirtual environment:+Activate ''tensorflow-gpu'' virtual environment:
  
 <code> <code>
Linea 99: Linea 100:
 </code> </code>
  
-== User installation ==+=== User installation ===
  
-Create "opencvvirtual environment (just once):+Create ''opencv'' virtual environment (just once):
  
 <code> <code>
Linea 110: Linea 111:
 </code> </code>
  
-Update "opencvvirtual environment (every time you want to update):+Update ''opencv'' virtual environment (every time you want to update):
  
 <code> <code>
Linea 119: Linea 120:
 </code> </code>
  
-Activate "opencvvirtual environment:+Activate ''opencv'' virtual environment:
  
 <code> <code>
Linea 130: Linea 131:
 ---- ----
  
-Create "tensorflowvirtual environment (just once):+Create ''tensorflow'' virtual environment (just once):
  
 <code> <code>
Linea 139: Linea 140:
 </code> </code>
  
-Update "tensorflowvirtual environment (every time you want to update):+Update ''tensorflow'' virtual environment (every time you want to update):
  
 <code> <code>
Linea 148: Linea 149:
 </code> </code>
  
-Activate "tensorflowvirtual environment:+Activate ''tensorflow'' virtual environment:
  
 <code> <code>
Linea 159: Linea 160:
 ---- ----
  
-Create "tensorflow-gpuvirtual environment (just once):+Create ''tensorflow-gpu'' virtual environment (just once):
  
 <code> <code>
Linea 168: Linea 169:
 </code> </code>
  
-Update "tensorflow-gpuvirtual environment (every time you want to update):+Update ''tensorflow-gpu'' virtual environment (every time you want to update):
  
 <code> <code>
Linea 177: Linea 178:
 </code> </code>
  
-Activate "tensorflow-gpuvirtual environment:+Activate ''tensorflow-gpu'' virtual environment:
  
 <code> <code>
Linea 196: Linea 197:
 </code> </code>
  
-=== Python 3.6.8 virtualenv ===+==== Python 3.6.8 virtualenv ====
  
-== User installation == +=== User installation ===
- +
-Create ''myvenv_with_jupyter'' virtual environment (just once): +
- +
-<code> +
-mkdir -p "$HOME/local/tools/python/3.6.8/virtualenv/myvenv_with_jupyter" +
-python3 -m venv "$HOME/local/tools/python/3.6.8/virtualenv/myvenv_with_jupyter" +
-. "$HOME/local/tools/python/3.6.8/virtualenv/myvenv_with_jupyter/bin/activate" +
-python3 -m pip install --upgrade pip +
-python3 -m pip install --upgrade jupyter notebook ipyparallel +
-#python3 -m pip install --upgrade other_packages_for_my_project +
-deactivate +
-</code> +
- +
-Update ''myvenv_with_jupyter'' virtual environment (every time you want to update): +
- +
-<code> +
-. "$HOME/local/tools/python/3.6.8/virtualenv/myvenv_with_jupyter/bin/activate" +
-python3 -m pip install --upgrade pip +
-python3 -m pip install --upgrade jupyter notebook ipyparallel +
-#python3 -m pip install --upgrade other_packages_for_my_project +
-deactivate +
-</code>+
  
 Require a node with ''srun'': Require a node with ''srun'':
Linea 238: Linea 217:
 </code> </code>
  
-Activate "myvenv_with_jupyter" virtual environment:+Create ''my_venv_with_jupyter'' virtual environment (just once):
  
 <code> <code>
-. "$HOME/local/tools/python/3.6.8/virtualenv/myvenv_with_jupyter/bin/activate"+mkdir -p "$HOME/local/tools/python/3.6.8/virtualenv/my_venv_with_jupyter" 
 +python3 -m venv "$HOME/local/tools/python/3.6.8/virtualenv/my_venv_with_jupyter" 
 +source "$HOME/local/tools/python/3.6.8/virtualenv/my_venv_with_jupyter/bin/activate" 
 +python3 -m pip install --upgrade pip 
 +python3 -m pip install --upgrade jupyter notebook ipyparallel 
 +#python3 -m pip install --upgrade other_packages_for_my_project 
 +deactivate
 </code> </code>
  
-Start the Jupyter Notebook Server:+Update ''my_venv_with_jupyter'' virtual environment (every time you want to update): 
 + 
 +<code> 
 +source "$HOME/local/tools/python/3.6.8/virtualenv/my_venv_with_jupyter/bin/activate" 
 +python3 -m pip install --upgrade pip 
 +python3 -m pip install --upgrade jupyter notebook ipyparallel 
 +#python3 -m pip install --upgrade other_packages_for_my_project 
 +deactivate 
 +</code> 
 + 
 +Activate ''my_venv_with_jupyter'' virtual environment: 
 + 
 +<code> 
 +source "$HOME/local/tools/python/3.6.8/virtualenv/my_venv_with_jupyter/bin/activate" 
 +</code> 
 + 
 +Start the ''Jupyter Notebook Server'':
  
 <code> <code>
Linea 255: Linea 256:
 Open another shell and run the following command: Open another shell and run the following command:
  
-ssh -N -L 127.0.0.1:*****:wn92.hpc.unipr.it:***** ***.***@login.hpc.unipr.it+ssh -N -L 127.0.0.1:*****:wn**.hpc.unipr.it:***** ***.***@login.hpc.unipr.it
  
 To access the notebook, open in a browser the URL which starts with To access the notebook, open in a browser the URL which starts with
Linea 261: Linea 262:
 </code> </code>
  
-Stop the Jupyter Notebook Server:+Stop the ''Jupyter Notebook Server'':
  
 Press ''CTRL'' + ''C''. Press ''CTRL'' + ''C''.
Linea 270: Linea 271:
 deactivate deactivate
 </code> </code>
 +
 +==== Python 3.11.13 virtualenv ====
 +
 +=== User installation ===
 +
 +Require a node with ''srun'':
 +
 +<code>
 +srun \
 +    --job-name=srun \
 +    --nodes=1 \
 +    --ntasks-per-node=1 \
 +    --cpus-per-task=1 \
 +    --time=0-01:00:00 \
 +    --mem=5G \
 +    --partition=cpu \
 +    --qos=cpu \
 +    --pty \
 +    bash
 +</code>
 +
 +Create ''my_venv'' virtual environment (just once):
 +
 +<code>
 +module load gnu8/8.3.0 python/3.11.13
 +mkdir -p "$HOME/local/tools/python/3.11.13/virtualenv/my_venv"
 +python -m venv "$HOME/local/tools/python/3.11.13/virtualenv/my_venv"
 +source "$HOME/local/tools/python/3.11.13/virtualenv/my_venv/bin/activate"
 +python -m pip install --upgrade pip
 +deactivate
 +</code>
 +
  
calcoloscientifico/userguide/python.1756309260.txt.gz · Ultima modifica: da fabio.spataro

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki