[Python] Trouble creating a dataset from h5 file

Discussão em 'Python' iniciado por Stack, Outubro 2, 2024.

  1. Stack

    Stack Membro Participativo

    I'm having a problem regarding the h5 file. Whenever I try to load it I get this error:

    OSError: Can't read data (can't open directory: /opt/conda/envs/AE4353/lib/hdf5/plugin)


    I can read the file without any problem, I'm providing the right path and I have everything I need installed. However when I try to run a simple code such as the following I get the error above.

    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)


    Considering the error I tried to install the plugin but I get this error:

    (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.


    So I went to the terminal and tried to install the specific plugin, getting the following message:

    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)


    Afterwards I tried to install the hdf5plugin separately which actually downloaded and installed it:

    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


    But in the end I kept getting the same error on vscode, any ideas how I can solve this?

    Continue reading...

Compartilhe esta Página