Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access denied error when running TotalSegmentator #391

Open
nforwood opened this issue Nov 21, 2024 · 2 comments
Open

Access denied error when running TotalSegmentator #391

nforwood opened this issue Nov 21, 2024 · 2 comments

Comments

@nforwood
Copy link

Hi everyone, I was previously able to run the total segmentator but today I am getting an access denied error in the early stages of running.

The final message I get is
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\------\\AppData\\Local\\Temp\\tmp3sifet_4\\dicom

All of this code worked perfectly yesterday but today its failing. Ive checked that I have access to that folder and I tried to execute the code under an administrator account but I get the same error.

Any clues?

the full trace back is:

Traceback (most recent call last):
  File "C:\Program Files\Python312\Lib\multiprocessing\process.py", line 314, in _bootstrap
    self.run()
  File "C:\Program Files\Python312\Lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "c:\Users\-------\OneDrive -------\Research\Splenic Flexure\CT_segment.py", line 8, in foo
    totalsegmentator('451617//CT','451617//segments',fast=True)
  File "C:\Users\-------\OneDrive -------\Research\Splenic Flexure\.venv\Lib\site-packages\totalsegmentator\python_api.py", line 467, in totalsegmentator
    seg_img, ct_img, stats = nnUNet_predict_image(input, output, task_id, model=model, folds=folds,
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\-------\OneDrive -------t\Research\Splenic Flexure\.venv\Lib\site-packages\totalsegmentator\nnunet.py", line 341, in nnUNet_predict_image
    dcm_to_nifti(file_in, tmp_dir / "dcm" / "converted_dcm.nii.gz", tmp_dir, verbose=verbose)
  File "C:\Users\-------\OneDrive -------\Research\Splenic Flexure\.venv\Lib\site-packages\totalsegmentator\dicom_io.py", line 131, in dcm_to_nifti
    dicom2nifti.dicom_series_to_nifti(input_path, output_path, reorient_nifti=True)
  File "C:\Users\-------0\OneDrive -------\Research\Splenic Flexure\.venv\Lib\site-packages\dicom2nifti\convert_dicom.py", line 86, in dicom_series_to_nifti
    shutil.rmtree(temp_directory)
  File "C:\Program Files\Python312\Lib\shutil.py", line 781, in rmtree
    return _rmtree_unsafe(path, onexc)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\shutil.py", line 629, in _rmtree_unsafe
    onexc(os.rmdir, fullname, err)
  File "C:\Program Files\Python312\Lib\shutil.py", line 627, in _rmtree_unsafe
    os.rmdir(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\-------\\AppData\\Local\\Temp\\tmp3sifet_4\\dicom'
@wasserth
Copy link
Owner

Unfortunately I have no idea what the reason might be.

@recreateme
Copy link

run as admin when open pycharm may help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants