Pkg.jl icon indicating copy to clipboard operation
Pkg.jl copied to clipboard

`Pkg.activate()` doesn't seem to activate the home package

Open jishnub opened this issue 2 years ago • 0 comments

In a project directory at

abcd/ $ pwd
/home/jishnu/Dropbox/JuliaPackages/abcd

I launch julia using

abcd/ $ julia-1.8 --project=.

In julia

julia> LOAD_PATH
4-element Vector{String}:
 "@"
 "/tmp/jl_ztlVMr"
 "@v#.#"
 "@stdlib"

julia> Base.active_project()
"/home/jishnu/Dropbox/JuliaPackages/abcd/Project.toml"

julia> using OffsetArrays
 │ Package OffsetArrays not found, but a package named OffsetArrays is available from a registry. 
 │ Install package?
 │   (abcd) pkg> add OffsetArrays 
 └ Select environment:
   1: `~/Dropbox/JuliaPackages/abcd/Project.toml` (@)
 > 2: `/tmp/jl_ztlVMr` (/tmp/jl_ztlVMr)
   3: `~/.julia/environments/v1.8/Project.toml` (@v#.#)
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
    Updating `/tmp/jl_ztlVMr/Project.toml`
  [6fe1bfb0] + OffsetArrays v1.12.7
    Updating `/tmp/jl_ztlVMr/Manifest.toml`
  [79e6a3ab] + Adapt v3.3.3
  [6fe1bfb0] + OffsetArrays v1.12.7
  [56f22d72] + Artifacts
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [e66e0078] + CompilerSupportLibraries_jll v0.5.2+0
  [4536629a] + OpenBLAS_jll v0.3.20+0
  [8e850b90] + libblastrampoline_jll v5.1.0+0

julia> Base.active_project()
"/home/jishnu/Dropbox/JuliaPackages/abcd/Project.toml"

julia> Base.current_project()
"/home/jishnu/Dropbox/JuliaPackages/abcd/Project.toml"

julia> using Pkg; Pkg.activate()
  Activating project at `/tmp/jl_ztlVMr`

julia> Base.active_project()
"/tmp/jl_ztlVMr/Project.toml"

julia> versioninfo()
Julia Version 1.8.0-rc1
Commit 6368fdc656 (2022-05-27 18:33 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: 8 × 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, tigerlake)
  Threads: 1 on 8 virtual cores
Environment:
  LD_LIBRARY_PATH = :/usr/lib/x86_64-linux-gnu/gtk-3.0/modules
  JULIA_EDITOR = vim

The docstring says "If no argument is given to activate, then activate the home project. The home project is specified by either the --project command line option to the julia executable, or the JULIA_PROJECT environment variable.". In this case, the specified --project flag is not being activated anymore, and JULIA_PROJECT is not set. In this case, Pkg.activate() should not change the path at all, as the home project is already activated.

jishnub avatar Jul 07 '22 13:07 jishnub