How can I use PyPlot, Images, Image IO and Flux.Data in Julia version 1.11.4. Running the Pkg.add(“PyPlot”) seems not to include all packages such as PyCall.
How do you determine that? What errors do you get when using PyPlot?
When you do
Pkg.add("PyPlot")
PyPlot
adds PyCall
as a dependency so that it can use the PyCall
to call 'matplotlibbut it is not directly visible to you as a user. If you try to
import` it, the REPL you ask you to install it, depending on the julia version.
julia> import Pkg; Pkg.add("PyPlot")
julia> using PyPlot
julia> plot(randn(100)) # This works
1-element Vector{PyCall.PyObject}:
PyObject <matplotlib.lines.Line2D object at 0x78eedc054ef0>
julia> using PyCall
│ Package PyCall not found, but a package named PyCall is available from a registry.
│ Install package?
│ (pyplot) pkg> add PyCall
└ (y/n/o) [y]:
In older versions of Julia (don’t remember up to which) you would get an error.
can not access it directly. You need to add PyCall
as well.
Paulo
Thank you, for the reply but have used Flux.Data in Julia as well?
The reply I am receiving is that PyPlot is not found in project, manifest or registry.
You can get that message either if you misspell the package, like I do here,
(@v1.11) pkg> add pyplot
ERROR: The following package names could not be resolved:
* pyplot (not found in project, manifest or registry)
or if there’s something wrong with your copy of the General registry. The latter may be difficult to diagnose but if you are confident you didn’t misspell the package name, it would be interesting to know what output you get from running
using Pkg
Pkg.Registry.status()
Pkg.Registry.rm("General")
Pkg.Registry.add("General")
Pkg.add("PyPlot")