Installation troubles

I am on Windows64, Julia 1.4.0, using VS Code.

(1) In the terminal:

julia> using HTTP
julia> HTTP.get("http://google.com")
HTTP.Messages.Response: HTTP/1.1 200 OK ...

(2) Executing my program returns in the output window:

ERROR: LoadError: ArgumentError: Package HTTP not found 
in current path: - Run `import Pkg; Pkg.add("HTTP")` 

How is this possible? How to fix it?

Check your VS Code/Julia extension settings for “Environment Path” and “Executable Path” and check if this matches what you have in your REPL (see lower blue status line for Julia env).
This is what comes to my mind as what may be wrong.

1 Like

I would try:

]
activate .
add HTTP

My guess is your program is using it’s own environment and that environment doesn’t have HTTP…

Thanks! I have two environments:

Julia env: v1.4
Julia env: myproject.jl

In settings.json

Julia:Executable Path points to Julia-1.4.0\bin\julia.exe
Julia:Environment is not in settings.json.

The latter may be the error. What is the exact syntax of what I should insert in settings.json?

e.g.
“julia.environmentPath”: “C:\Users\USER\.julia\environments\v1.4”

There is also a launch.json file which lets you modify your running environment, it looks like:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "julia",
            "request": "launch",
            "name": "Run active Julia file",
            "program": "${file}",
            "stopOnEntry": false,
            "cwd": "${workspaceFolder}",
            "juliaEnv": "${command:activeJuliaEnvironment}"
        }
    ]
}

Maybe you have modified that and forgot it?

But I can’t tell what the right settings are for you, as I don’t know which environments you are using. Check also @pixel27 suggestion.