Julia package Pkg not found

3.4k Views Asked by At

I have downloaded Julia-1.1.0 (from here), then I executed the binary file (julia-1.1.0/bin/julia) and in the prompt I type

using Pkg

Julia returns:

ERROR: ArgumentError: Package Pkg not found in current path:
- Run `import Pkg; Pkg.add("Pkg")` to install the Pkg package.

if I type Pkg.add("Pkg"), julia returns

ERROR: UndefVarError: Pkg not defined

How can I get Pkg to wotk?

Sorry for my english.

2

There are 2 best solutions below

0
Thomas Dickson On

In the comments to this question a SSL certificate error was mentioned. A solution on Linux (Ubuntu in my case) is to specify the location of the ssl certificates in the following manner;


julia> using LibGit2

julia> LibGit2.set_ssl_cert_locations("/etc/ssl/certs/ca-certificates.crt")

0
KeithWM On

I'm quite sure this was not the OP's issue, but it is the reason I ended up at this question, so I will share this nevertheless.

I have a deps/build.jl script that used Pkg. This deps folder had its own Project.toml, so it could build the package without first activating the package environment (which would not yet work). It appears I had to add Pkg as an explicit dependency of that deps/Project.toml for this to work.