Repository: spack/spack

Issue:
Spack Does Not Load Python Dependencies for Albacore
Hi Guys

Thanks so much to @adamjstewart for helping out with #4219!

In now have albacore installed outside my fork of Spack.  However, it's not loading all dependencies:

```
[root@node103 spack]# spack activate ont-albacore
==> Activated extension py-six@1.10.0%gcc@6.3.0 arch=linux-rhel6-x86_64 /2uxwssj for python@3.5.2+shared~tk~ucs4%gcc@6.3.0
==> Activated extension py-dateutil@2.5.2%gcc@6.3.0 arch=linux-rhel6-x86_64 /rtn7tjh for python@3.5.2+shared~tk~ucs4%gcc@6.3.0
==> Activated extension py-mpi4py@2.0.0%gcc@6.3.0 arch=linux-rhel6-x86_64 /6qawxwt for python@3.5.2+shared~tk~ucs4%gcc@6.3.0
==> Activated extension py-numpy@1.12.1%gcc@6.3.0+blas+lapack arch=linux-rhel6-x86_64 /7f5sdah for python@3.5.2+shared~tk~ucs4%gcc@6.3.0
==> Activated extension py-h5py@2.6.0%gcc@6.3.0+mpi arch=linux-rhel6-x86_64 /flvo3ix for python@3.5.2+shared~tk~ucs4%gcc@6.3.0
==> Activated extension py-ont-fast5-api@0.3.2%gcc@6.3.0 arch=linux-rhel6-x86_64 /nkx3gck for python@3.5.2+shared~tk~ucs4%gcc@6.3.0
==> Activated extension ont-albacore@1.1.0%gcc@6.3.0 arch=linux-rhel6-x86_64 /qcctc3l for python@3.5.2+shared~tk~ucs4%gcc@6.3.0

[root@node103 spack]# read_fast5_basecaller.py                                                                                                                                                                                                
Traceback (most recent call last):
  File "/pbtech_mounts/softlib001/apps/EL6/spack/opt/spack/linux-rhel6-x86_64/gcc-6.3.0/ont-albacore-1.1.0-qcctc3lgwrt6ooxjv45h4ontjmj6ugno/bin/read_fast5_basecaller.py", line 60, in <module>
    import pkg_resources
```

I then must do:

```
[root@node103 spack]# spack load py-setuptools                                                                                                                                                                                              
[root@node103 spack]# spack load py-pyparsing
[root@node103 spack]# spack load  py-packaging

```

Otherwise each module will be shown as missing when running "read_fast5_basecaller.py"    

The template:
```
    depends_on('python@3.5.0:3.5.999',     type=('build', 'run'))
    depends_on('py-setuptools',     type=('build'))
    depends_on('py-numpy',        type=('build', 'run'))
    depends_on('py-dateutil',        type=('build', 'run'))
    depends_on('py-h5py',        type=('build', 'run'))
    depends_on('py-ont-fast5-api',        type=('build', 'run'))
    depends_on('py-pip',        type=('build'))
```

Though it seems this package actually needs setuptools for running not simply building.  Can anyone else replicate?  Moreover, doing "spack load py-setuptools" did not load dependencies  py-pyparsing and  py-packaging even though I have this set in $SPACK_ROOT/etc/spack/modules.yml which supposidly will override $SPACK_ROOT/etc/spack/defaults/modules.yml and  ~/.spack/modules.yaml:

```
modules:
  enable:
    - tcl
    - dotkit
  tcl:
    ^python:
      autoload: 'direct'
  prefix_inspections:
    bin:
      - PATH
    man:
      - MANPATH
    share/man:
      - MANPATH
    share/aclocal:
      - ACLOCAL_PATH
    lib:
      - LIBRARY_PATH
      - LD_LIBRARY_PATH
    lib64:
      - LIBRARY_PATH
      - LD_LIBRARY_PATH
    include:
      - CPATH
    lib/pkgconfig:
      - PKG_CONFIG_PATH
    lib64/pkgconfig:
      - PKG_CONFIG_PATH
    '':
      - CMAKE_PREFIX_PATH
```

My goal would be for the user to type "spack load ont-albacore" then not have to do anything else.
albacore requires setuptools as build and run requirement
Per #4239


Discussion:
> Though it seems this package actually needs setuptools for running not simply building.

If `setuptools` is needed at run-time, it needs to be a build/run dependency. Otherwise it won't be activated.
@adamjstewart

Confirmed after uninstall / install.
```


[root@node103 spack]# spack activate ont-albacore
==> Activated extension py-appdirs@1.4.3%gcc@6.3.0 arch=linux-rhel6-x86_64 /5bhx72q for python@3.5.2+shared~tk~ucs4%gcc@6.3.0
==> Activated extension py-pyparsing@2.2.0%gcc@6.3.0 arch=linux-rhel6-x86_64 /fauvzmy for python@3.5.2+shared~tk~ucs4%gcc@6.3.0
==> Activated extension py-packaging@16.8%gcc@6.3.0 arch=linux-rhel6-x86_64 /wfufce4 for python@3.5.2+shared~tk~ucs4%gcc@6.3.0
==> Activated extension py-setuptools@34.4.1%gcc@6.3.0 arch=linux-rhel6-x86_64 /tvbxqrt for python@3.5.2+shared~tk~ucs4%gcc@6.3.0
==> Activated extension ont-albacore@1.1.0%gcc@6.3.0 arch=linux-rhel6-x86_64 /fjwekke for python@3.5.2+shared~tk~ucs4%gcc@6.3.0
[root@node103 spack]# read_fast5_basecaller.py 
usage: read_fast5_basecaller.py [-h] [-l] [-v] -i INPUT -t WORKER_THREADS -s
                                SAVE_PATH [-f FLOWCELL] [-k KIT] [--barcoding]
                                [-c CONFIG] [-d DATA_PATH] [-b] [-r]
                                [-n FILES_PER_BATCH_FOLDER] [-o OUTPUT_FORMAT]
                                [-q READS_PER_FASTQ_BATCH]
read_fast5_basecaller.py: error: the following arguments are required: -i/--input, -t/--worker_threads, -s/--save_path

```
Looks like there are some conflicts. I don't recommend committing anything to develop, as it makes it really hard to separate out PRs. I always create a new branch off of develop for a PR and keep develop pristine and in sync with upstream develop.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/ont-albacore/package.py b/var/spack/repos/builtin/packages/ont-albacore/package.py
--- a/var/spack/repos/builtin/packages/ont-albacore/package.py
+++ b/var/spack/repos/builtin/packages/ont-albacore/package.py
@@ -38,13 +38,13 @@ class OntAlbacore(Package):
     version('1.1.0', 'fab4502ea1bad99d813aa2629e03e83d', expand=False)
     extends('python')
 
-    depends_on('python@3.5.0:3.5.999',     type=('build', 'run'))
-    depends_on('py-setuptools',     type=('build'))
-    depends_on('py-numpy',        type=('build', 'run'))
-    depends_on('py-dateutil',        type=('build', 'run'))
-    depends_on('py-h5py',        type=('build', 'run'))
-    depends_on('py-ont-fast5-api',        type=('build', 'run'))
-    depends_on('py-pip',        type=('build'))
+    depends_on('python@3.5.0:3.5.999', type=('build', 'run'))
+    depends_on('py-setuptools',        type=('build', 'run'))
+    depends_on('py-numpy',             type=('build', 'run'))
+    depends_on('py-dateutil',          type=('build', 'run'))
+    depends_on('py-h5py',              type=('build', 'run'))
+    depends_on('py-ont-fast5-api',     type=('build', 'run'))
+    depends_on('py-pip',               type=('build'))
 
     def install(self, spec, prefix):
         pip = which('pip')


Test patch: