vanheeringen-lab/genomepy

TemporaryDirectory unable to remove tmp dir on NTFS formated disk

peterch405 opened this issue · 3 comments

Installing genome on NTFS drive throws an error:

Command used:

genomepy install GRCh38.p13 -p Ensembl --annotation -m none

  File "/home/chovanec/miniconda3/bin/genomepy", line 10, in <module>
    sys.exit(cli())
  File "/home/chovanec/miniconda3/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/chovanec/miniconda3/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/chovanec/miniconda3/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/chovanec/miniconda3/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/chovanec/miniconda3/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/chovanec/miniconda3/lib/python3.8/site-packages/genomepy/cli.py", line 221, in install
    genomepy.install_genome(
  File "/home/chovanec/miniconda3/lib/python3.8/site-packages/genomepy/functions.py", line 305, in install_genome
    p.download_genome(
  File "/home/chovanec/miniconda3/lib/python3.8/site-packages/genomepy/provider.py", line 303, in download_genome
    shutil.move(src, dst)
  File "/home/chovanec/miniconda3/lib/python3.8/tempfile.py", line 828, in __exit__
    self.cleanup()
  File "/home/chovanec/miniconda3/lib/python3.8/tempfile.py", line 832, in cleanup
    self._rmtree(self.name)
  File "/home/chovanec/miniconda3/lib/python3.8/tempfile.py", line 814, in _rmtree
    _shutil.rmtree(name, onerror=onerror)
  File "/home/chovanec/miniconda3/lib/python3.8/shutil.py", line 719, in rmtree
    onerror(os.rmdir, path, sys.exc_info())
  File "/home/chovanec/miniconda3/lib/python3.8/shutil.py", line 717, in rmtree
    os.rmdir(path)
OSError: [Errno 39] Directory not empty: '/mnt/data/genomes/GRCh38.p13/tmp9a0mtqbf'

This an issue with tempfile.py. I added a try except block on line 243 - 304 of provider.py to allow the processing to finish. Its a silly error of not being able to delete the tmp dir, might be worth adding until they fix this in the TemporaryDirectory function.

Thanks for the problem AND a solution! I'll fix this in the next release.

Hi team,

In which version is this fixed? Currently encountering the issue...

It's in the develop branch. I'll check if we can push out a new version!