I’ve been trying to install Julia and its VSCode environment on a new Windows computer for a few days, but I can’t launch it. To figure out where the problem may be, I’ve been trying for about 5 days, knowing that:
- Firstly, I guessed the problem was the Windows environment, but as I changed the path of Julia installation into a pure ASCII one, it ran as usual. However, the Julia language server failed to launch in VSCode – so did the Jupyter notebook.
- I suspected that the problem also lay in the encoding of the path, and hence I created a new user without Chinese characters, and everything worked, at least in VSCode and Jupyter notebook.
- The error message of the original launching failure reads
ERROR: could not load library "C:\Users\lib\julia\sys.dll"
The specified module could not be found.
If I changed my directory into AppData
, the message became
ERROR: could not load library "C:\Users\���ئ�\lib\julia\sys.dll"
The specified module could not be found.
If I changed my working directory to Local
later on, the message became
ERROR: could not load library "C:\Users\���ئ�\AppData\lib\julia\sys.dll"
The specified module could not be found.
So I guessed that the Julia program wanted to find sys.dll
from …/lib/julia/sys.dll, which doesn’t make sense. It would have to be something like $SYSTEM_JULIA_PATH/lib/julia
, which I guessed the prefix was cut off because of the non-ASCII characters there. This problem did not occur with a full English username.
- Even if Julia is installed on a pure ASCII path (The default path contains non-ASCII characters, so I just switched to somewhere else.) and therefore worked well, it still failed in VSCode. The error log looks like the following.
Activating project at `c:\Users\我的名字\.vscode\extensions\julialang.language-julia-1.48.1\scripts\environments\languageserver\v1.9`
[ Info: Starting the Julia Language Server
ERROR: failed to emit output file �b�h�줸�ժ��ت��r�X�����A�S���o�� Unicode �r���i�H�����쪺�r���C
fatal: error thrown and no exception handler available.
ErrorException("cannot open system image file "c:\Users\?的名�\AppData\Roaming\Code\User\globalStorage\julialang.language-julia\lsdepot\v1\compiled\v1.9\JSON\jl_4322.tmp" for writing")
ijl_errorf at C:/workdir/src\rtutils.c:77
ijl_write_compiler_output at C:/workdir/src\precompile.c:143
ijl_atexit_hook at C:/workdir/src\init.c:258
jl_repl_entrypoint at C:/workdir/src\jlapi.c:718
mainCRTStartup at C:/workdir/cli\loader_exe.c:59
BaseThreadInitThunk at C:\Windows\System32\KERNEL32.DLL (unknown line)
RtlUserThreadStart at C:\Windows\SYSTEM32\ntdll.dll (unknown line)
ERROR: LoadError: Failed to precompile JSON [682c06a0-de6a-54ab-a142-c8b1cf79cde6] to "c:\\Users\\我的名字\\AppData\\Roaming\\Code\\User\\globalStorage\\julialang.language-julia\\lsdepot\\v1\\compiled\\v1.9\\JSON\\jl_4322.tmp".
Stacktrace:
[1] error(s::String)
@ Base .\error.jl:35
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
@ Base .\loading.jl:2300
[3] compilecache
@ .\loading.jl:2167 [inlined]
[4] _require(pkg::Base.PkgId, env::String)
@ Base .\loading.jl:1805
[5] _require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base .\loading.jl:1660
[6] macro expansion
@ .\loading.jl:1648 [inlined]
[7] macro expansion
@ .\lock.jl:267 [inlined]
[8] require(into::Module, mod::Symbol)
@ Base .\loading.jl:1611
[9] include
@ .\Base.jl:457 [inlined]
[10] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::String)
@ Base .\loading.jl:2049
[11] top-level scope
@ stdin:3
in expression starting at c:\Users\我的名字\.vscode\extensions\julialang.language-julia-1.48.1\scripts\packages\LanguageServer\src\LanguageServer.jl:1
in expression starting at stdin:3
The Language Server failed to precompile.
Please make sure you have permissions to write to the LS depot path at
c:\Users\我的名字\AppData\Roaming\Code\User\globalStorage\julialang.language-julia\lsdepot\v1
┌ Error: Some Julia code in the VS Code extension crashed
└ @ Main c:\Users\我的名字\.vscode\extensions\julialang.language-julia-1.48.1\scripts\error_handler.jl:15
ERROR: Failed to precompile LanguageServer [2b0e0bc5-e4fd-59b4-8912-456d1b03d8d7] to "c:\\Users\\我的名字\\AppData\\Roaming\\Code\\User\\globalStorage\\julialang.language-julia\\lsdepot\\v1\\compiled\\v1.9\\LanguageServer\\jl_41DA.tmp".
Stacktrace:
[1] top-level scope
@ c:\Users\我的名字\.vscode\extensions\julialang.language-julia-1.48.1\scripts\languageserver\main.jl:77
[2] include(mod::Module, _path::String)
@ Base .\Base.jl:457
Although I know I should avoid non-ASCII paths as much as possible, I wouldn’t change all the stuff and rebuild everything on my computer as those works are too expensive to rerun. As far as I know, the binary of Julia is compiled. I tried to fix the path encoding problem by modifying the source codes and recompiling it, but I have no idea where to start.
How to fix the problem fundamentally instead of discarding all my 99% work and restarting everything on my computer? As Julia claims to support Unicode and LaTeX symbols in its program, it’s a bit awkward to say it would fail to handle Unicode paths. Thanks a lot!
Now the advantage of using Mac comes out, as it will transform your usernames into pure ASCII characters while still displaying non-ASCII names on GUI as is, avoiding all these stuffs. However, Mac computers are too expensive for me to buy a new one.