Skip to content

run_sorter in container fails on Windows when recording is not on OS drive (D:) — in_container_sorting path malformed #3824

Open
@SpencerBowles

Description

@SpencerBowles

Summary

We encountered a failure when using spikeinterface.sorters.run_sorter(..., docker_image=...) on Windows 11, when the recording is stored on a secondary drive (D:). The sorter completes, and the container stops, but the loading of the result fails because the path to the serialized recording inside in_container_sorting is malformed — it lacks a drive letter and begins with a backslash.

I have tried overwriting the recording object path kwarg with a POSIX version of the path and it does not change the error.

This issue does not occur:

  • When running the same call without Docker (in Conda)
  • When the recording path is on the OS drive (C:)

System Info

  • Windows 11
  • SpikeInterface commit 9d6ad5b
  • Docker image: 'datajoint-spikeinterface:latest` (custom-built)
  • Base image: NVIDIA CUDA image (nvidia/cuda:11.7.1)
  • SpikeInterface installed from local copy

Here is the command as I run it:
sorting = run_sorter(sorter_name=sorter_name["name"], recording=recording, folder=output_path, installation_mode="folder", spikeinterface_folder_source=code_src[0], remove_existing_folder=True, verbose=True, docker_image=docker_image[0])

Error Trace:
ValueError: D:\NP_sorted_backup\...\cleaning\sorting\in_container_sorting is not a file or a folder. It should point to either a json, pickle file or a folder that is the result of extractor.save(...)
Inners tack trace:
FileNotFoundError: [Errno 2] No such file or directory: '\\NP_sorted_backup\\...\\cleaning\\binary.json'

I notice that the path structure is missing the drive information.

Here is the full error:

→ Populating SortingCompute
2025-03-27 12:03:20,918::INFO::sorting.py::Populating SortingCompute for ['Flea_2024-08-13_1'], key: {'recording_id': 1, 'doe': datetime.datetime(2024, 8, 13, 0, 0), 'attempt': 1, 'probe_id': 1, 'filtered': 1, 'clean_path': 'D:\\NP_sorted_backup\\2024-08-13_13-44-43_Flea_adaptation_implicit\\Record Node 101\\experiment1\\recording1\\continuous\\Neuropix-PXI-100.ProbeA\\cleaning', 'id': 1}
Fixed folder_path: D:/NP_sorted_backup/2024-08-13_13-44-43_Flea_adaptation_implicit/Record Node 101/experiment1/recording1/continuous/Neuropix-PXI-100.ProbeA/cleaning
True
2025-03-27 12:03:20,929::INFO::sorting.py::Saving new sorted recording to D:\NP_sorted_backup\2024-08-13_13-44-43_Flea_adaptation_implicit\Record Node 101\experiment1\recording1\continuous\Neuropix-PXI-100.ProbeA\cleaning\sorting.
Starting container
Running kilosort4 sorter inside spencer/datajoint-spikeinterface:latest
Stopping container
2025-03-27 22:02:19,578::WARNING::sorting.py::Unexpected error in the recording processing pipeline: D:\NP_sorted_backup\2024-08-13_13-44-43_Flea_adaptation_implicit\Record Node 101\experiment1\recording1\continuous\Neuropix-PXI-100.ProbeA\cleaning\sorting\in_container_sorting is not a file or a folder. It should point to either a json, pickle file or a folder that is the result of extractor.save(...)
Traceback (most recent call last):
  File "C:\Users\mathi\anaconda3\envs\si_env_rolling\Lib\site-packages\spikeinterface\sorters\runsorter.py", line 667, in run_sorter_container
    sorting = SorterClass.get_result_from_folder(folder)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mathi\anaconda3\envs\si_env_rolling\Lib\site-packages\spikeinterface\sorters\basesorter.py", line 334, in get_result_from_folder
    recording = cls.load_recording_from_folder(output_folder, with_warnings=False)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mathi\anaconda3\envs\si_env_rolling\Lib\site-packages\spikeinterface\sorters\basesorter.py", line 212, in load_recording_from_folder
    recording = load_extractor(json_file, base_folder=output_folder)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mathi\anaconda3\envs\si_env_rolling\Lib\site-packages\spikeinterface\core\base.py", line 1184, in load_extractor
    return BaseExtractor.load(file_or_folder_or_dict, base_folder=base_folder)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mathi\anaconda3\envs\si_env_rolling\Lib\site-packages\spikeinterface\core\base.py", line 769, in load
    extractor = BaseExtractor.from_dict(d, base_folder=base_folder)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mathi\anaconda3\envs\si_env_rolling\Lib\site-packages\spikeinterface\core\base.py", line 515, in from_dict
    extractor = _load_extractor_from_dict(dictionary)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mathi\anaconda3\envs\si_env_rolling\Lib\site-packages\spikeinterface\core\base.py", line 1123, in _load_extractor_from_dict
    extractor = extractor_class(**new_kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mathi\anaconda3\envs\si_env_rolling\Lib\site-packages\spikeinterface\core\binaryfolder.py", line 31, in __init__
    with open(folder_path / "binary.json", "r") as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '\\NP_sorted_backup\\2024-08-13_13-44-43_Flea_adaptation_implicit\\Record Node 101\\experiment1\\recording1\\continuous\\Neuropix-PXI-100.ProbeA\\cleaning\\binary.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\mathi\github\auxPipelines-DataJoint_Mathis\neuropixels\neuropixels_schemas\np_pipeline\schemas\sorting.py", line 146, in make
    sorting = run_sorter(
              ^^^^^^^^^^^
  File "C:\Users\mathi\anaconda3\envs\si_env_rolling\Lib\site-packages\spikeinterface\sorters\runsorter.py", line 210, in run_sorter
    return run_sorter_container(
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mathi\anaconda3\envs\si_env_rolling\Lib\site-packages\spikeinterface\sorters\runsorter.py", line 670, in run_sorter_container
    sorting = load_extractor(in_container_sorting_folder)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mathi\anaconda3\envs\si_env_rolling\Lib\site-packages\spikeinterface\core\base.py", line 1184, in load_extractor
    return BaseExtractor.load(file_or_folder_or_dict, base_folder=base_folder)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mathi\anaconda3\envs\si_env_rolling\Lib\site-packages\spikeinterface\core\base.py", line 805, in load
    raise ValueError(error_msg)
ValueError: D:\NP_sorted_backup\2024-08-13_13-44-43_Flea_adaptation_implicit\Record Node 101\experiment1\recording1\continuous\Neuropix-PXI-100.ProbeA\cleaning\sorting\in_container_sorting is not a file or a folder. It should point to either a json, pickle file or a folder that is the result of extractor.save(...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    containerIssues related to container (docker/singularity) versions of sorters

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions