Why do I have to install PGFPlotsX manually?

After adding and importing a package that has PGFPlotsX as a dependency, and checking that the dependency has been added to my environment’s Manifest (confirmed by entering st -m in package mode), I get an error when calling a function from the package that calls pgfplotsx(); I’m obligated to add that plotting back end to my environment manually. This doesn’t happen with other dependent packages, just PGFPlotsX.

Can you be more specific on the package in question and the error that you get? Do you have a minimum working example?

Adding a dependency to your Manifest.toml doesn’t mean it will be installed automatically. You need to run instantiate in Pkg mode to install all dependencies.

I might misunderstand your issue but in general you shouldn’t expect to be able to use any functionality of dependencies of packages you are using, for this to work the package you are using has to reexport the names of its dependencies.

As an example, CSV depends on Tables but you can’t use eg columntable after doing using CSV. You are able to do Tables.columntable() though to access the unexported functionality of the dependency. On the other hand, DataFramesMeta depends on DataFrames and reexports the whole package, so using DataFramesMeta will make all of DataFrames available.


As I said,

I don’t expect to be able to call pgfplotsx() myself without installing and importing it.

It would be much easier to diagnose with a reproducible example. My best guess is that it could be something to do with package extensions, but that might be completely off.

1 Like

Well, after upgrading this problem seems to have gone away. It may have had something to do with the bug that was exercised when using Plots with PGFPlotsX, that was fixed in v1.38.12 . Thanks for your help, and sorry for the bother.

Indeed. Not loading a dependency unless it is explicitly added to the project is a feature, not a bug.

Packages can change their dependencies in ways that do not involve the exposed API with changes in the patch version (eg recently I replaced uses of UnPack.jl with SimpleUnPack.jl in various packages), so one cannot rely on dependencies being available.

1 Like