Is it possible to "using" or "import” specific version of a registered package

I just want to know whether it is possible to “using” or "import” the latest version of a registered package of which the version installed in a local machine is limited to the obsolescence by other installed packages.

For detail control of your project’s dependency, you should read Pkg · The Julia Language and 1. Introduction · Pkg.jl.

Are you using some package which require outdated package? I’m not good at English but your question sounds not clear.

Yes, I have several packages with outdated versions, and unable to upgrade, due to dependencies by other packages. I think it might be convenient to call for the latest version via a syntax like “import package@1.0.0”

You cannot force install a package version that is incompatible with other packages in your environment. That’s the whole point of compatibility entries.

If package B is blocking higher versions of package A, the only way of upgrading package A is to remove package B from your environment (or resolving the incompatibility, meaning a PR to package B).

1 Like

Well, I think it could be much better that Julia can identify the latest version on demand. It seem not “impartial” to compellingly use an outdated package only limited by a or several specific ones

Very often, the reason why this happens is related to a cluttered global environment. In Julia, you can never have two different versions of the same package loaded – however it is possible to have multiple versions of the same package installed.

You normally create local environments for your different projects. For more information, see this short introduction or the official docs.
In each environment, you can install the latest compatible version using ] add Package, a specific version ] add Package@v1.1 or even a specific tag or branch (i.e. a a non merged PR for some package) ] add Package#pr-branch.

6 Likes

The reason Julia won’t let you do that is because the developers of these packages figured out that things would break if you did that – that’s why they put the restrictions (called “compat” for compatability) on the installable versions.

If you want to get around that different environments, as explained above, could help (that way the versions which clash don’t get in contact).

2 Likes

Got it, that solves my problem!