imantha
imantha

Reputation: 3828

Julia adding package from github

I want to install the following package from github. I tried using the following command in my environment to install

(nlpEnvJl) pkg> add "https://github.com/yeesian/LeafletJS.jl/tree/master/src"

But I get the following error,

ERROR: could not find project file in package at https://github.com/yeesian/LeafletJS.jl maybe subdir needs to be specified

Any ideas on how I can get installed? Do I have to clone it first to my local repo? If so how do I install from local path?

Cheers Thanks in advance

Upvotes: 17

Views: 16779

Answers (2)

Daniel Molina
Daniel Molina

Reputation: 341

You do not need to install locally, but you have to put the URL official to clone it.

add https://github.com/yeesian/LeafletJS.jl.git

Sometimes, if the package is already registered and you only want the main version in github you can directly do

add PackageName#main

Upvotes: 20

Oskar
Oskar

Reputation: 1460

You have to clone it locally and then use Pkg.generate in order to import it as a package. It needs a Project.toml file to be added.

Thus, you have to:

$ git clone [email protected]:yeesian/LeafletJS.jl.git                                                                                                                                                                                       
Cloning into 'LeafletJS.jl'...
remote: Enumerating objects: 59, done.
remote: Total 59 (delta 0), reused 0 (delta 0), pack-reused 59
Receiving objects: 100% (59/59), 14.83 KiB | 197.00 KiB/s, done.
Resolving deltas: 100% (22/22), done.
$ julia  
 
(@v1.5) pkg> generate LeafletJS
 Generating  project LeafletJS:
    LeafletJS/Project.toml
    LeafletJS/src/LeafletJS.jl

$ cp -r LeafletJS.jl/* LeafletJS/.                                                                                                                                                                                                        
$ cd LeafletJS                                                                                                                                                                                                                            
LeafletJS $ julia  

(@v1.5) pkg> dev .
[ Info: Resolving package identifier `.` as a directory at `/tmp/jl_temp/LeafletJS/`.
Path `.` exists and looks like the correct package. Using existing path.
  Resolving package versions...
Updating `~/.julia/environments/v1.5/Project.toml`
  [b1ddfcb9] + LeafletJS v0.1.0 `../../../../../tmp/jl_temp/LeafletJS`
Updating `~/.julia/environments/v1.5/Manifest.toml`
  [b1ddfcb9] + LeafletJS v0.1.0 `../../../../../tmp/jl_temp/LeafletJS`

Upvotes: 9

Related Questions