In VSCode I have installed two packages in the default @v1.11
environment:
But when I opened Windows Powershell to start julia
and typed ] st
I found there is nothing:
Why?
In VSCode I have installed two packages in the default @v1.11
environment:
But when I opened Windows Powershell to start julia
and typed ] st
I found there is nothing:
Why?
What’s more, if I open a project folder and open Windows PowerShell here, then type julia
to start julia and type ] activate .
, nothing will happen:
while if I do so in VSCode, things will go as expectation.
Not an answer to your question, but I would not use Julia in Powershell, I would prefer to use Bash. If you have installed gitforwindows, then you also have a bash shell on Windows. Best to use together with WindowsTerminal.
This is not a case of packages disappearing, but rather of your Powershell not printing any output - even if your default environment doesn’t exist, you should get
(@v1.10) pkg> st
Status `~/.julia/environments/v1.10/Project.toml` (empty project)
rather than no output at all.
How to set the default environment then? On my old PC I could use Julia in both VSCode and PowerShell in a same fashion but on this new PC things changed.
My point is that there seems to be something broken with your Julia install or Powershell, this isn’t actually a problem about setting the default environment. Both ]st
and ] activate .
should print something, but you’re not getting any output,.
Are you using WindowsTerminal? If not, please try that out.
Yes, I am using Win11 and it is a newly installed system. What’s different is that this was my first time trying to install julia via command prompt according to Download Julia. And I found that this seems to install julia only for the current user accoun but not for all users of this computer.
Get-ChildItem Env:
in both vscode and terminal and compare output
No, this isn’t surprising - you have installed the release
channel, not the 1.11.1
channel. Currently, the release
channel provides you with version 1.11.1 as that is the latest release, if you want to remove that you have to remove release
, not remove the specific version.
Thank you! Maybe I already know what the problem is – I created the config\startup.jl
file in the C:\Users\myname\.julia
directory, following my previous usage habits. Now when I removed config\startup.jl
, I found that Julia REPL in PowerShell worked fine.
But now the new question is, what is the proper way to configure the startup.jl
file when using Juliaup?
There’s no difference in the usage of startup.jl
as far as I’m aware - this is where my startup.jl
has always lived, before I started using juliaup
and still does today.
If you do think it’s your startup that messes with the output you get from Pkg
mode you should probably try to isolate the problem by starting with an empty startup file and adding things back in one-by-one.
Good idea. I’ll have a try.
The problem is in the following code of startup.jl
(the using OhMyREPL
part, to be precise), but I don’t know why. The using Revise
part works well. And they all worked well on my old PC.
atreplinit() do repl
try
@eval using OhMyREPL
println("`using OhMyREPL`\t ✔")
catch e
@warn "`using OhMyREPL`\t ✘" e
end
try
@eval using Revise
println("`using Revise`\t ✔")
catch e
@warn "`using Revise`\t ✘" e
end
end
┌ Warning: `using OhMyREPL` ✘
│ e =
│ InitError: UndefRefError: access to undefined reference
│ during initialization of module REPLExt
This seems to be a 1.11 regression that only happens with a custom JULIA_DEPOT_PATH
: REPLExt: no method matching repl_init(::REPL.LineEditREPL) when loading packages in REPL mode. · Issue #56216 · JuliaLang/julia · GitHub
On 1.11.1 I get the repl_init
MethodError and then the Pkg REPL doesn’t work, unless I run using Pkg
first.
On the 1.11 release branch the MethodError goes away due to REPLExt: check for compliant repl mode during repl init by IanButterworth · Pull Request #4067 · JuliaLang/Pkg.jl · GitHub but I still need to do using Pkg
to get a functional Pkg REPL.
❯ julia +pr56658
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.11.1 (2024-11-22)
_/ |\__'_|_|_|\__'_| | topolarity:ct/revert-08d229f-1.11/79b1263b43 (fork: 530 commits, 286 days)
|__/ |
(@v1.11) pkg> st
(@v1.11) pkg> add Example
julia> using Pkg
Precompiling Pkg...
13 dependencies successfully precompiled in 45 seconds. 10 already precompiled.
Precompiling REPLExt...
1 dependency successfully precompiled in 6 seconds. 26 already precompiled.
(@v1.11) pkg> st
Status `A:\.julia\environments\v1.11\Project.toml`
[9b6a8646] AllocCheck v0.2.0
[6e4b80f9] BenchmarkTools v1.5.0
[295af30f] Revise v3.6.4
julia> versioninfo()
Julia Version 1.11.1
Commit 79b1263b43 (2024-11-22 19:04 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 24 × 12th Gen Intel(R) Core(TM) i7-12800HX
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, alderlake)
Threads: 12 default, 0 interactive, 6 GC (on 24 virtual cores)
Environment:
JULIA_DEPOT_PATH = a:\.julia
JULIA_EDITOR = code
JULIA_NUM_THREADS = 12
JULIA_PKG_PRESERVE_TIERED_INSTALLED = true
JULIA_PKG_USE_CLI_GIT = true
JULIA_PROJECT = @.
I just switched to a custom JULIA_DEPOT_PATH
since I moved it into Windows Dev Drive.
Starting with --startup=no
to avoid loading Revise and then precompiling the environment seems to have fixed this for me just now, I cannot reproduce the error anymore.