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 [2020/10/05 10:31] – [Example: how to let python search arbitrary library paths] lenocilworking_with_python [2020/10/06 06:55] – [METHOD 1: pip with the `--user' option] jansen
Line 81: Line 81:
     export PYTHONUSERBASE=$HOME/.local-rhel7     export PYTHONUSERBASE=$HOME/.local-rhel7
   fi   fi
-For users of the ''tcsh'' shell, add this to your .cshrc in stead:+For users of the ''tcsh'' shell, add this to your .tcshrc in stead:
   if (! -f /etc/fedora-release) then   if (! -f /etc/fedora-release) then
     setenv PYTHONUSERBASE $HOME/.local-rhel7     setenv PYTHONUSERBASE $HOME/.local-rhel7
Line 168: Line 168:
 All ''.pth'' files will be sourced by python provided they are in the right location. All ''.pth'' files will be sourced by python provided they are in the right location.
  
-===== Example: how to create python environment module  =====+===== Example: how to create your own python environment module  =====
  
-First enable the module package to search also private module directories +Please read [[easybuild_environment|here]].
-<code bash> +
-module load use.own +
-</code>+
  
-the line above will create a $HOME/privatemodules if it does not exist and its path will be searched for the presence of environment modules files. 
- 
-Let us  now install some packages to an arbitrary location and upgrade (__only in $PYTHONUSERBASE__) an already system-wide installed package  
- 
-<code bash> 
-export PYTHONUSERBASE=/somewhere/I/can/write/to 
-pip install --user SomePackage 
-pip install -I --user SomePackageThatWASInstalledSystemwide 
-</code> 
- 
-Create a file, say `$HOME/privatemodules/super-module' with the following contents 
-<code bash> 
-#%Module 1.0 
-# 
-#   
- 
-prepend-path  PATH          /somewhere/I/can/write/to/bin # if executables were installed 
-prepend-path  PYTHONPATH    /somewhere/I/can/write/to/lib/python2.7/site-packages 
-</code> 
- 
-and type  
- 
-<code bash> 
-module load super-module 
-</code> 
-and you are ready to use your newly created python environment. Note that is similar procedure can be repeated using python3. 
 ===== Example: numpy with openBLAS ===== ===== Example: numpy with openBLAS =====
 In this example we create a python2 virtual environment in which we will install the latest version of numpy that will use the openBLAS library.  In this example we create a python2 virtual environment in which we will install the latest version of numpy that will use the openBLAS library. 
working_with_python.txt · Last modified: 2024/04/22 10:51 by jansen