cms-gem-detqc-project / CMS_GEM_Analysis_Framework

Analysis framework for the CMS GEM collaboration
GNU General Public License v3.0
0 stars 4 forks source link

Bug Report: Setup Script does not install python packages #8

Open JeremieMerlin opened 7 years ago

JeremieMerlin commented 7 years ago

Brief summary of issue

Found that issuing setup script:

source scripts/setup_CMS_GEM.sh

Types of issue

Expected Behavior

Required python packages should be installed by pip when calling setup script.

Current Behavior

Python packages were not installed.

Steps to Reproduce (for bugs)

  1. Source setup script:
    source scripts/setup_CMS_GEM.sh
    FRAMEWORK_BASE /afs/cern.ch/work/j/jmerlin/CMS_GEM_Analysis_Framework
    alias root='root -l'
    /afs/cern.ch/sw/lcg/app/releases/ROOT/6.06.06/x86_64-slc6-gcc48-opt/root/bin/root
    alias python2.7='/afs/cern.ch/sw/lcg/external/Python/2.7.4/x86_64-slc6-gcc48-opt/bin/python2.7'
    /afs/cern.ch/sw/lcg/external/Python/2.7.4/x86_64-slc6-gcc48-opt/bin/python2.7
    alias pip2.7='/afs/cern.ch/work/j/jmerlin/CMS_GEM_Analysis_Framework/python/pip/bin/pip'
    /afs/cern.ch/work/j/jmerlin/CMS_GEM_Analysis_Framework/python/pip/bin/pip
  2. Try to import numpy:
[jmerlin@lxplus044 CMS_GEM_Analysis_Framework]$ which python2.7
alias python2.7='/afs/cern.ch/sw/lcg/external/Python/2.7.4/x86_64-slc6-gcc48-opt/bin/python2.7'
    /afs/cern.ch/sw/lcg/external/Python/2.7.4/x86_64-slc6-gcc48-opt/bin/python2.7
[jmerlin@lxplus044 CMS_GEM_Analysis_Framework]$ python2.7
Python 2.7.4 (default, May  5 2013, 17:33:10) 
[GCC 4.8.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named numpy
>>> 

The package numpy should have been installed.

Your Environment

bdorney commented 7 years ago

Was unable to repeat the bug with @JeremieMerlin.

However, after looking at scripts/setup_CMS_GEM.sh it seems that the python packages are attempted to be installed if:

#Install pip & other packages (should be done only once)
DIR_PIP=$FRAMEWORK_BASE/python/pip
if [[ !  -d $DIR_PIP ]]; then
    #Installing pip
        python2.7 python/get-pip.py --prefix=$DIR_PIP

    #Update environment
    export PYTHONPATH=$DIR_PIP/lib/python2.7/site-packages:$PYTHONPATH
    export PATH="$PATH:~/.local/bin"
    alias pip2.7="$DIR_PIP/bin/pip"

    #Installing packages
    $DIR_PIP/bin/pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose root_numpy xlrd

So if the user manually created $DIR_PIP it will not work or if the script did not run to completion (e.g. user pressed Ctrl+C or lost connection) during the original installation process on a subsequent call of the script it would not attempt to install the required python packages.

However, this does indicate that scripts/setup_CMS_GEM.sh could be rethought. Instead of checking for $DIR_PIP the script should probably check instead for the python packages themselves.