User Tools

Site Tools


working_with_python

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
working_with_python [2018/08/30 07:49] – [Bypassing the existing python environment] lenocilworking_with_python [2019/02/20 13:49] – [Working with Python] lenocil
Line 1: Line 1:
 ====== Working with Python ====== ====== Working with Python ======
-Python is available on all Sterrewacht and Lorentz Institute GNU/Linux workstations. In most cases, both python 2 (currently 2.7) and python 3 (currently 3.6) are available.+Python is available on all Sterrewacht and Lorentz Institute GNU/Linux workstations. In most cases, both python 2 (currently 2.7) and python 3 (currently 3.7) are available.
  
 Notes from a [[https://www.strw.leidenuniv.nl/python/| python introduction course]] are available on the observatory web site.  Notes from a [[https://www.strw.leidenuniv.nl/python/| python introduction course]] are available on the observatory web site. 
Line 252: Line 252:
 ====== Bypassing the existing python environment ====== ====== Bypassing the existing python environment ======
 Occasionally, something in the systemwide directories (e.g ''/software/local/lib64/python2.7/site-packages'') interferes with your python application. Perhaps you have a code that requires a specific, older, version of numpy or matplotlib. Just installing that version is not always sufficient. The trick is, to set the PYTHONPATH to point first to a directory where you place a private ''sitecustomize.py'' which then overrides the one we have placed in /usr/lib64/python2.7/site-packages (which is where we add the /software directories to the path for everyone). Here is how: Occasionally, something in the systemwide directories (e.g ''/software/local/lib64/python2.7/site-packages'') interferes with your python application. Perhaps you have a code that requires a specific, older, version of numpy or matplotlib. Just installing that version is not always sufficient. The trick is, to set the PYTHONPATH to point first to a directory where you place a private ''sitecustomize.py'' which then overrides the one we have placed in /usr/lib64/python2.7/site-packages (which is where we add the /software directories to the path for everyone). Here is how:
-<code sh>+<code bash>
   mkdir /some/location/python_custom_dir   mkdir /some/location/python_custom_dir
   setenv PYTHONPATH /some/location/python_custom_dir:/usr/lib64/python2.7/site-packages   setenv PYTHONPATH /some/location/python_custom_dir:/usr/lib64/python2.7/site-packages
working_with_python.txt · Last modified: 2024/04/22 10:51 by jansen