Development/Python: Difference between revisions
No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
Python is available on all systems. Either as system Python, which comes bundled with the operating system, or via Lmod software modules. Installation is not required. |
Python is available on all systems. Either as system Python, which comes bundled with the operating system, or via Lmod software modules. Installation is not required. |
||
== |
== System Python == |
||
=== System Python === |
|||
System Python is available in different versions, typically the default system Python is too old for most users and applications. Newer versions are therefore installed alongside the standard version. You can access a specific Python version by specifying the version in the Python command. E.g. on bwUniCluster, different versions are currently available (2.7.18, 3.6.8, 3.8.16, 3.9.16, 3.11.2). Please note, that these exact versions will change over time and differ from site to site! |
System Python is available in different versions, typically the default system Python is too old for most users and applications. Newer versions are therefore installed alongside the standard version. You can access a specific Python version by specifying the version in the Python command. E.g. on bwUniCluster, different versions are currently available (2.7.18, 3.6.8, 3.8.16, 3.9.16, 3.11.2). Please note, that these exact versions will change over time and differ from site to site! |
||
Line 17: | Line 15: | ||
</source> |
</source> |
||
== Python Modules == |
|||
Python versions which are offered via software modules can be identified via: |
Python versions which are offered via software modules can be identified via: |
||
<source lang="bash"> |
<source lang="bash"> |
||
Line 30: | Line 28: | ||
</source> |
</source> |
||
== Python Distributions == |
|||
For the usage of Python we strongly recommend <b>not to install</b> own Python versions, e.g. via distributions like Anaconda. However, there are use cases where the use of e.g. conda is beneficial or, depending on the scientific community, a standard approach to distribute Python packages. For the use of conda on bwHPC clusters, please refer to [[ Conda ]]. |
For the usage of Python we strongly recommend <b>not to install</b> own Python versions, e.g. via distributions like Anaconda. However, there are use cases where the use of e.g. conda is beneficial or, depending on the scientific community, a standard approach to distribute Python packages. For the use of conda on bwHPC clusters, please refer to [[ Conda ]]. |
||
Revision as of 16:54, 7 November 2024
Introduction
Python is a versatile, easy-to-learn, usually interpreted programming language. It offers a wide range of libraries for scientific tasks and visualization. Python is the de facto standard interface for applications of machine learning. Python can be used in particular as an open source alternative for tasks that have usually been used for Matlab.
Installation and Versions
Python is available on all systems. Either as system Python, which comes bundled with the operating system, or via Lmod software modules. Installation is not required.
System Python
System Python is available in different versions, typically the default system Python is too old for most users and applications. Newer versions are therefore installed alongside the standard version. You can access a specific Python version by specifying the version in the Python command. E.g. on bwUniCluster, different versions are currently available (2.7.18, 3.6.8, 3.8.16, 3.9.16, 3.11.2). Please note, that these exact versions will change over time and differ from site to site!
$ python --version
Python 3.6.8
$ python3.11 --version
Python 3.11.2
Python Modules
Python versions which are offered via software modules can be identified via:
$ module avail devel/python
A specific version of Python can then be chosen e.g. as follows:
$ module load devel/python/3.12.3_gnu_13.3
$ python --version
Python 3.12.3
Python Distributions
For the usage of Python we strongly recommend not to install own Python versions, e.g. via distributions like Anaconda. However, there are use cases where the use of e.g. conda is beneficial or, depending on the scientific community, a standard approach to distribute Python packages. For the use of conda on bwHPC clusters, please refer to Conda .
Usage
Interactively, prompt
Scripting
Via Jupyter
Package Manager
pip
Virtual Environments
Short description
Benefit
Creation
Usage
Best Practice
Always use virtual environments
Do's and don'ts