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 revisionBoth sides next revision
working_with_python [2019/02/20 13:49] – [Working with Python] lenocilworking_with_python [2019/04/23 13:25] jansen
Line 67: Line 67:
   * When globally installed packages are on the python path, and they satisfy the installation requirements, pip does nothing, and reports that requirement is satisfied.   * When globally installed packages are on the python path, and they satisfy the installation requirements, pip does nothing, and reports that requirement is satisfied.
   * pip will not perform a --user install in a virtualenv unless the virtualenv was created specifying ''--system-site-packages''. Nonetheless, pip will never install a package that conflicts with a package in the virtualenv site-packages.   * pip will not perform a --user install in a virtualenv unless the virtualenv was created specifying ''--system-site-packages''. Nonetheless, pip will never install a package that conflicts with a package in the virtualenv site-packages.
 +
 +=== Method 1 - subsection Incompatible versions ===
 +
 +Unfortunately, python's 'user' directory is independent of the operating system version, but most of the compute nodes including the LOFAR cluster, run RedHat Enterprise Linux, which is sufficiently different to cause packages installed on the desktop not to work all the time.
 +
 +In cases like this, it might be necessary to create a separate python user directory structure for those machines:
 +
 +Add to your .bashrc something like this:
 +  if [ ! -f /etc/fedora-release ]; then
 +    export PYTHONUSERBASE=$HOME/.local-rhel7
 +  fi
 +For users of the ''tcsh'' shell, add this to your .cshrc in stead:
 +  if (! -f /etc/fedora-release) then
 +    setenv PYTHONUSERBASE $HOME/.local-rhel7
 +  endif
 +
 +And make sure to create that directory ~/.local-rhel7. Now the pip --user commands on RHEL7 machines will install into that newly created directory in stead of the default one used by the desktop systems.
  
 ==== METHOD 2: virtualenv ==== ==== METHOD 2: virtualenv ====
working_with_python.txt · Last modified: 2023/11/06 13:12 by jansen