Error with using distributions package

HI
I am trying to use distribution package and I have an error as below
I am using window10 64bit, 4gRam.

[ Info: Precompiling Distributions [31c24e10-a181-5473-b8eb-7969acd0382f]
Cannot open cache file "C:\Users\?�승??.julia\compiled\v0.7\OrderedCollections\LtT3J.ji.a1339" for writing.
ERROR: LoadError: Failed to precompile OrderedCollections [bac558e1-5e72-5ebc-8fee-abe8a469f55d] to C:\Users\유승환\.julia\compiled\v0.7\OrderedCollections\LtT3J.ji.
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] macro expansion at .\logging.jl:313 [inlined]
 [3] compilecache(::Base.PkgId, ::String) at .\loading.jl:1185
 [4] _require(::Base.PkgId) at .\logging.jl:311
 [5] require(::Base.PkgId) at .\loading.jl:852
 [6] macro expansion at .\logging.jl:311 [inlined]
 [7] require(::Module, ::Symbol) at .\loading.jl:834
 [8] include at .\boot.jl:317 [inlined]
 [9] include_relative(::Module, ::String) at .\loading.jl:1038
 [10] include(::Module, ::String) at .\sysimg.jl:29
 [11] top-level scope at none:2
 [12] eval at .\boot.jl:319 [inlined]
 [13] eval(::Expr) at .\client.jl:399
 [14] top-level scope at .\none:3
in expression starting at C:\Users\유승환\.julia\packages\DataStructures\QE3iV\src\DataStructures.jl:16
ERROR: LoadError: Failed to precompile DataStructures [864edb3b-99cc-5e75-8d2d-829cb0a9cfe8] to C:\Users\유승환\.julia\compiled\v0.7\DataStructures\xKiwJ.ji.
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] macro expansion at .\logging.jl:313 [inlined]
 [3] compilecache(::Base.PkgId, ::String) at .\loading.jl:1185
 [4] _require(::Base.PkgId) at .\logging.jl:311
 [5] require(::Base.PkgId) at .\loading.jl:852
 [6] macro expansion at .\logging.jl:311 [inlined]
 [7] require(::Module, ::Symbol) at .\loading.jl:834
 [8] include at .\boot.jl:317 [inlined]
 [9] include_relative(::Module, ::String) at .\loading.jl:1038
 [10] include(::Module, ::String) at .\sysimg.jl:29
 [11] top-level scope at none:2
 [12] eval at .\boot.jl:319 [inlined]
 [13] eval(::Expr) at .\client.jl:399
 [14] top-level scope at .\none:3
in expression starting at C:\Users\유승환\.julia\packages\StatsBase\XePnn\src\StatsBase.jl:8
ERROR: LoadError: Failed to precompile StatsBase [2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91] to C:\Users\유승환\.julia\compiled\v0.7\StatsBase\EZjIG.ji.
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] macro expansion at .\logging.jl:313 [inlined]
 [3] compilecache(::Base.PkgId, ::String) at .\loading.jl:1185
 [4] _require(::Base.PkgId) at .\logging.jl:311
 [5] require(::Base.PkgId) at .\loading.jl:852
 [6] macro expansion at .\logging.jl:311 [inlined]
 [7] require(::Module, ::Symbol) at .\loading.jl:834
 [8] include at .\boot.jl:317 [inlined]
 [9] include_relative(::Module, ::String) at .\loading.jl:1038
 [10] include(::Module, ::String) at .\sysimg.jl:29
 [11] top-level scope at none:2
 [12] eval at .\boot.jl:319 [inlined]
 [13] eval(::Expr) at .\client.jl:399
 [14] top-level scope at .\none:3
in expression starting at C:\Users\유승환\.julia\packages\Distributions\wY4bz\src\Distributions.jl:3
ERROR: Failed to precompile Distributions [31c24e10-a181-5473-b8eb-7969acd0382f] to C:\Users\유승환\.julia\compiled\v0.7\Distributions\xILW0.ji.
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] macro expansion at .\logging.jl:313 [inlined]
 [3] compilecache(::Base.PkgId, ::String) at .\loading.jl:1185
 [4] _require(::Base.PkgId) at .\logging.jl:311
 [5] require(::Base.PkgId) at .\loading.jl:852
 [6] macro expansion at .\logging.jl:311 [inlined]
 [7] require(::Module, ::Symbol) at .\loading.jl:834

The error says: Cannot open cache file "C:\Users\?�승??.julia\compiled\v0.7\OrderedCollections\LtT3J.ji.a1339" for writing. So my first guesses would be: do this directory exist? Is Julia having a problem with the non-ascii characters in the path to the cache directory? Somehow you don’t have permissions to write in the folder, or there is an older cache file that cannot be overwritten? Do you have enough space in your filesystem?

I would advise trying again from a clean .julia, in other words, delete the .julia folder (it will be created again the next time you execute julia) and try to install/use the package again. If the problem persists then it merits further study.

I tried several times with different version of Julia, reinstalling the main program and the package directory.
But still, ‘using Distributions’ doesn’t work.
If anyone knows how to deal with the problem, would be of great help.

julia> using Distributions
[ Info: Precompiling Distributions [31c24e10-a181-5473-b8eb-7969acd0382f]
Cannot open cache file "C:\Users\?�승??.julia\compiled\v1.4\DataAPI\3a8mN_1nhdV.ji.a1410       " for writing.
ERROR: LoadError: Failed to precompile DataAPI [9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a] to C:\Users\유승환\.julia\compiled\v1.4\DataAPI\3a8mN_1nhdV.ji.
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1272
 [3] _require(::Base.PkgId) at .\loading.jl:1029
 [4] require(::Base.PkgId) at .\loading.jl:927
 [5] require(::Module, ::Symbol) at .\loading.jl:922
 [6] include(::Module, ::String) at .\Base.jl:377
 [7] top-level scope at none:2
 [8] eval at .\boot.jl:331 [inlined]
 [9] eval(::Expr) at .\client.jl:449
 [10] top-level scope at .\none:3
in expression starting at C:\Users\유승환\.julia\packages\StatsBase\unDUx\src\StatsBase.jl:6
ERROR: LoadError: Failed to precompile StatsBase [2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91] to C:\Users\유승환\.julia\compiled\v1.4\StatsBase\EZjIG_1nhdV.ji.
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1272
 [3] _require(::Base.PkgId) at .\loading.jl:1029
 [4] require(::Base.PkgId) at .\loading.jl:927
 [5] require(::Module, ::Symbol) at .\loading.jl:922
 [6] include(::Module, ::String) at .\Base.jl:377
 [7] top-level scope at none:2
 [8] eval at .\boot.jl:331 [inlined]
 [9] eval(::Expr) at .\client.jl:449
 [10] top-level scope at .\none:3
in expression starting at C:\Users\유승환\.julia\packages\Distributions\RAeyY\src\Distributions.jl:3
ERROR: Failed to precompile Distributions [31c24e10-a181-5473-b8eb-7969acd0382f] to C:\Users\유승환\.julia\compiled\v1.4\Distributions\xILW0_1nhdV.ji.
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1272
 [3] _require(::Base.PkgId) at .\loading.jl:1029
 [4] require(::Base.PkgId) at .\loading.jl:927
 [5] require(::Module, ::Symbol) at .\loading.jl:922

This is very strange. I installed and imported Distributions right now and it works for me. I think the version is the same, because the package hash folder is RAeyY to me too. I am using Julia 1.4.2 are you using this version too? I am in Linux though.

What happens if you just do using DataAPI? The error log seems to indicate that precompiling Distributions fail because precompiling DataAPI fails. So the problem maybe is just in that package. What happens if you try the using Distributions in a Julia REPL started with julia --compiled-modules=no?

Same version, 1.4.2. Ive just erased everything and reinstalled everything and still, the same.
I’ve tried DataAPI as you recommended. Surprising, same error message shows.

(@v1.4) pkg> add DataAPI
  Resolving package versions...
   Updating `C:\Users\유승환\.julia\environments\v1.4\Project.toml`
  [9a962f9c] + DataAPI v1.3.0
   Updating `C:\Users\유승환\.julia\environments\v1.4\Manifest.toml`
 [no changes]

julia> using DataAPI
[ Info: Precompiling DataAPI [9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a]
Cannot open cache file "C:\Users\?�승??.julia\compiled\v1.4\DataAPI\3a8mN_1nhdV.ji.a1518       " for writing.
ERROR: Failed to precompile DataAPI [9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a] to C:\Users\유승환\.julia\compiled\v1.4\DataAPI\3a8mN_1nhdV.ji.
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1272
 [3] _require(::Base.PkgId) at .\loading.jl:1029
 [4] require(::Base.PkgId) at .\loading.jl:927
 [5] require(::Module, ::Symbol) at .\loading.jl:922

This import Pkg; Pkg.add("DataAPI"); using DataAPI; that you have executed, it was inside a julia --compiled-modules=no REPL?

When you say that you

Do you mean that you deleted the entire C:\Users\유승환\.julia folder? Because this would be the right thing to do (you do not need to delete the folder with the Julia binary, just this .julia folder inside your user). If you just delete the specific package inside .julia/packages you do not delete its precompilation inside .julia/compiled.

Also, this problem happens with any packages, or just with Distributions? Because it can be a combo of Chinese Characters in the user folder + Windows. If it is not much work, can you create a new user, without non-ascii characters, and install/run julia with this user, so we can discard this possibility?

I guess it is in REPL.

`(@v1.4) pkg> status
Status `C:\Users\유승환\.julia\environments\v1.4\Project.toml`
  [9a962f9c] DataAPI v1.3.0
  [31c24e10] Distributions v0.23.4

julia> using DataAPI
[ Info: Precompiling DataAPI [9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a]
Cannot open cache file "C:\Users\?�승??.julia\compiled\v1.4\DataAPI\3a8mN_1nhdV.ji.a1140       " for writing.
ERROR: Failed to precompile DataAPI [9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a] to C:\Users\유승환\.julia\compiled\v1.4\DataAPI\3a8mN_1nhdV.ji.
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1272
 [3] _require(::Base.PkgId) at .\loading.jl:1029
 [4] require(::Base.PkgId) at .\loading.jl:927
 [5] require(::Module, ::Symbol) at .\loading.jl:922```


As I mean delete entire, means user file location `C:\Users\유승환\.julia` and the folder where Julia was installed.
I checked with other packages, IJulia, plot, and surprisingly showing the same error message.

I think there is the possibility this is happening for every package that has pre-compilation enabled. If this is happening, it is possible that the problem is some bug in the julia code that deals with the path to the precompiled file, it can be happening because there is some bug that only happens with Windows+“path with asian characters”+“julia package precompilation”. I am guessing that because:

  1. It has to be something considerably specific, otherwise other people in the forum would have the same problem.
  2. It has to be related to something in your system that is not just the Julia compiler, otherwise resetting Julia installation from scratch would solve it.
  3. If you look to the error message, it seems that it parses the path correctly in some cases (like in the line starting with “Status” in your last post) but in other cases (like the line starting with “Cannot open cache file” in your last post) it seems to disappear with the backslash (\) before the “.julia”. It may be a problem in my end, but I am not sure of it.

Did you try to execute the Julia REPL passing the flag julia --compiled-modules=no?

Sorry what does this mean?

I thought you accessed the Julia REPL (i.e., the terminal where you try using ... and ] add ...) by the Windows Shell (a.k.a. the command prompt). Now I believe you probably have an Icon or Menu Item that opens the Jullia terminal for you. I am not 100% sure how is the Julia installation in Windows, but I would assume that if you open the command prompt you can just type julia on it, and it will give you a Julia REPL as the one you are using. And if you type julia --compiled-modules=no it will give you a Julia REPL as the one you are using BUT that will not try to precompile the modules for you (I am kinda guessing it because the documentation for this flag is not great, but it will cause no harm anyway).

I’m sorry to ask such basic questions, but how do I type that?

It says

julia --compiled-modules=no

ERROR: syntax: invalid operator “–”

Stacktrace:

[1] top-level scope at none:0

–compiled-modules=no

ERROR: syntax: invalid operator “–”

Stacktrace:

[1] top-level scope at none:0

Windows 10용 메일에서 보냄

보낸 사람: Henrique Becker via JuliaLang
보낸 날짜: 2020년 7월 4일 토요일 오후 3:17
받는 사람: yoosong2000@gmail.com
제목: [JuliaLang] Error with using distributions package

I thought you accessed the Julia REPL (i.e., the terminal where you try using ... and ] add ...) by the Windows Shell (a.k.a. the command prompt). Now I believe you probably have an Icon or Menu Item that opens the Jullia terminal for you. I am not 100% sure how is the Julia installation in Windows, but I would assume that if you open the command prompt you can just type julia on it, and it will give you a Julia REPL as the one you are using. And if you type julia --compiled-modules=no it will give you a Julia REPL as the one you are using BUT that will not try to precompile the modules for you (I am kinda guessing it because the documentation for this flag is not great, but it will cause no harm anyway).

Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.

I think there is two problems with your approach:

  1. You need to write julia --compiled-modules=no in the cmd terminal (i.e., windows shell), not inside a Julia REPL. The error message you get seems like you are trying to run julia --compiled-modules=no inside julia, what will not work.
  2. I am not sure if it is just the Discourse markup, but it seems like at some point the double dash -- become an (EN DASH). Make sure you are writing two dashes and they are not getting converted to a single longer dash.

Thank you!
I just typed julia --compiled-modules=no in the window running and then in REPL any command ‘using package’ worked.
You saved my life!