'Installing packages in Julia while using Pluto

I would like to use the package HDF5

In my Pluto.jl, I have the line

using HDF5

When I try to evaluate this cell, I get the error message

"ERROR: LoadError: HDF5 is not properly installed. Please run Pkg.build("HDF5") and restart Julia."

I would like to do this, but when I go to the terminal, I can't do this while I have Pluto open.

I've tried running Pluto in the background with a command like

Pluto.run() &

But this code is completely wrong.

I've also heard that there sometimes appears a cloud icon above the cell, which would allow me to download HDF5 directly.

In any case, it seems to me like any time this happens, I will have to write down which package I need to install, and then kill my Pluto notebook, go to Julia, install, and restart Julia. Surely there is a better way? Can anyone help me find it?



Solution 1:[1]

When the package is correctly installed or could be installed without problems, using HDF5 in Pluto itself is sufficient. The built-in Pluto package manager takes care about the installation.

There are edge cases where due to issues with external packages installation does not work out-of-the-box. In this case, it could help to install the package in a temp environment before starting Pluto:

] activate --temp
] add HDF5

follwed by whatever steps required to get the package working in Julia itself, like re-building it.

This should really be a workaround and should be fixed in the corresponding package - consider creating an Issue there if it does not exist already.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 lungben