I seem to be having some difficulty with the feature-classifier command. This command is the only time I've seen this error and I can't seem to figure out why––so I turn here!
I've been trying to run a trained classifier recently downloaded from UNITE's website. This was my code:
Running it with the --verbose flag gives me this error message:
Traceback (most recent call last):
File "/opt/anaconda/anaconda/envs/qiime2-2022.2/lib/python3.8/site-packages/q2cli/commands.py", line 339, in __call__
results = action(**arguments)
File "<decorator-gen-442>", line 2, in classify_sklearn
File "/opt/anaconda/anaconda/envs/qiime2-2022.2/lib/python3.8/site-packages/qiime2/sdk/action.py", line 221, in bound_callable
provenance.add_input(name, artifact)
File "/opt/anaconda/anaconda/envs/qiime2-2022.2/lib/python3.8/site-packages/qiime2/core/archive/provenance.py", line 421, in add_input
self.inputs[name] = self.add_ancestor(input)
File "/opt/anaconda/anaconda/envs/qiime2-2022.2/lib/python3.8/site-packages/qiime2/core/archive/provenance.py", line 167, in add_ancestor
shutil.copytree(
File "/opt/anaconda/anaconda/envs/qiime2-2022.2/lib/python3.8/shutil.py", line 555, in copytree
with os.scandir(src) as itr:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/qiime2-archive-8uzzq___/aed6c005-361c-4cab-97ca-4df2e7be038e/provenance'
Plugin error from feature-classifier:
[Errno 2] No such file or directory: '/tmp/qiime2-archive-8uzzq___/aed6c005-361c-4cab-97ca-4df2e7be038e/provenance'
See above for debug info.
I've run this command multiple times. Each time, the file it's looking for changes. It's always "/tmp/qiime2-archive-" but the small section that follows the archive is different. Here's what I mean:
I think the issue here is with the --output-dir command:
This parameter is used to output unspecified results to a directory, but what you've provided is a full file path. Since there is only one output for this method that you've already specified, I'd recommend omitting the --output-dir parameter, and just sticking with what you have in your command for the --o-classification parameter:
This is sending your results to a new file that you are naming Forward-unite-taxonomy-2021.qza, so there is no need to include the --output-dir parameter on top of that.
With that being said, if you did want to specify a directory where this specified result will be sent to (such as the /home/keeneJB/shared/FPIES_Children_mycobiome/ directory), you can just include that full path where you'd like the file sent to in the --o-classification command.
Give that a try, and let us know if you're still running into any issues!
Thank you @lizgehret! Unfortunately, I ran it without the --output-dir parameter and am running into the same problem:
qiime feature-classifier classify-sklearn \
--i-classifier 2021-unite-classifier.qza \
--i-reads Forward-rep-seqs.qza \
--o-classification Forward-unite-taxonomy-2021.qza \
--verbose
Traceback (most recent call last):
File "/opt/anaconda/anaconda/envs/qiime2-2022.2/lib/python3.8/site-packages/q2cli/commands.py", line 339, in __call__
results = action(**arguments)
File "<decorator-gen-442>", line 2, in classify_sklearn
File "/opt/anaconda/anaconda/envs/qiime2-2022.2/lib/python3.8/site-packages/qiime2/sdk/action.py", line 221, in bound_callable
provenance.add_input(name, artifact)
File "/opt/anaconda/anaconda/envs/qiime2-2022.2/lib/python3.8/site-packages/qiime2/core/archive/provenance.py", line 421, in add_input
self.inputs[name] = self.add_ancestor(input)
File "/opt/anaconda/anaconda/envs/qiime2-2022.2/lib/python3.8/site-packages/qiime2/core/archive/provenance.py", line 167, in add_ancestor
shutil.copytree(
File "/opt/anaconda/anaconda/envs/qiime2-2022.2/lib/python3.8/shutil.py", line 555, in copytree
with os.scandir(src) as itr:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/qiime2-archive-4d452n37/aed6c005-361c-4cab-97ca-4df2e7be038e/provenance'
Plugin error from feature-classifier:
[Errno 2] No such file or directory: '/tmp/qiime2-archive-4d452n37/aed6c005-361c-4cab-97ca-4df2e7be038e/provenance'
See above for debug info.
So weird! I understand why it would need a tmp file, just not why that tmp file wouldn't be available, or why it's looking for folders that don't exist.
Thanks for your patience here! This is certainly unusual - a possibility that @Oddant1 mentioned to me is that your operating system may be aggressively cleaning old files out of your /tmp folder. So if the command you are running is taking more than X amount of time to run, and your operating system is deleting files older than X from /tmp - this could be what you're running into here.
If this isn't something that you've experienced before, this could be something to reach out to your system administrator about (if that is applicable for your machine). They may be able to modify the settings for your machine that handle your /tmp folder and file storage.