Проблема с созданием набора данных из файла h5.Python

Программы на Python
Anonymous
Проблема с созданием набора данных из файла h5.

Сообщение Anonymous »

У меня возникла проблема с файлом h5. Всякий раз, когда я пытаюсь загрузить его, я получаю эту ошибку:

Код: Выделить всё

OSError: Can't read data (can't open directory: /opt/conda/envs/AE4353/lib/hdf5/plugin)
Я могу прочитать файл без проблем, я указываю правильный путь, и у меня установлено все необходимое. Однако когда я пытаюсь запустить простой код, подобный следующему, я получаю вышеуказанную ошибку.

Код: Выделить всё

def load_h5_file(h5_file_path):
with h5py.File(h5_file_path, "r") as file:
images = file["images"][:]
targets = file["targets"][:]

Images = torch.tensor(images)
Targets = torch.tensor(targets)

return Images, Targets

load_h5_file(h5_file_path)
Учитывая ошибку, я пытался установить плагин, но получаю следующую ошибку:

Код: Выделить всё

(AE4353_user_env) vscode ➜ /workspaces/AE4353-Y24 (main) $ conda install -c conda-forge hdf5-plugin
Channels:
- conda-forge
- defaults
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

- hdf5-plugin

Current channels:

- https://conda.anaconda.org/conda-forge
- defaults

To search for alternate channels that may provide the conda package you're
looking for, navigate to https://anaconda.org and use the search bar at the top of the page.
Я подошел к терминалу и попытался установить конкретный плагин, получив следующее сообщение:

Код: Выделить всё

Requirement already satisfied: h5py[hdf5plugin] in /home/kibangadas/.local/lib/python3.8/site-packages (3.11.0)
WARNING: h5py 3.11.0 does not provide the extra 'hdf5plugin'
Requirement already satisfied: numpy>=1.17.3 in /home/kibangadas/.local/lib/python3.8/site-packages (from h5py[hdf5plugin]) (1.24.4)
После этого я попытался установить плагин hdf5 отдельно, который фактически загрузил и установил его:

Код: Выделить всё

Collecting hdf5plugin
Downloading hdf5plugin-5.0.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (45.6 MB)
|████████████████████████████████| 45.6 MB 14.1 MB/s
Requirement already satisfied: h5py>=3.0.0 in /home/kibangadas/.local/lib/python3.8/site-packages (from hdf5plugin) (3.11.0)
Requirement already satisfied: numpy>=1.17.3 in /home/kibangadas/.local/lib/python3.8/site-packages (from h5py>=3.0.0->hdf5plugin) (1.24.4)
Installing collected packages: hdf5plugin
Successfully installed hdf5plugin-5.0.0
Но в конце концов я продолжал получать ту же ошибку на vscode, есть идеи, как я могу это решить?

Подробнее здесь: https://stackoverflow.com/questions/790 ... om-h5-file

Вернуться в «Python»