Issue with HDBrainExtraction Tool Not Completing – Error Message Appears

Hi everyone,

I’m encountering an issue while using the HDBrainExtraction tool. After selecting the source and output volume and clicking Apply, the process fails to complete. Instead, I get the pop-up error message shown in the attached screenshot.

I’m also posting two texts for reference:

  • The next one contains the output shown when clicking the “Show details” button in the error message:
Traceback (most recent call last):
  File "C:\Users\mrasf\AppData\Local\slicer.org\Slicer 5.8.1\bin\Python\slicer\util.py", line 3303, in tryWithErrorDisplay
    yield
  File "C:/Users/mrasf/AppData/Local/slicer.org/Slicer 5.8.1/slicer.org/Extensions-33241/HDBrainExtraction/lib/Slicer-5.8/qt-scripted-modules/HDBrainExtractionTool.py", line 227, in onApplyButton
    self.logic.setupPythonRequirements()
  File "C:/Users/mrasf/AppData/Local/slicer.org/Slicer 5.8.1/slicer.org/Extensions-33241/HDBrainExtraction/lib/Slicer-5.8/qt-scripted-modules/HDBrainExtractionTool.py", line 308, in setupPythonRequirements
    slicer.util.pip_install('batchgenerators')
  File "C:\Users\mrasf\AppData\Local\slicer.org\Slicer 5.8.1\bin\Python\slicer\util.py", line 3942, in pip_install
    _executePythonModule("pip", args)
  File "C:\Users\mrasf\AppData\Local\slicer.org\Slicer 5.8.1\bin\Python\slicer\util.py", line 3896, in _executePythonModule
    logProcessOutput(proc)
  File "C:\Users\mrasf\AppData\Local\slicer.org\Slicer 5.8.1\bin\Python\slicer\util.py", line 3862, in logProcessOutput
    raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
subprocess.CalledProcessError: Command '['C:/Users/mrasf/AppData/Local/slicer.org/Slicer 5.8.1/bin/../bin\\PythonSlicer.EXE', '-m', 'pip', 'install', 'batchgenerators']' returned non-zero exit status 1.
  • The other is the Python Console log at the time of the error:
Collecting batchgenerators
  Using cached batchgenerators-0.25.1.tar.gz (76 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: pillow>=7.1.2 in c:\users\mrasf\appdata\local\slicer.org\slicer 5.8.1\lib\python\lib\site-packages (from batchgenerators) (10.3.0)
Requirement already satisfied: numpy>=1.10.2 in c:\users\mrasf\appdata\local\slicer.org\slicer 5.8.1\lib\python\lib\site-packages (from batchgenerators) (1.26.4)
Requirement already satisfied: scipy in c:\users\mrasf\appdata\local\slicer.org\slicer 5.8.1\lib\python\lib\site-packages (from batchgenerators) (1.13.1)
Collecting scikit-image (from batchgenerators)
  Using cached scikit_image-0.24.0-cp39-cp39-win_amd64.whl.metadata (14 kB)
Collecting scikit-learn (from batchgenerators)
  Using cached scikit_learn-1.6.1-cp39-cp39-win_amd64.whl.metadata (15 kB)
Collecting future (from batchgenerators)
  Using cached future-1.0.0-py3-none-any.whl.metadata (4.0 kB)
Collecting pandas (from batchgenerators)
  Using cached pandas-2.3.0.tar.gz (4.5 MB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'error'
  error: subprocess-exited-with-error

  Preparing metadata (pyproject.toml) did not run successfully.
  exit code: 1

  [10 lines of output]
  + meson setup C:\Users\mrasf\AppData\Local\Temp\pip-install-0i038abm\pandas_a4d32aa1603d435e9c1558c96e77e301 C:\Users\mrasf\AppData\Local\Temp\pip-install-0i038abm\pandas_a4d32aa1603d435e9c1558c96e77e301\.mesonpy-6sv7bkf5 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --vsenv --native-file=C:\Users\mrasf\AppData\Local\Temp\pip-install-0i038abm\pandas_a4d32aa1603d435e9c1558c96e77e301\.mesonpy-6sv7bkf5\meson-python-native-file.ini
  The Meson build system
  Version: 1.8.1
  Source dir: C:\Users\mrasf\AppData\Local\Temp\pip-install-0i038abm\pandas_a4d32aa1603d435e9c1558c96e77e301
  Build dir: C:\Users\mrasf\AppData\Local\Temp\pip-install-0i038abm\pandas_a4d32aa1603d435e9c1558c96e77e301\.mesonpy-6sv7bkf5
  Build type: native build

  ..\meson.build:2:0: ERROR: Could not find C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe

  A full log can be found at C:\Users\mrasf\AppData\Local\Temp\pip-install-0i038abm\pandas_a4d32aa1603d435e9c1558c96e77e301\.mesonpy-6sv7bkf5\meson-logs\meson-log.txt
  [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Encountered error while generating package metadata.

See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
[Python] Failed to compute results.
[Python] Command '['C:/Users/mrasf/AppData/Local/slicer.org/Slicer 5.8.1/bin/../bin\\PythonSlicer.EXE', '-m', 'pip', 'install', 'batchgenerators']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "C:/Users/mrasf/AppData/Local/slicer.org/Slicer 5.8.1/slicer.org/Extensions-33241/HDBrainExtraction/lib/Slicer-5.8/qt-scripted-modules/HDBrainExtractionTool.py", line 227, in onApplyButton
    self.logic.setupPythonRequirements()
  File "C:/Users/mrasf/AppData/Local/slicer.org/Slicer 5.8.1/slicer.org/Extensions-33241/HDBrainExtraction/lib/Slicer-5.8/qt-scripted-modules/HDBrainExtractionTool.py", line 308, in setupPythonRequirements
    slicer.util.pip_install('batchgenerators')
  File "C:\Users\mrasf\AppData\Local\slicer.org\Slicer 5.8.1\bin\Python\slicer\util.py", line 3942, in pip_install
    _executePythonModule("pip", args)
  File "C:\Users\mrasf\AppData\Local\slicer.org\Slicer 5.8.1\bin\Python\slicer\util.py", line 3896, in _executePythonModule
    logProcessOutput(proc)
  File "C:\Users\mrasf\AppData\Local\slicer.org\Slicer 5.8.1\bin\Python\slicer\util.py", line 3862, in logProcessOutput
    raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
subprocess.CalledProcessError: Command '['C:/Users/mrasf/AppData/Local/slicer.org/Slicer 5.8.1/bin/../bin\\PythonSlicer.EXE', '-m', 'pip', 'install', 'batchgenerators']' returned non-zero exit status 1.


Any suggestions for resolving this?

Thanks in advance!

It is trying to install latest pandas, but the pandas maintainers made a mistake in their most recent 2.3.0 release that came out yesterday (see issue linked below). The release notes specify that their intention was for this release to require Python 3.10 or newer, but their configuration stated that it was still Python 3.9 or newer. There are no Python 3.9 wheels for pandas 2.3.0 based on their intention to not support this python version.

For Slicer 5.8.1 you can instead call slicer.util.pip_install("pandas<2.3.0") to resolve this issue with HDBrainExtraction.

It seems like pandas may ultimately provide Python 3.9 wheels for version 2.3.0 since their own testing seemed to pass on Python 3.9. You could monitor the following PR. Maybe they will release a 2.3.1 soon that states that will still support Python 3.9 for one last time.

For Slicer Preview, you will soon not have to do this workaround as Slicer is moving from using Python 3.9 to Python 3.12 (see PR below). It is not the first time that some python packages have dropped Python 3.9 support, but then did not appropriately update their configurations to state this as well.

1 Like

Thanks James, it’s working now!

1 Like

Looks like the pandas developers have now uploaded the Python 3.9 whls for version 2.3.0 even though they originally intended not to for this version. Therefore the workaround of forcing a earlier version is no longer needed.

1 Like