When using qiime tools export
with --output-format
to export to a single file, a cross-device link error occurs if the qiime2 temporary directory is on a different device than the directory being exported to.
Here’s an example error message using qiime2-2018.11 installed via conda on macOS:
$ qiime tools export \
--input-path tree.qza \
--output-path tree.nwk \
--output-format NewickFormat
OSError: [Errno 18] Cross-device link: '/var/folders/bt/rtfdzpmn0hz8mcgwgvy6m0000000gn/T/qiime2-archive-nzu4ozdw/e7904029-d9f0-405c-b376-9b6f681c620b/data/tree.nwk' -> '/Volumes/test-export/tree.nwk'
This happens because q2cli’s export_data
function uses os.renames
if the user provides an output_format
and it’s exporting to a single file (see these lines). If output_format
is omitted, or the data being exported is a directory, a different codepath is taken that works across devices.
A workaround is to set qiime2’s temporary directory to be on the same device as the output directory (e.g. setting TMPDIR
environment variable). Another option is to omit --output-format
from the command to use the default output format.