Difference between revisions of "Python"
Moskalenko (talk | contribs) |
Moskalenko (talk | contribs) |
||
Line 19: | Line 19: | ||
{{App_Description|app={{#var:app}}|url={{#var:url}}|name={{#var:app}}}}|}} | {{App_Description|app={{#var:app}}|url={{#var:url}}|name={{#var:app}}}}|}} | ||
− | Python is a programming language that lets you work more quickly and integrate your systems more effectively. You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs. Python version 3 is the current implementation of Python while python2 is a legacy version | + | Python is a programming language that lets you work more quickly and integrate your systems more effectively. You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs. Python version 3 is the current implementation of Python while python2 is a legacy version no longer supported after 2020-01-01. |
− | == | + | |
− | The <code> | + | ==Python vs Python-Core== |
+ | The <code>python</code> environment module provides a full-featured python installation with around 300 installed python modules for development and use of python applications for research. If you only need the core python build to provide a scripting interface for the application you are building see the <code>[[Python-core|python-core]]</code> environment module. | ||
<!--Modules--> | <!--Modules--> | ||
==Required Modules== | ==Required Modules== | ||
Line 35: | Line 36: | ||
<!--Additional--> | <!--Additional--> | ||
{{#if: {{#var: exe}}|==Additional Information== | {{#if: {{#var: exe}}|==Additional Information== | ||
− | * After the appropriate environment module is loaded - type " | + | * After the appropriate environment module is loaded - type "python" at the command line to open an interactive session. |
− | * To run a | + | * To run a python script type <code>python scriptname.py</code>. If the correct "shebang" line is used at the top of the script E.g. |
− | #!/usr/bin/env | + | #!/usr/bin/env python |
− | then the script can be run directly as <code>scriptname.py</code> if it's in the executable path or as <code>./scriptname.py</code> if it's in the current directory. The same rules apply to using a | + | then the script can be run directly as <code>scriptname.py</code> if it's in the executable path or as <code>./scriptname.py</code> if it's in the current directory. The same rules apply to using a python script in a batch job script. |
You can request installation of additional modules by {{Fileabug}}. | You can request installation of additional modules by {{Fileabug}}. | ||
Line 53: | Line 54: | ||
}} | }} | ||
==Available modules== | ==Available modules== | ||
− | To see all installed modules names load the environment module and run <code>pip3 list</code> or <code> | + | To see all installed modules names load the environment module and run <code>pip3 list</code> or <code>python -c "help('modules')"</code> command before submitting a request for a new module installation. Below is a list of modules and versions installed in the default python version. |
{{:Python_Modules}} | {{:Python_Modules}} | ||
{{#if: {{#var: conf}}|==Configuration== | {{#if: {{#var: conf}}|==Configuration== |
Revision as of 15:53, 6 April 2020
Description
Python is a programming language that lets you work more quickly and integrate your systems more effectively. You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs. Python version 3 is the current implementation of Python while python2 is a legacy version no longer supported after 2020-01-01.
Python vs Python-Core
The python
environment module provides a full-featured python installation with around 300 installed python modules for development and use of python applications for research. If you only need the core python build to provide a scripting interface for the application you are building see the python-core
environment module.
Required Modules
Serial
- python
System Variables
- HPC_PYTHON_DIR - installation directory
- HPC_PYTHON_BIN - executable directory
- HPC_PYTHON_LIB - library directory
and modifies PYTHONPATH and PYTHONHOME, so you could use them in your scripts.
Additional Information
- After the appropriate environment module is loaded - type "python" at the command line to open an interactive session.
- To run a python script type
python scriptname.py
. If the correct "shebang" line is used at the top of the script E.g.
#!/usr/bin/env python
then the script can be run directly as scriptname.py
if it's in the executable path or as ./scriptname.py
if it's in the current directory. The same rules apply to using a python script in a batch job script.
You can request installation of additional modules by submitting a request ticket in the Support System. The support request tickets can be used for requesting software installation, finding a solution to a particular problem, or just asking a question.
- Matplotlib backend note
If you are trying to use matplotlib and get an error similar to
import _tkinter # If this fails your Python may not be configured for Tk ImportError: No module named _tkinter
then you should try the following:
import matplotlib matplotlib.use('Agg')
before importing pyplot from matplotlib.
Available modules
To see all installed modules names load the environment module and run pip3 list
or python -c "help('modules')"
command before submitting a request for a new module installation. Below is a list of modules and versions installed in the default python version.
Automatically generated list of python modules installed with the Python Package Manager (pip) under the default python version.
File PYTHON_MODULES is missing.
Name | Version |
---|