# New plugin (q2-srs) does not work for some users

**URL:** <https://forum.qiime2.org/t/new-plugin-q2-srs-does-not-work-for-some-users/17684>\
**Category:** Developer Discussion\
**Tags:** plugin-development\
**Created:** [December 3, 2020, 4:46pm UTC](https://forum.qiime2.org/t/new-plugin-q2-srs-does-not-work-for-some-users/17684 "2020-12-03T16:46:13Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![vheidrich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/vheidrich/32/3280_2.png) [@vheidrich](https://forum.qiime2.org/u/vheidrich)\
**Post date:** [December 3, 2020, 4:46pm UTC](https://forum.qiime2.org/t/new-plugin-q2-srs-does-not-work-for-some-users/17684/1 "2020-12-03T16:46:13Z")

</div>

Hi,

I have recently [posted](https://forum.qiime2.org/t/q2-srs-qiime2-plugin-for-library-size-normalization-by-scaling-with-ranked-subsampling-srs/17661) about a new QIIME2 plugin (q2-srs). It turns out some users are facing this [issue](https://github.com/vitorheidrich/q2-srs/issues/2), while others are not (eg, q2-srs runs normally from a Google [colab](https://colab.research.google.com/drive/1-LaZoh9AsMz2SQEmatT2fT6zxLxr0Kik?usp=sharing)). I am currently not able to reproduce that error, so it has been very hard to investigate what could be happening. So I am using my last resource that is to ask the QIIME2 team for help 👋

For the ones facing the issue, it looks like the plugin is installed and all the files are there but somehow qiime is not looking for them where it should. So, is it something wrong with the plugin or the qiime env? Any help will be greatly appreciated.

Thank you,

Vitor

---

<div class="post-metadata">

**Author:** ![SoilRotifer](https://forum.qiime2.org/user_avatar/forum.qiime2.org/soilrotifer/32/21071_2.png) [@SoilRotifer](https://forum.qiime2.org/u/SoilRotifer)\
**Post date:** [December 3, 2020, 4:57pm UTC](https://forum.qiime2.org/t/new-plugin-q2-srs-does-not-work-for-some-users/17684/2 "2020-12-03T16:57:55Z")

</div>

Just so the other :qiime2: devs are aware. I am also running into this issue.

I used the `conda install -c vitorheidrich q2_srs` approach.

When I try running the q2-srs tutorial I get:

> (qiime2-2020.8) mike@microbiota:~/Documents/tmp/q2-srs\> qiime srs SRScurve --i-table table-dada2.qza --p-step 100 --p-max-sample-size 3500 --p-rarefy-comparison --p-rarefy-comparison-legend --p-rarefy-repeats 100 --p-srs-color 'blue' --p-rarefy-color '#333333' --o-visualization SRScurve-plot.qzv --verbose  
> Running external command line application(s). This may print messages to stdout and/or stderr.  
> The command(s) being run are below. These commands cannot be manually re-run as they will depend on temporary files that no longer exist.
> 
> Command: SRScurve.R /var/folders/ph/ms21wvc97pq3\_cngx2zwlfy80000gn/T/tmpbit3\_26b/table.tsv richness 100 0 3500 True 100 True blue #333333 solid longdash False /var/folders/ph/ms21wvc97pq3\_cngx2zwlfy80000gn/T/qiime2-temp-xdbz5d1d
> 
> Traceback (most recent call last):  
> File "/Users/mike/AnalysisSoftware/miniconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/q2cli/commands.py", line 329, in **call**  
> results = action(\*\*arguments)  
> File "", line 2, in SRScurve  
> File "/Users/mike/AnalysisSoftware/miniconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/qiime2/sdk/action.py", line 245, in bound\_callable  
> output\_types, provenance)  
> File "/Users/mike/AnalysisSoftware/miniconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/qiime2/sdk/action.py", line 452, in _callable\_executor_  
> ret\_val = self.\_callable(output\_dir=temp\_dir, \*\*view\_args)  
> File "/Users/mike/AnalysisSoftware/miniconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/q2\_srs/\_SRScurve.py", line 53, in SRScurve  
> run\_commands([cmd])  
> File "/Users/mike/AnalysisSoftware/miniconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/q2\_srs/\_SRScurve.py", line 29, in run\_commands  
> subprocess.run(cmd, check=True)  
> File "/Users/mike/AnalysisSoftware/miniconda3/envs/qiime2-2020.8/lib/python3.6/subprocess.py", line 423, in run  
> with Popen(\*popenargs, \*\*kwargs) as process:  
> File "/Users/mike/AnalysisSoftware/miniconda3/envs/qiime2-2020.8/lib/python3.6/subprocess.py", line 729, in **init**  
> restore\_signals, start\_new\_session)  
> File "/Users/mike/AnalysisSoftware/miniconda3/envs/qiime2-2020.8/lib/python3.6/subprocess.py", line 1364, in \_execute\_child  
> raise child\_exception\_type(errno\_num, err\_msg, err\_filename)  
> FileNotFoundError: [Errno 2] No such file or directory: 'SRScurve.R': 'SRScurve.R'
> 
> Plugin error from srs:
> 
> [Errno 2] No such file or directory: 'SRScurve.R': 'SRScurve.R'
> 
> See above for debug info.

When I run `which` from within my `qiime2-2020.8` environment I get:

> (qiime2-2020.8) mike@microbiota: which SRScurve.R  
> /Users/mike/AnalysisSoftware/miniconda3/envs/qiime2-2020.8/bin/SRScurve.R

It appears that `SRScurve.R` is there...

My `qiime info` is:

> (qiime2-2020.8) mike@microbiota:~/Documents/tmp/q2-srs\> qiime info  
> System versions  
> Python version: 3.6.11  
> QIIME 2 release: 2020.8  
> QIIME 2 version: 2020.8.0  
> q2cli version: 2020.8.0
> 
> Installed plugins  
> aldex2: 1.14.1  
> alignment: 2020.8.0  
> breakaway: 0+untagged.71.g503723a  
> clawback: 2019.7.0  
> composition: 2020.8.0  
> coremicrobiome: 1  
> corncob: 0.1.0  
> cutadapt: 2020.8.0  
> dada2: 2020.8.0  
> deblur: 2020.8.0  
> deicode: 0.2.4  
> demux: 2020.8.0  
> diversity: 2020.8.0  
> diversity-lib: 2020.8.0  
> emperor: 2020.8.0  
> empress: 1.0.0  
> feature-classifier: 2020.8.0  
> feature-table: 2020.8.0  
> fragment-insertion: 2020.8.0  
> gemelli: 0.0.5  
> gneiss: 2020.8.0  
> longitudinal: 2020.8.0  
> metadata: 2020.8.0  
> phylogeny: 2020.8.0  
> quality-control: 2020.8.0  
> quality-filter: 2020.8.0  
> qurro: 0.7.1  
> rescript: 2020.6.1+18.gf9be3c8  
> sample-classifier: 2020.8.0  
> songbird: 1.0.4  
> sourmash: 0.0.0  
> srs: 2020.8.0  
> taxa: 2020.8.0  
> types: 2020.8.0  
> vsearch: 2020.8.0
> 
> Application config directory  
> /Users/mike/AnalysisSoftware/miniconda3/envs/qiime2-2020.8/var/q2cli

-I hope this helps!  
-Mike

---

<div class="post-metadata">

**Author:** ![fedarko](https://forum.qiime2.org/user_avatar/forum.qiime2.org/fedarko/32/5361_2.png) [@fedarko](https://forum.qiime2.org/u/fedarko)\
**Post date:** [December 3, 2020, 6:19pm UTC](https://forum.qiime2.org/t/new-plugin-q2-srs-does-not-work-for-some-users/17684/3 "2020-12-03T18:19:08Z")

</div>

The problem might be due to Python packaging -- I've ran into finicky problems before where non-Python files would sometimes get downloaded and sometimes would be missing (causing problems like this).

It doesn't look like q2-srs has a MANIFEST.in file -- maybe try adding one of those to your repo and seeing if that helps? ([Python docs on this.](https://packaging.python.org/guides/using-manifest-in/)) We had to do this for q2-qurro in order to add in some files -- the file we ended up with is [qurro/MANIFEST.in at master · biocore/qurro · GitHub](https://github.com/biocore/qurro/blob/master/MANIFEST.in), for reference. (I think this is the sort of thing where ideally the setup.py file _should_ tell pip to install some of the extra files, but sometimes that gets ignored... it might be dependent on the Python version, IIRC.)

I think you can test this by setting up different conda environments and running `pip install git+https://github.com/vitorheidrich/q2-srs.git`, or something like that -- testing by running `pip install -e .` or something locally won't reproduce the problem because the program will just be installed from the source directory you have set up, which will already include the files.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![vheidrich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/vheidrich/32/3280_2.png) [@vheidrich](https://forum.qiime2.org/u/vheidrich)\
**Post date:** [December 3, 2020, 9:35pm UTC](https://forum.qiime2.org/t/new-plugin-q2-srs-does-not-work-for-some-users/17684/4 "2020-12-03T21:35:41Z")

</div>

Hi Marcus,

Thank you for your suggestion!  
At first, l was still not able to reproduce the problem, because even when using the alternative pip install command, all non-python files were being correctly downloaded and the plugin worked. Regarding the files being correctly downloaded, I believe that was also the case for @SoilRotifer and Pablo (the one that first reported me this issue), so that the problem is apparently occurring after this stage.

For comparison, when I ran `which` from within the qiime2-2020.8 (where q2-srs works) I also got:

```auto
(qiime2-2020.8) vitorheidrich@vheidrich:~$ which SRScurve.R
/home/vitorheidrich/miniconda3/envs/qiime2-2020.8/bin/SRScurve.R

```

Fortunately, when I tested the plugin with another machine I was able to reproduce the problem. Again, I ran `which` from within the qiime2-2020.8 (where q2-srs doesn't work) and I got the same:

```auto
(qiime2-2020.8) vheidrich@pnd4:~$ which SRScurve.R
/home/tools/manual/miniconda3/envs/qiime2-2020.8/bin/SRScurve.R

```

Therefore, in summary, all files are always downloaded, but in some machines the R scripts are not found (even though they are there).

Even so, I tried your suggestion (including a MANIFEST.in file), but since the files were already being correctly downloaded - as expected - it didn't work.

Any other suggestion? Thanks

---

<div class="post-metadata">

**Author:** ![SoilRotifer](https://forum.qiime2.org/user_avatar/forum.qiime2.org/soilrotifer/32/21071_2.png) [@SoilRotifer](https://forum.qiime2.org/u/SoilRotifer)\
**Post date:** [December 3, 2020, 10:15pm UTC](https://forum.qiime2.org/t/new-plugin-q2-srs-does-not-work-for-some-users/17684/5 "2020-12-03T22:15:56Z")

</div>

Hi @vheidrich, one thing I just realized is that the shebang line for `SRScurve.R` is:  
`#! /usr/bin/Rscript`

Shouldn't this be altered based on the conda environment? That is, on my machine this should be:  
` #! /Users/robesonmichael/AnalysisSoftware/miniconda3/envs/qiime2-2020.8/bin/Rscript`

When I edit this line and run the same command as I did before I get a new error:

> qiime srs SRScurve --i-table table-dada2.qza --p-step 100 --p-max-sample-size 3500 --p-rarefy-comparison --p-rarefy-comparison-legend --p-rarefy-repeats 100 --p-srs-color 'blue' --p-rarefy-color '#333333' --o-visualization SRScurve-plot.qzv --verbose  
> Running external command line application(s). This may print messages to stdout and/or stderr.  
> The command(s) being run are below. These commands cannot be manually re-run as they will depend on temporary files that no longer exist.
> 
> Command: SRScurve.R /var/folders/cc/rksyds7175786\_2b0vhx4rrr0000gp/T/tmp7mfpg8b2/table.tsv richness 100 0 3500 True 100 True blue #333333 solid longdash False /var/folders/cc/rksyds7175786\_2b0vhx4rrr0000gp/T/qiime2-temp-mvwkcy\_m
> 
> R version 3.5.1 (2018-07-02)  
> Error in contrib.url(repos, type) :  
> trying to use CRAN without setting a mirror  
> Calls: install.packages -\> grep -\> contrib.url  
> Execution halted  
> Traceback (most recent call last):  
> File "/Users/robesonmichael/AnalysisSoftware/miniconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/q2cli/commands.py", line 329, in **call**  
> results = action(\*\*arguments)  
> File "", line 2, in SRScurve  
> File "/Users/robesonmichael/AnalysisSoftware/miniconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/qiime2/sdk/action.py", line 245, in bound\_callable  
> output\_types, provenance)  
> File "/Users/robesonmichael/AnalysisSoftware/miniconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/qiime2/sdk/action.py", line 452, in _callable\_executor_  
> ret\_val = self.\_callable(output\_dir=temp\_dir, \*\*view\_args)  
> File "/Users/robesonmichael/AnalysisSoftware/miniconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/q2\_srs/\_SRScurve.py", line 53, in SRScurve  
> run\_commands([cmd])  
> File "/Users/robesonmichael/AnalysisSoftware/miniconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/q2\_srs/\_SRScurve.py", line 29, in run\_commands  
> subprocess.run(cmd, check=True)  
> File "/Users/robesonmichael/AnalysisSoftware/miniconda3/envs/qiime2-2020.8/lib/python3.6/subprocess.py", line 438, in run  
> output=stdout, stderr=stderr)  
> subprocess.CalledProcessError: Command '['SRScurve.R', '/var/folders/cc/rksyds7175786\_2b0vhx4rrr0000gp/T/tmp7mfpg8b2/table.tsv', 'richness', '100', '0', '3500', 'True', '100', 'True', 'blue', '#333333', 'solid', 'longdash', 'False', '/var/folders/cc/rksyds7175786\_2b0vhx4rrr0000gp/T/qiime2-temp-mvwkcy\_m']' returned non-zero exit status 1.
> 
> Plugin error from srs:
> 
> Command '['SRScurve.R', '/var/folders/cc/rksyds7175786\_2b0vhx4rrr0000gp/T/tmp7mfpg8b2/table.tsv', 'richness', '100', '0', '3500', 'True', '100', 'True', 'blue', '#333333', 'solid', 'longdash', 'False', '/var/folders/cc/rksyds7175786\_2b0vhx4rrr0000gp/T/qiime2-temp-mvwkcy\_m']' returned non-zero exit status 1.
> 
> See above for debug info.

I noticed this:

> Error in contrib.url(repos, type) :  
> trying to use CRAN without setting a mirror  
> Calls: install.packages -\> grep -\> contrib.url  
> Execution halted

Any ideas?

---

<div class="post-metadata">

**Author:** ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)\
**Post date:** [December 3, 2020, 10:20pm UTC](https://forum.qiime2.org/t/new-plugin-q2-srs-does-not-work-for-some-users/17684/6 "2020-12-03T22:20:55Z")

</div>

> [@SoilRotifer](#):
>
> #! /usr/bin/Rscript

Good catch @SoilRotifer! I haven't followed this discussion too closely yet, so apologies if I missed this above, but I think the correct [hash-pling](https://en.wikipedia.org/wiki/Shebang_(Unix)) is:

```bash
#!/usr/bin/env Rscript

```

this ensures that the script runs using the conda env R, versus a system-wide R.

---

<div class="post-metadata">

**Author:** ![SoilRotifer](https://forum.qiime2.org/user_avatar/forum.qiime2.org/soilrotifer/32/21071_2.png) [@SoilRotifer](https://forum.qiime2.org/u/SoilRotifer)\
**Post date:** [December 3, 2020, 10:23pm UTC](https://forum.qiime2.org/t/new-plugin-q2-srs-does-not-work-for-some-users/17684/7 "2020-12-03T22:23:45Z")

</div>

> [@thermokarst](#):
>
> `#!/usr/bin/env Rscript`

Oh right! 🤦‍♂️

---

<div class="post-metadata">

**Author:** ![SoilRotifer](https://forum.qiime2.org/user_avatar/forum.qiime2.org/soilrotifer/32/21071_2.png) [@SoilRotifer](https://forum.qiime2.org/u/SoilRotifer)\
**Post date:** [December 3, 2020, 10:41pm UTC](https://forum.qiime2.org/t/new-plugin-q2-srs-does-not-work-for-some-users/17684/8 "2020-12-03T22:41:15Z")

</div>

I also tried to run `install.packages("SRS")` within `R` of my `qiime2-2020.8` environment and it fails to build (Mac OS X 10.15.7).

If the `install.packages` issue above can be resolved, it might be a good idea to remove the `install.packages` commands from the `SRScurve.R` file, and just inform users to install the R portion manually, as done for other packages like [ALDEx2](https://library.qiime2.org/plugins/q2-aldex2/24/).

---

<div class="post-metadata">

**Author:** ![vheidrich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/vheidrich/32/3280_2.png) [@vheidrich](https://forum.qiime2.org/u/vheidrich)\
**Post date:** [December 4, 2020, 1:01am UTC](https://forum.qiime2.org/t/new-plugin-q2-srs-does-not-work-for-some-users/17684/9 "2020-12-04T01:01:06Z")

</div>

Hi @SoilRotifer,

Thank you for your suggestions! Changing the shebang line mostly solved the issue (thanks @thermokarst!). Regarding the second problem, it was just a matter of assigning a valid CRAN repo.

Now I believe the problem is fixed! Please let me know if you run into any other issue.

Cheers,

Vitor

---

<div class="post-metadata">

**Author:** ![SoilRotifer](https://forum.qiime2.org/user_avatar/forum.qiime2.org/soilrotifer/32/21071_2.png) [@SoilRotifer](https://forum.qiime2.org/u/SoilRotifer)\
**Post date:** [December 4, 2020, 2:19pm UTC](https://forum.qiime2.org/t/new-plugin-q2-srs-does-not-work-for-some-users/17684/10 "2020-12-04T14:19:23Z")

</div>

Silly me forgot to change the shebang line in the other R file, which is why I was still unable to get it to work. But it works now after your update @vheidrich ! 🙌

Glad we were able to help solve this! 👨‍🔧

---

<div class="post-metadata">

**Author:** ![Pablo\_V](https://forum.qiime2.org/user_avatar/forum.qiime2.org/pablo_v/32/4898_2.png) [@Pablo\_V](https://forum.qiime2.org/u/Pablo_V)\
**Post date:** [December 4, 2020, 11:11pm UTC](https://forum.qiime2.org/t/new-plugin-q2-srs-does-not-work-for-some-users/17684/11 "2020-12-04T23:11:20Z")

</div>

Hi @vheidrich

And how do you assign a CRAN repo? Because I changed the first line of the SRS.R file into

`#!/usr/bin/env Rscript`

But now i get a different error:

```
Running external command line application(s). This may print messages to stdout and/or stderr.
The command(s) being run are below. These commands cannot be manually re-run as they will depend on temporary files that no longer exist.

Command: SRS.R /tmp/tmpumsjjvqw/table.tsv 1000 True 1

R version 3.5.1 (2018-07-02) 
Error in contrib.url(repos, type) : 
  trying to use CRAN without setting a mirror
Calls: install.packages -> grep -> contrib.url
Execution halted
Traceback (most recent call last):
  File "/home/sam/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/q2cli/commands.py", line 329, in __call__
    results = action(**arguments)
  File "<decorator-gen-121>", line 2, in SRS
  File "/home/sam/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/qiime2/sdk/action.py", line 245, in bound_callable
    output_types, provenance)
  File "/home/sam/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/qiime2/sdk/action.py", line 390, in _callable_executor_
    output_views = self._callable(**view_args)
  File "/home/sam/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/q2_srs/_SRS.py", line 45, in SRS
    run_commands([cmd])
  File "/home/sam/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/q2_srs/_SRS.py", line 28, in run_commands
    subprocess.run(cmd, check=True)
  File "/home/sam/anaconda3/envs/qiime2-2020.8/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['SRS.R', '/tmp/tmpumsjjvqw/table.tsv', '1000', 'True', '1']' returned non-zero exit status 1.

Plugin error from srs:

  Command '['SRS.R', '/tmp/tmpumsjjvqw/table.tsv', '1000', 'True', '1']' returned non-zero exit status 1.

See above for debug info.

```

Cheers,  
Pablo

---

<div class="post-metadata">

**Author:** ![vheidrich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/vheidrich/32/3280_2.png) [@vheidrich](https://forum.qiime2.org/u/vheidrich)\
**Post date:** [December 5, 2020, 4:24am UTC](https://forum.qiime2.org/t/new-plugin-q2-srs-does-not-work-for-some-users/17684/12 "2020-12-05T04:24:39Z")

</div>

Hi @Pablo_V,

That was a discussion on what I needed to do (as a developer) to update the plugin to get rid of those errors. Now that the plugin is updated, there is no need for users to manually change files. So please just reinstall q2-srs and you already will have the updated/fixed plugin.

Reinstallation instructions:

1. deactivate your qiime env
2. cd into your qiime env directory (in my case, located at ` /home/vitorheidrich/miniconda3/envs/qiime2-2020.8`)
3. run:

```auto
    rm -r bin/SRS* lib/python3.6/site-packages/*srs*

```

1. follow the installation instructions provided [here](https://github.com/vitorheidrich/q2-srs)

Cheers,

Vitor

---

<div class="post-metadata">

**Author:** ![jwdebelius](https://forum.qiime2.org/user_avatar/forum.qiime2.org/jwdebelius/32/9655_2.png) [@jwdebelius](https://forum.qiime2.org/u/jwdebelius)\
**Post date:** [July 11, 2021, 6:25am UTC](https://forum.qiime2.org/t/new-plugin-q2-srs-does-not-work-for-some-users/17684/13 "2021-07-11T06:25:43Z")

</div>

2 off-topic replies have been split into a new topic: [q2-srs python incomptability](https://forum.qiime2.org/t/q2-srs-python-incomptability/20151)

Please keep replies on-topic in the future.

---

<div class="post-metadata">

**Author:** ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)\
**Post date:** [September 22, 2021, 2:25pm UTC](https://forum.qiime2.org/t/new-plugin-q2-srs-does-not-work-for-some-users/17684/14 "2021-09-22T14:25:07Z")

</div>

An off-topic reply has been split into a new topic: [I Need Help with q2-srs](https://forum.qiime2.org/t/i-need-help-with-q2-srs/20835)

Please keep replies on-topic in the future.
