Packages on GitHub that I can never download

julia newbie, there are some packages on GitHub that I can never download, some code packages are unregistered, can I install them by downloading the source code files from GitHub, or use them locally.

1 Like

You can use the command

using Pkg
Pkg.add("https://github.com/JuliaMusic/PortMidi.jl")  
# replace link with the repository you want to add

See also: 3. Managing Packages · Pkg.jl

1 Like

I’ve tried downloading from the URL, but it results in a timeout error.

If you download the tarball, you can then untar it. You can then use Pkg.develop to install it.

using Pkg
Pkg.develop("/path/to/untarred/pkg")
1 Like

Could you share the URL link (if it is something public) and maybe the error message? There are many sources of errors (e.g. maybe the source is not a module, etc).

3 Likes

(@v1.8) pkg> add GitHub - rened/QuickShiftClustering.jl: Fast hierarchical medoid clustering
Cloning git-repo https://github.com/rened/QuickShiftClustering.jl.git
ERROR: failed to clone from GitHub - rened/QuickShiftClustering.jl: Fast hierarchical medoid clustering, error: GitError(Code:ERROR, Class:OS, failed to send request: 操作超时

This repository is not a package (as it misses the Project.toml file).

The easiest thing you can do is to clone it locally (directly with git or as a zip download).

Then you could either open that folder and call include("src/QuickShiftClustering.jl") and then load it with

using .QuickShiftClustering

If you want to use it in another project, you can also just copy the QuickShiftClustering.jl file into your project and include it.

Of course, the best approach would be to add a Project.toml to their folder and actually update their repository. Then also, the Pkg.develop command could be used, and you can include it in any of your projects via using QuickShiftClustering without the need to copy files or change file paths.

2 Likes

This is a very old package and the REQUIRE file states a julia version of 0.5. I would expect them to not work when you will include them in Julia 1.x. If you would like to update the package to Julia 1.x I would recommend to start by running the code on Julia 0.5 and then use julia 0.6 and 0.7 as steps so that you get the deprecation warnings.
You can easily install the old versions of Julia with juliaup add versionnumber

The Error that we get there seems to be very misleading. Maybe we can get an error message saying this does not seem to be a julia package.

5 Likes

I think the error isn’t complaining about it not being a proper and up to date package but actually is some kind of connection problem to GitHub.

When I try it I get

(jl_xM8dfq) pkg> add https://github.com/rened/QuickShiftClustering.jl.git
     Cloning git-repo `https://github.com/rened/QuickShiftClustering.jl.git`
    Updating git-repo `https://github.com/rened/QuickShiftClustering.jl.git`
ERROR: could not find project file (Project.toml or JuliaProject.toml) in package at `https://github.com/rened/QuickShiftClustering.jl.git` maybe `subdir` needs to be specified

which, except for the incorrect guess at the end, is accurate enough.

1 Like

No it is stating that it cannot find the Project.toml. Connection Github is fine, which is why a git clone ... will work but git add .. will not.

If it is not a package I don’t think the package manager can add it.

Kind regards

I’m referring to

which looks very much like a failure to clone.

1 Like

Got it, my bad :blush:

I have found a solution, which is to use Pkg.develop() . Thank everyone all. I think the include method is also good.

After running Pkg.develop(“/path/to/untarred/pkg”), can the downloaded package file be deleted or moved to a different location?

The path path/to/untarred/pkg must stay there.

If it were a git repository and you did Pkg.add then you could remove it.

Thanks

One of the problems here is most likely that the “great firewall of China” is blocking connections to GitHub

1 Like