Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Add the new Python instance to your environment:

    Code Block
    languagebash
    themeConfluence
    export PYTHON_ROOT=${LCLS_ROOT}/package/python/python2.7.13/linux-x86_64 
  2. Add the new Python binaries to the PATH environment variable:

    Code Block
    languagebash
    themeConfluence
    export PATH=${QT_HOME}/bin:${ORACLE_HOME}/bin:${PYTHON_ROOT}/bin:${PATH}
  3. Add the new Python libraries and their dependencies (EPICS 64-bit, Matlab, etc.) to the LD_LIBRARY_PATH environment variable. This is to ensure that the new 64-bit versions of Python modules built against those dependencies will work:

    Code Block
    languagebash
    themeConfluence
    export LD_LIBRARY_PATH=${LCLS_ROOT}/matlab/2016b/extern/lib:${EPICS_BASE_RELEASE}/lib/linux-x86_64: ${EPICS_EXTENSIONS}/lib/linux-x86_64:${EPICS_BASE_TOP}/base-cpp-R4-6-0/lib/linux-x86_64:${PYTHON_ROOT}/lib:${PYTHON_ROOT}/build/Python2.7.13/Lib:${LD_LIBRARY_PATH} 
  4. Clear Set the PYTHONPATH environment variable. This is to ensure that there are no false positives when testing applications, since the current PYTHONPATH may still have access to older versions of Python modules and override the new libraries:

    Code Blockinfo
    languagetitlebash
    themeConfluence
    export PYTHONPATH=
    [Optional] If your application(s) import the "cx_Oracle" module, add/change the following in your environment:
    Note

    The ${EPICS_BASE_TOP}/base-cpp-R4-6-0/pvaPy/lib/python/2.7/linux-x86_64 directory contains EPICS V4 Python modules.
    The /usr/local/lcls/tools/python/toolbox directory contains SLAC-maintained Python modules.

    Code Block
    languagebash
    themeConfluence
    export PATHPYTHONPATH=${ORACLEEPICS_BASE_HOME}/bin:${PATH}
    export LD_LIBRARY_PATH=${ORACLE_HOME}/lib:${LD_LIBRARY_PATH} TOP}/base-cpp-R4-6-0/pvaPy/lib/python/2.7/linux-x86_64:${LCLS_ROOT}/tools/python/toolbox
  5. [Optional] If your application(s) import the "PyQtcx_Oracle" , "PyQwt", or any other Python modules that depend on Qt, add/change the following in module, add the following to your environment:

    Code Block
    languagebash
    themeConfluence
    export QT_HOMEPATH=${ORACLE_HOME}/bin:${PATH}
    export LD_LIBRARY_PATH=${LCLSORACLE_ROOT}/package/Qt/Qt-4.8.6/linux-x86_64
    export PATH=${QT_HOME}/bin:${PATH}
    export LD_LIBRARY_PATH=${QT_HOME}/libHOME}/lib:${LD_LIBRARY_PATH} 

Method 2

If you would like to use the full Python 2.7.13 64-bit environment and all of its dependencies, source the following setup script, which does all of the steps in Method 1, including the optional ones:

Info
titleNote
Be aware of your environment settings before and after testing your Python applications.

...

  1. [Optional] If your application(s) import "PyQt", "PyQwt", or any other Python modules that depend on Qt4 64-bit, add the following to your environment:

    Code Block
    languagebash
    themeConfluence

...

source /usr/local/lcls/tools/script/go_python2.7.13.bash

...

languagebash
themeEmacs
titlego_python2.7.13.bash
linenumberstrue

...

  1. export QT_HOME=${LCLS_ROOT}/package/Qt/Qt-4.8.6/linux-x86_64
    export PATH=${QT_HOME}/bin:${PATH}
    export LD_LIBRARY_PATH=${QT_HOME}/lib:${LD_LIBRARY_PATH} 


    If your application uses Qt5 64-bit, add the following to your environment (needs updated gcc and glibc):

    Code Block
    languagebash
    themeConfluence
    export LD_LIBRARY_PATH=${LCLS_ROOT}/package/gcc/gcc-4.9.4/lib:${LD_LIBRARY_PATH}
    export LD_LIBRARY_PATH=

...

  1. /usr/local/lcls/package/gcc/gcc-4.9.4/lib64:$LD_LIBRARY_PATH

...

  1. 
    

...

  1.  
    export QT_HOME=${LCLS_ROOT}/package/Qt/Qt-

...

  1. 5.

...

  1. 9.

...

  1. 1/linux-x86_64
    

...

  1. export PATH=${QT_HOME}/bin

...

  1. :${PATH}
    export LD_LIBRARY_PATH=${QT_HOME}/

...

  1. lib:${LD_LIBRARY_PATH}

Method 2

If you would like to use the full Python 2.7.13 64-bit environment and all of its dependencies, source the following setup script, which does all of the steps in Method 1, including the optional ones:

Info
titleNote
Be aware of your environment settings before and after testing your Python applications.
Code Block
languagebash
themeConfluence
source /usr/local/lcls/tools/script/go_python2.7.13.bash
Code Block
languagebash
themeEmacs
#!/bin/bash
# Sets the user environment to use Python2.7.13

if [ -d /afs/slac/g/lcls ]; then
    export LCLS_ROOT=/afs/slac/g/lcls
else
    export LCLS_ROOT=/usr/local/lcls
fi

# Set default Java to 64-bit
export JAVA_HOME=${LCLS_ROOT}/package/java/jdk1.8.0_144PATH}
fi

if [ -z `echo "${LD_LIBRARY_PATH}" | grep "${QT_HOME}/lib"` ]; then
    export LD_LIBRARY_PATH=${QT_HOME}/lib:${LD_LIBRARY_PATH}
fi

# Set default Oracle client to 11.2.0.2.0 64-bit for cx_Oracle compatibility
export ORACLE_HOME=${LCLS_ROOT}/package/oracle/product/11.2.0.2.0_x86_64/client_1

if [ -z `echo "${PATH}" | grep "${ORACLE_HOME}/bin"` ]; then
    export PATH=${ORACLE_HOME}/bin:${PATH}
fi

if [ -z `echo "${LD_LIBRARY_PATH}" | grep "${ORACLEJAVA_HOME}/libbin"` ]; then
    export LD_LIBRARY_PATH=${ORACLEJAVA_HOME}/libbin:${LD_LIBRARY_PATH}
fi

#if Set[ default-z Matlab to 2016b 64-bit for matlab_wrapper compatibility
if [ -z `echo "${`echo "${LD_LIBRARY_PATH}" | grep "${LCLSJAVA_ROOTHOME}/matlab/2016b/extern/lib"` ]; then
    export LD_LIBRARY_PATH=${LCLSJAVA_ROOT}/matlab/2016b/externHOME}/lib:${LD_LIBRARY_PATH}
fi

# SetAdd default EPICSQt4 to 64-bit for pycaPyQwt and pspPyQt4 compatibility
if export QT_HOME=${LCLS_ROOT}/package/Qt/Qt-4.8.6/linux-x86_64
if [ -z `echo "${LD_LIBRARY_PATH}" | grep "${EPICSQT_BASE_RELEASEHOME}/lib/linux-x86_64bin"` ]; then
    export LD_LIBRARY_PATH=${EPICSQT_BASE_RELEASEHOME}/lib/linux-x86_64bin:${LD_LIBRARY_PATH}
fi

if [ -z `echo "${LD_LIBRARY_PATH}" | grep "${EPICSQT_EXTENSIONSHOME}/lib/linux-x86_64"` ]; then
     export LD_LIBRARY_PATH=${EPICSQT_EXTENSIONSHOME}/lib/linux-x86_64:${LD_LIBRARY_PATH}
fi

if# Add [Qt5 64-z `echo "${LDbit for PyQwt and PyQt5 compatibility (requires updated gcc and glibc,
# sets default Qt to Qt5)
if [ -z `echo "${LD_LIBRARY_PATH}" | grep "${EPICSLCLS_BASE_TOP}/base-cpp-R4-6-0/lib/linux-x86_64ROOT}/package/gcc/gcc-4.9.4/lib"` ]; then
    export LD_LIBRARY_PATH=${EPICSLCLS_BASE_TOP}/base-cpp-R4-6-0/lib/linux-x86_64ROOT}/package/gcc/gcc-4.9.4/lib:${LD_LIBRARY_PATH}
fi

#if Set[ default-z Python to 2.7.13 64-bit
export PYTHON_ROOT=`echo "${LD_LIBRARY_PATH}" | grep "${LCLS_ROOT}/package/pythongcc/python2gcc-4.79.13/linux-x86_64

if [ -z `echo "${PATH}" | grep "${PYTHON_ROOT}/bin"` ]; then
    export 4/lib64"` ]; then
    export LD_LIBRARY_PATH=${PYTHONLCLS_ROOT}/bin/package/gcc/gcc-4.9.4/lib64:${PATHLD_LIBRARY_PATH}
fi

export QT_HOME=${LCLS_ROOT}/package/Qt/Qt-5.9.1/linux-x86_64
if [ -z `echo "${LD_LIBRARY_PATH}" | grep "${PYTHONQT_ROOTHOME}/libbin"` ]; then
      export LD_LIBRARY_PATH=${PYTHONQT_ROOTHOME}/libbin:${LD_LIBRARY_PATH}
fi

if [ -z `echo "${LD_LIBRARY_PATH}" | grep "${PYTHONQT_ROOTHOME}/build/Python2.7.13/Liblib"` ]; then
    export LD_LIBRARY_PATH=${PYTHON_ROOT}/build/Python2.7.13/Lib:${LD_LIBRARY_PATH}
fi

# Clear existing $PYTHONPATH
export PYTHONPATH=

 

Workarounds

After testing, it may be discovered that certain applications may not run with Python 2.7.13 64-bit due to unresolved/conflicting dependencies (e.g., 32-bit Python modules, Matlab2016b, Qt, etc.) or other reasons. If such dependencies cannot currently be resolved, Python developers may invoke the following environment settings in a wrapper script or similar to launch the application using the older instance of Python instead:

Info
titleNotes

The following instructions assume that you are using the Bash shell, and that ${LCLS_ROOT}=/usr/local/lcls.

The steps below will set your default Python instance to Python 2.7.4 32-bit. Any Python applications that have 64-bit dependencies will no longer work with this environment setup.

 export LD_LIBRARY_PATH=${QT_HOME}/lib:${LD_LIBRARY_PATH}
fi
# Set default Oracle client to 11.2.0.2.0 64-bit for cx_Oracle compatibility
export ORACLE_HOME=${LCLS_ROOT}/package/oracle/product/11.2.0.2.0_x86_64/client_1

if [ -z `echo "${PATH}" | grep "${ORACLE_HOME}/bin"` ]; then
    export PATH=${ORACLE_HOME}/bin:${PATH}
fi

if [ -z `echo "${LD_LIBRARY_PATH}" | grep "${ORACLE_HOME}/lib"` ]; then
    export LD_LIBRARY_PATH=${ORACLE_HOME}/lib:${LD_LIBRARY_PATH}
fi

# Set default Matlab to 2016b 64-bit for matlab_wrapper compatibility
if [ -z `echo "${LD_LIBRARY_PATH}" | grep "${LCLS_ROOT}/matlab/2016b/extern/lib"` ]; then
    export LD_LIBRARY_PATH=${LCLS_ROOT}/matlab/2016b/extern/lib:${LD_LIBRARY_PATH}
fi

# Set default EPICS to 64-bit for pyca and psp compatibility
if [ -z `echo "${LD_LIBRARY_PATH}" | grep "${EPICS_BASE_RELEASE}/lib/linux-x86_64"` ]; then
    export LD_LIBRARY_PATH=${EPICS_BASE_RELEASE}/lib/linux-x86_64:${LD_LIBRARY_PATH}
fi

if [ -z `echo "${LD_LIBRARY_PATH}" | grep "${EPICS_EXTENSIONS}/lib/linux-x86_64"` ]; then
    export LD_LIBRARY_PATH=${EPICS_EXTENSIONS}/lib/linux-x86_64:${LD_LIBRARY_PATH}
fi

if [ -z `echo "${LD_LIBRARY_PATH}" | grep "${EPICS_BASE_TOP}/base-cpp-R4-6-0/lib/linux-x86_64"` ]; then
    export LD_LIBRARY_PATH=${EPICS_BASE_TOP}/base-cpp-R4-6-0/lib/linux-x86_64:${LD_LIBRARY_PATH}
fi

# Set default Python to 2.7.13 64-bit
export PYTHON_ROOT=${LCLS_ROOT}/package/python/python2.7.13/linux-x86_64

if [ -z `echo "${PATH}" | grep "${PYTHON_ROOT}/bin"` ]; then
    export PATH=${PYTHON_ROOT}/bin:${PATH}
fi

if [ -z `echo "${LD_LIBRARY_PATH}" | grep "${PYTHON_ROOT}/lib"` ]; then
    export LD_LIBRARY_PATH=${PYTHON_ROOT}/lib:${LD_LIBRARY_PATH}
fi
if [ -z `echo "${LD_LIBRARY_PATH}" | grep "${PYTHON_ROOT}/build/Python2.7.13/Lib"` ]; then
    export LD_LIBRARY_PATH=${PYTHON_ROOT}/build/Python2.7.13/Lib:${LD_LIBRARY_PATH}
fi

# Update PYTHONPATH for EPICS V4 64-bit and SLAC-maintained module dependencies
export PYTHONPATH=${EPICS_BASE_TOP}/base-cpp-R4-6-0/pvaPy/lib/python/2.7/linux-x86_64:${LCLS_ROOT}/tools/python/toolbox


Workarounds

After testing, it may be discovered that certain applications may not run with Python 2.7.13 64-bit due to unresolved/conflicting dependencies (e.g., Python modules only available for 32-bit Python, Matlab2016b, Qt, etc.) or other reasons. If such dependencies cannot currently be resolved, Python developers may invoke the following environment settings in a wrapper script or similar to launch the application using the older instance of Python instead:

Info
titleNotes

The following instructions assume that you are using the Bash shell, and that ${LCLS_ROOT}=/usr/local/lcls.

The steps below will set your default Python instance to Python 2.7.4 32-bit. Any Python applications that have 64-bit dependencies will no longer work with this environment setup.

  1. Add the previous Python instance (Python 2.7.4 32-bit) to your environment:

    Code Block
    languagebash
    themeConfluence
    export PYTHON_ROOT=${LCLS_ROOT}/package/python/python2.7.4
  2. Add the previous Python binaries to your environment:

    Code Block
    languagebash
    themeConfluence
    export PATH=${PYTHON_ROOT}/bin:${PATH} 
  3. Add the 32-bit Python libraries and their dependencies Add the previous Python instance (Python 2.7.4 32-bit) to your environment:

    Code Block
    languagebash
    themeConfluence
    export PYTHONLD_LIBRARY_ROOTPATH=${LCLSPYTHON_ROOT}/package/python/python2.7.4

    Add the previous Python binaries to your environment:

    Code Block
    languagebash
    themeConfluence
    export lib:${LD_LIBRARY_PATH}
    export LD_LIBRARY_PATH=${PYTHON_ROOT}/bin/lib/python2.7/lib-dynload:${LD_LIBRARY_PATH} 
  4. [Optional]  If your application(s) import the 32-bit "cx_Oracle" module, add the following Add the 32-bit Python libraries and their dependencies to your environment:

    Code Block
    languagebash
    themeConfluence
    export LD_LIBRARY_ORACLE_HOME=${LCLS_ROOT}/package/oracle/product/11.1.0.6/client
    export PATH=${PYTHONORACLE_ROOTHOME}/libbin:${LD_LIBRARY_PATH}
    export LD_LIBRARY_PATH=${PYTHON_ROOT}/lib/python2.7ORACLE_HOME}/lib-dynload:${LD_LIBRARY_PATH}
  5. [Optional]  If If your application(s) import the "PyQt4", "PyQwt", or any other 32-bit "cx_Oracle" moduleQt dependencies, add the following to your environment:

    Code Block
    languagebash
    themeConfluence
    export ORACLEQT_HOME=${LCLS_ROOT}/package/oracle/product/11.1.0.6/clientQt-4.8.5
    export PATH=${ORACLEQT_HOME}/bin:${PATH}
    export LD_LIBRARY_PATH=${ORACLEQT_HOME}/lib:${LD_LIBRARY_PATH}
  6. [Optional] If your application(s) import "PyQt4", "PyQt5", "PyQwt", "matlab_wrapper" or any other 32-bit Qt dependencies, add the following to your environment:Matlab 2012a dependent modules, add the following to your environment:

    Code Block
    languagebash
    themeConfluence
    Code Block
    languagebash
    themeConfluence
    export QT_HOME=${LCLS_ROOT}/package/Qt-4.8.5
    export PATH=${QT_HOME}/bin:${PATH}
    export LD_LIBRARY_PATH=${QTLCLS_HOME}ROOT}/matlab/2012a/extern/lib:${LD_LIBRARY_PATH}
  7. [Optional] If your application (s) import "matlab_wrapper" or any other 32-bit Matlab 2012a dependent modules, add the following to your environmenthas dependencies on 32-bit pvaPy, set the following in your Python path:

    Code Block
    languagebash
    themeConfluence
    export LD_LIBRARY_PATHPYTHONPATH=${LCLSEPICS_BASE_ROOTTOP}/matlab/2012a/extern/lib:${LD_LIBRARY_PATH}base-cpp-R4-6-0/pvaPy/lib/python/2.7/linux-x86:${TOOLS}/python/toolbox