Installing Mosek Error for JuMP

I used to use something like this to build a docker, but suddenly I started getting this error

FROM ubuntu:18.04 as base
RUN apt-get -y update; apt-get -y install curl
ENV JULIA_PATH /julia
ENV PATH "$JULIA_PATH/bin:$PATH"
RUN mkdir -p "$JULIA_PATH"
RUN curl -fL -o julia.tar.gz https://julialang-s3.julialang.org/bin/linux/x64/1.8/julia-1.8.5-linux-x86_64.tar.gz
RUN tar -xzf julia.tar.gz -C "$JULIA_PATH" --strip-components 1
RUN rm julia.tar.gz
ENV JULIA_PROJECT /julia
RUN mkdir -p "$JULIA_PROJECT"
RUN julia -e 'using Pkg; Pkg.add("MosekTools")'
  [3f19e933] + p7zip_jll v17.4.0+0
    Building Mosek β†’ `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/4d639c16d45bd7962613ff984046c120915d82b2/build.log`
ERROR: Error building `Mosek`: 
ERROR: LoadError: MethodError: no method matching hasregistrykey(::WinReg.RegKey, ::String, ::String)
Closest candidates are:
  hasregistrykey(!Matched::UInt32, ::String, ::String) at ~/.julia/packages/Mosek/5QnPP/deps/build.jl:36

I used to use something like this to build a docker

I’m not aware of any recent changes to Mosek that would cause this. What is the list of package versions above p7zip_jll? Is it pulling in old version?

The error looks like it thinks your computer is a Windows machine, which is a bit weird.

Here is the whole log file

docker build -t julia_image .
Sending build context to Docker daemon  29.18kB
Step 1/11 : FROM ubuntu:18.04 as base
 ---> b89fba62bc15
Step 2/11 : RUN apt-get -y update; apt-get -y install curl
 ---> Using cache
 ---> ef8bcd55575d
Step 3/11 : ENV JULIA_PATH /julia
 ---> Using cache
 ---> eb4821a8384a
Step 4/11 : ENV PATH "$JULIA_PATH/bin:$PATH"
 ---> Using cache
 ---> c6cef2318b20
Step 5/11 : RUN mkdir -p "$JULIA_PATH"
 ---> Using cache
 ---> 818cb6e44194
Step 6/11 : RUN curl -fL -o julia.tar.gz https://julialang-s3.julialang.org/bin/linux/x64/1.6/julia-1.6.7-linux-x86_64.tar.gz
 ---> Running in 17b0c3ffad52
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  108M  100  108M    0     0  66.7M      0  0:00:01  0:00:01 --:--:-- 75.5M
Removing intermediate container 17b0c3ffad52
 ---> 4bf3a8af6737
Step 7/11 : RUN tar -xzf julia.tar.gz -C "$JULIA_PATH" --strip-components 1
 ---> Running in 043bf5762f66
Removing intermediate container 043bf5762f66
 ---> 2165abfb2e15
Step 8/11 : RUN rm julia.tar.gz
 ---> Running in 70c0ebd5cd9e
Removing intermediate container 70c0ebd5cd9e
 ---> ddc5ba9b5877
Step 9/11 : ENV JULIA_PROJECT /julia
 ---> Running in 0d7eae945237
Removing intermediate container 0d7eae945237
 ---> d9c6a2bd4315
Step 10/11 : RUN mkdir -p "$JULIA_PROJECT"
 ---> Running in a8646e9227e0
Removing intermediate container a8646e9227e0
 ---> 21e15ef38c0d
Step 11/11 : RUN julia -e 'using Pkg; Pkg.add("MosekTools")'
 ---> Running in 05574194d380
  Installing known registries into `~/.julia`
       Added registry `General` to `~/.julia/registries/General`
   Resolving package versions...
   Installed DiffRules ──────────── v1.13.0
   Installed MosekTools ─────────── v0.13.2
   Installed Bzip2_jll ──────────── v1.0.8+0
   Installed IrrationalConstants ── v0.2.2
   Installed LogExpFunctions ────── v0.3.23
   Installed BenchmarkTools ─────── v1.3.2
   Installed JSON ───────────────── v0.21.3
   Installed Mosek ──────────────── v10.0.2
   Installed MacroTools ─────────── v0.5.10
   Installed CodecZlib ──────────── v0.7.1
   Installed InverseFunctions ───── v0.1.8
   Installed CommonSubexpressions ─ v0.3.0
   Installed DataStructures ─────── v0.18.13
   Installed Preferences ────────── v1.3.0
   Installed SnoopPrecompile ────── v1.0.3
   Installed MutableArithmetics ─── v1.2.3
   Installed ChainRulesCore ─────── v1.15.7
   Installed OpenSpecFun_jll ────── v0.5.5+0
   Installed ChangesOfVariables ─── v0.1.6
   Installed Compat ─────────────── v4.6.1
   Installed DiffResults ────────── v1.1.0
   Installed OrderedCollections ─── v1.4.1
   Installed TranscodingStreams ─── v0.9.11
   Installed ForwardDiff ────────── v0.10.35
   Installed StaticArrays ───────── v1.5.17
   Installed NaNMath ────────────── v1.0.2
   Installed CodecBzip2 ─────────── v0.7.2
   Installed StaticArraysCore ───── v1.4.0
   Installed Parsers ────────────── v2.5.8
   Installed SpecialFunctions ───── v2.2.0
   Installed DocStringExtensions ── v0.9.3
   Installed JLLWrappers ────────── v1.4.1
   Installed MathOptInterface ───── v1.13.1
    Updating `/julia/Project.toml`
  [1ec41992] + MosekTools v0.13.2
    Updating `/julia/Manifest.toml`
  [6e4b80f9] + BenchmarkTools v1.3.2
  [d360d2e6] + ChainRulesCore v1.15.7
  [9e997f8a] + ChangesOfVariables v0.1.6
  [523fee87] + CodecBzip2 v0.7.2
  [944b1d66] + CodecZlib v0.7.1
  [bbf7d656] + CommonSubexpressions v0.3.0
  [34da2185] + Compat v4.6.1
  [864edb3b] + DataStructures v0.18.13
  [163ba53b] + DiffResults v1.1.0
  [b552c78f] + DiffRules v1.13.0
  [ffbed154] + DocStringExtensions v0.9.3
  [f6369f11] + ForwardDiff v0.10.35
  [3587e190] + InverseFunctions v0.1.8
  [92d709cd] + IrrationalConstants v0.2.2
  [692b3bcd] + JLLWrappers v1.4.1
  [682c06a0] + JSON v0.21.3
  [2ab3a3ac] + LogExpFunctions v0.3.23
  [1914dd2f] + MacroTools v0.5.10
  [b8f27783] + MathOptInterface v1.13.1
  [6405355b] + Mosek v10.0.2
  [1ec41992] + MosekTools v0.13.2
  [d8a4904e] + MutableArithmetics v1.2.3
  [77ba4419] + NaNMath v1.0.2
  [bac558e1] + OrderedCollections v1.4.1
  [69de0a69] + Parsers v2.5.8
  [21216c6a] + Preferences v1.3.0
  [66db9d55] + SnoopPrecompile v1.0.3
  [276daf66] + SpecialFunctions v2.2.0
  [90137ffa] + StaticArrays v1.5.17
  [1e83bf80] + StaticArraysCore v1.4.0
  [3bb67fe8] + TranscodingStreams v0.9.11
  [6e34b625] + Bzip2_jll v1.0.8+0
  [efe28fd5] + OpenSpecFun_jll v0.5.5+0
  [0dad84c5] + ArgTools
  [56f22d72] + Artifacts
  [2a0f44e3] + Base64
  [ade2ca70] + Dates
  [f43a241f] + Downloads
  [b77e0a4c] + InteractiveUtils
  [b27032c2] + LibCURL
  [76f85450] + LibGit2
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [56ddb016] + Logging
  [d6f4376e] + Markdown
  [a63ad114] + Mmap
  [ca575930] + NetworkOptions
  [44cfe95a] + Pkg
  [de0858da] + Printf
  [9abbd945] + Profile
  [3fa0cd96] + REPL
  [9a3f8284] + Random
  [ea8e919c] + SHA
  [9e88b42a] + Serialization
  [6462fe0b] + Sockets
  [2f01184e] + SparseArrays
  [10745b16] + Statistics
  [fa267f1f] + TOML
  [a4e569a6] + Tar
  [8dfed614] + Test
  [cf7118a7] + UUIDs
  [4ec0a83e] + Unicode
  [e66e0078] + CompilerSupportLibraries_jll
  [deac9b47] + LibCURL_jll
  [29816b5a] + LibSSH2_jll
  [c8ffd9c3] + MbedTLS_jll
  [14a3606d] + MozillaCACerts_jll
  [05823500] + OpenLibm_jll
  [83775a58] + Zlib_jll
  [8e850ede] + nghttp2_jll
  [3f19e933] + p7zip_jll
    Building Mosek β†’ `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/4d639c16d45bd7962613ff984046c120915d82b2/build.log`
ERROR: Error building `Mosek`: 
ERROR: LoadError: MethodError: no method matching hasregistrykey(::WinReg.RegKey, ::String, ::String)
Closest candidates are:
  hasregistrykey(!Matched::UInt32, ::String, ::String) at /root/.julia/packages/Mosek/5QnPP/deps/build.jl:36
Stacktrace:
 [1] top-level scope
   @ ~/.julia/packages/Mosek/5QnPP/deps/build.jl:189
 [2] include(fname::String)
   @ Base.MainInclude ./client.jl:444
 [3] top-level scope
   @ none:5
in expression starting at /root/.julia/packages/Mosek/5QnPP/deps/build.jl:151
Stacktrace:
  [1] pkgerror(msg::String)
    @ Pkg.Types /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Types.jl:55
  [2] (::Pkg.Operations.var"#82#87"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec})()
    @ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:1067
  [3] withenv(::Pkg.Operations.var"#82#87"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec}, ::Pair{String, String}, ::Vararg{Pair{String, B} where B, N} where N)
    @ Base ./env.jl:161
  [4] (::Pkg.Operations.var"#109#113"{String, Pkg.Operations.var"#82#87"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec}, Pkg.Types.PackageSpec})()
    @ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:1565
  [5] with_temp_env(fn::Pkg.Operations.var"#109#113"{String, Pkg.Operations.var"#82#87"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec}, Pkg.Types.PackageSpec}, temp_env::String)
    @ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:1467
  [6] (::Pkg.Operations.var"#108#112"{Pkg.Operations.var"#82#87"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec}, Pkg.Types.Context, Pkg.Types.PackageSpec, String, Pkg.Types.Project, String})(tmp::String)
    @ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:1540
  [7] mktempdir(fn::Pkg.Operations.var"#108#112"{Pkg.Operations.var"#82#87"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec}, Pkg.Types.Context, Pkg.Types.PackageSpec, String, Pkg.Types.Project, String}, parent::String; prefix::String)
    @ Base.Filesystem ./file.jl:729
  [8] mktempdir(fn::Function, parent::String) (repeats 2 times)
    @ Base.Filesystem ./file.jl:727
  [9] sandbox(fn::Function, ctx::Pkg.Types.Context, target::Pkg.Types.PackageSpec, target_path::String, sandbox_path::String, sandbox_project_override::Pkg.Types.Project)
    @ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:1506
 [10] build_versions(ctx::Pkg.Types.Context, uuids::Vector{Base.UUID}; verbose::Bool)
    @ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:1048
 [11] build_versions
    @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:975 [inlined]
 [12] add(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}, new_git::Vector{Base.UUID}; preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform)
    @ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:1264
 [13] add(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform, kwargs::Base.Iterators.Pairs{Symbol, Base.PipeEndpoint, Tuple{Symbol}, NamedTuple{(:io,), Tuple{Base.PipeEndpoint}}})
    @ Pkg.API /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:204
 [14] add(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.PipeEndpoint, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Pkg.API /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:80
 [15] add(pkgs::Vector{Pkg.Types.PackageSpec})
    @ Pkg.API /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:78
 [16] #add#23
    @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:76 [inlined]
 [17] add
    @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:76 [inlined]
 [18] #add#22
    @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:75 [inlined]
 [19] add(pkg::String)
    @ Pkg.API /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:75
 [20] top-level scope
    @ none:1
The command '/bin/sh -c julia -e 'using Pkg; Pkg.add("MosekTools")'' returned a non-zero code: 1

What is the output of

RUN julia -e 'using InteractiveUtils; InteractiveUtils.versioninfo()'

Did this used to work? I don’t know if anyone has automatically installed Mosek in docker. You might need to install it manually and then set the MOSEKBINDIR environment variable to point to the installation.

Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 112 Γ— AMD EPYC 7B13
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, znver3)
  Threads: 1 on 112 virtual cores
Environment:
  JULIA_PATH = /julia
  JULIA_PROJECT = /julia
Removing intermediate container f35427c4e7fd
 ---> e96859b2cb9b
Successfully built e96859b2cb9b
Successfully tagged julia_image:latest

I tried to run the steps in my Linux machine (not docker) and got the same error

$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.8.5 (2023-01-08)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(@v1.8) pkg> activate .
  Activating new project at `~/Downloads`

(Downloads) pkg> add MosekTools
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
   Installed IrrationalConstants ─ v0.2.2
   Installed DiffRules ─────────── v1.13.0
   Installed NaNMath ───────────── v1.0.2
   Installed ForwardDiff ───────── v0.10.35
   Installed SpecialFunctions ──── v2.2.0
   Installed Parsers ───────────── v2.5.8
   Installed LogExpFunctions ───── v0.3.23
   Installed Compat ────────────── v4.6.1
   Installed StaticArrays ──────── v1.5.17
   Installed ChainRulesCore ────── v1.15.7
   Installed CodecZlib ─────────── v0.7.1
   Installed ChangesOfVariables ── v0.1.6
    Updating `~/Downloads/Project.toml`
  [1ec41992] + MosekTools v0.13.2
    Updating `~/Downloads/Manifest.toml`
  [6e4b80f9] + BenchmarkTools v1.3.2
  [d360d2e6] + ChainRulesCore v1.15.7
  [9e997f8a] + ChangesOfVariables v0.1.6
  [523fee87] + CodecBzip2 v0.7.2
  [944b1d66] + CodecZlib v0.7.1
  [bbf7d656] + CommonSubexpressions v0.3.0
  [34da2185] + Compat v4.6.1
  [864edb3b] + DataStructures v0.18.13
  [163ba53b] + DiffResults v1.1.0
  [b552c78f] + DiffRules v1.13.0
  [ffbed154] + DocStringExtensions v0.9.3
  [f6369f11] + ForwardDiff v0.10.35
  [3587e190] + InverseFunctions v0.1.8
  [92d709cd] + IrrationalConstants v0.2.2
  [692b3bcd] + JLLWrappers v1.4.1
  [682c06a0] + JSON v0.21.3
  [2ab3a3ac] + LogExpFunctions v0.3.23
  [1914dd2f] + MacroTools v0.5.10
  [b8f27783] + MathOptInterface v1.13.1
  [6405355b] + Mosek v10.0.2
  [1ec41992] + MosekTools v0.13.2
  [d8a4904e] + MutableArithmetics v1.2.3
  [77ba4419] + NaNMath v1.0.2
  [bac558e1] + OrderedCollections v1.4.1
  [69de0a69] + Parsers v2.5.8
  [21216c6a] + Preferences v1.3.0
  [66db9d55] + SnoopPrecompile v1.0.3
  [276daf66] + SpecialFunctions v2.2.0
  [90137ffa] + StaticArrays v1.5.17
  [1e83bf80] + StaticArraysCore v1.4.0
  [3bb67fe8] + TranscodingStreams v0.9.11
  [6e34b625] + Bzip2_jll v1.0.8+0
  [efe28fd5] + OpenSpecFun_jll v0.5.5+0
  [0dad84c5] + ArgTools v1.1.1
  [56f22d72] + Artifacts
  [2a0f44e3] + Base64
  [ade2ca70] + Dates
  [f43a241f] + Downloads v1.6.0
  [7b1f6079] + FileWatching
  [b77e0a4c] + InteractiveUtils
  [b27032c2] + LibCURL v0.6.3
  [76f85450] + LibGit2
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [56ddb016] + Logging
  [d6f4376e] + Markdown
  [a63ad114] + Mmap
  [ca575930] + NetworkOptions v1.2.0
  [44cfe95a] + Pkg v1.8.0
  [de0858da] + Printf
  [9abbd945] + Profile
  [3fa0cd96] + REPL
  [9a3f8284] + Random
  [ea8e919c] + SHA v0.7.0
  [9e88b42a] + Serialization
  [6462fe0b] + Sockets
  [2f01184e] + SparseArrays
  [10745b16] + Statistics
  [fa267f1f] + TOML v1.0.0
  [a4e569a6] + Tar v1.10.1
  [8dfed614] + Test
  [cf7118a7] + UUIDs
  [4ec0a83e] + Unicode
  [e66e0078] + CompilerSupportLibraries_jll v1.0.1+0
  [deac9b47] + LibCURL_jll v7.84.0+0
  [29816b5a] + LibSSH2_jll v1.10.2+0
  [c8ffd9c3] + MbedTLS_jll v2.28.0+0
  [14a3606d] + MozillaCACerts_jll v2022.2.1
  [4536629a] + OpenBLAS_jll v0.3.20+0
  [05823500] + OpenLibm_jll v0.8.1+0
  [83775a58] + Zlib_jll v1.2.12+3
  [8e850b90] + libblastrampoline_jll v5.1.1+0
  [8e850ede] + nghttp2_jll v1.48.0+0
  [3f19e933] + p7zip_jll v17.4.0+0
Precompiling project...
  βœ— Mosek
  βœ— MosekTools
  16 dependencies successfully precompiled in 48 seconds. 22 already precompiled.
  2 dependencies errored. To see a full report either run `import Pkg; Pkg.precompile()` or load the packages

julia> import Pkg; Pkg.precompile()
Precompiling project...
  βœ— Mosek
  βœ— MosekTools
  0 dependencies successfully precompiled in 5 seconds. 38 already precompiled.

ERROR: The following 1 direct dependency failed to precompile:

MosekTools [1ec41992-ff65-5c91-ac43-2df89e9693a4]

Failed to precompile MosekTools [1ec41992-ff65-5c91-ac43-2df89e9693a4] to /home/amir/.julia/compiled/v1.8/MosekTools/jl_3qrE2j.
ERROR: LoadError: Mosek not properly installed. Please run Pkg.build("Mosek")
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] top-level scope
   @ ~/.julia/packages/Mosek/5QnPP/src/Mosek.jl:8
 [3] include
   @ ./Base.jl:419 [inlined]
 [4] 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, UInt64}}, source::String)
   @ Base ./loading.jl:1554
 [5] top-level scope
   @ stdin:1
in expression starting at /home/amir/.julia/packages/Mosek/5QnPP/src/Mosek.jl:2
in expression starting at stdin:1
ERROR: LoadError: Failed to precompile Mosek [6405355b-0ac2-5fba-af84-adbd65488c0e] to /home/amir/.julia/compiled/v1.8/Mosek/jl_So2gOm.
Stacktrace:
    @ Base ./error.jl:35
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
    @ Base ./loading.jl:1707
  [3] compilecache
    @ ./loading.jl:1651 [inlined]
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1337
  [5] _require_prelocked(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1200
  [6] macro expansion
    @ ./loading.jl:1180 [inlined]
  [7] macro expansion
    @ ./lock.jl:223 [inlined]
  [8] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1144
  [9] include
    @ ./Base.jl:419 [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, UInt64}}, source::Nothing)
    @ Base ./loading.jl:1554
 [11] top-level scope
    @ stdin:1
in expression starting at /home/amir/.julia/packages/MosekTools/pZfNC/src/MosekTools.jl:1
in expression starting at stdin:1
Stacktrace:
 [1] pkgerror(msg::String)
   @ Pkg.Types /usr/share/julia/stdlib/v1.8/Pkg/src/Types.jl:67
 [2] precompile(ctx::Pkg.Types.Context, pkgs::Vector{String}; internal_call::Bool, strict::Bool, warn_loaded::Bool, already_instantiated::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Pkg.API /usr/share/julia/stdlib/v1.8/Pkg/src/API.jl:1435
 [3] precompile
   @ /usr/share/julia/stdlib/v1.8/Pkg/src/API.jl:1072 [inlined]
 [4] #precompile#225
   @ /usr/share/julia/stdlib/v1.8/Pkg/src/API.jl:1071 [inlined]
 [5] precompile (repeats 2 times)
   @ /usr/share/julia/stdlib/v1.8/Pkg/src/API.jl:1071 [inlined]
 [6] top-level scope
   @ REPL[4]:1

julia> Pkg.build("Mosek")
    Building Mosek β†’ `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/4d639c16d45bd7962613ff984046c120915d82b2/build.log`
ERROR: Error building `Mosek`: 
ERROR: LoadError: MethodError: no method matching hasregistrykey(::WinReg.RegKey, ::String, ::String)
Closest candidates are:
  hasregistrykey(!Matched::UInt32, ::String, ::String) at ~/.julia/packages/Mosek/5QnPP/deps/build.jl:36
Stacktrace:
1 Like

Yes, it used to work for almost a month, and today I tried to rebuild it, and it crashed.

1 Like

You can get the official Julia docker docker pull julia
then run docker run -it julia
and then use the command using Pkg; Pkg.add("MosekTools"), and you will see the same error

Ah. It seems like 4 hours ago a new version of WinReg.jl was tagged:

Release v1.0.0 Β· simonbyrne/WinReg.jl Β· GitHub.

This obviously broke the install script for Mosek. Let me take a look.

Thanks, but I thought when I used Project/Manifest.toml, that protected me not to get the latest code from different dependencies (at least that is the case for golang and python, I guess)

but I thought when I used Project/Manifest.toml, that protected me not to get the latest code from different dependencies

It should have. I think this is probably a bug in Mosek.jl that escaped detection because WinReg is only used on install.

See Fix compat of WinReg.jl by odow Β· Pull Request #224 Β· MOSEK/Mosek.jl Β· GitHub.

For a work-around, try using

RUN julia -e 'using Pkg; Pkg.pkg("add WinReg@0.3 MosekTools")'
1 Like

Ran this:

$ docker run -it julia -q
julia>using Pkg; pkg"add WinReg@0.3 MosekTools"

and I got

ERROR: Error building `Mosek`: 
[ Info: Get latest MOSEK version (https://download.mosek.com/stable/10.0/version)
[ Info: Latest MOSEK version = 10.0.38, nothing currently installed
[ Info: Download MOSEK distro (https://download.mosek.com/stable/10.0.38/mosektoolslinux64x86.tar.bz2)
[ Info: Unpack MOSEK distro (/root/.julia/packages/Mosek/5QnPP/deps/downloads/mosektoolslinux64x86.tar.bz2 -> /root/.julia/packages/Mosek/5QnPP/deps/src)
ERROR: LoadError: Failed to unpack MOSEK distro

That seems unrelated more like a permission issue with your docker image. Julia is just using tar xjf [filename] to unpack it.

Can you confirm that you can install Mosek locally outside of docker with that Pkg command?

For your docker image, I’d just install Mosek separately by downloading https://download.mosek.com/stable/10.0.38/mosektoolslinux64x86.tar.bz2 directly. Don’t rely on Mosek.jl to do it for you.

Yes using Pkg; pkg"add WinReg@0.3 MosekTools" works but when I use using Pkg; pkg"precompile", I will get an error:


Precompiling project...
  βœ— Mosek
  βœ— MosekTools
  0 dependencies successfully precompiled in 5 seconds. 114 already precompiled.

ERROR: The following 1 direct dependency failed to precompile:

MosekTools [1ec41992-ff65-5c91-ac43-2df89e9693a4]

Failed to precompile MosekTools [1ec41992-ff65-5c91-ac43-2df89e9693a4] to /home/amir/.julia/compiled/v1.8/MosekTools/jl_V9GdMT.
ERROR: LoadError: Mosek not properly installed. Please run Pkg.build("Mosek")

Did you try import Pkg; Pkg.build("Mosek") like it suggested? The old failed install must still be there.

I can’t reproduce locally:

(msktools) pkg> st
      Status `/private/tmp/msktools/Project.toml` (empty project)

(msktools) pkg> add WinReg@0.3 Mosek MosekTools
    Updating registry at `~/.julia/registries/General`
    Updating git-repo `https://github.com/JuliaRegistries/General.git`
   Resolving package versions...
   Installed MosekTools ─ v0.13.2
    Updating `/private/tmp/msktools/Project.toml`
  [6405355b] + Mosek v10.0.2
  [1ec41992] + MosekTools v0.13.2
  [1b915085] + WinReg v0.3.1
    Updating `/private/tmp/msktools/Manifest.toml`
  [6e4b80f9] + BenchmarkTools v1.3.2
  [d360d2e6] + ChainRulesCore v1.15.7
  [9e997f8a] + ChangesOfVariables v0.1.6
  [523fee87] + CodecBzip2 v0.7.2
  [944b1d66] + CodecZlib v0.7.1
  [bbf7d656] + CommonSubexpressions v0.3.0
  [34da2185] + Compat v4.6.1
  [864edb3b] + DataStructures v0.18.13
  [163ba53b] + DiffResults v1.1.0
  [b552c78f] + DiffRules v1.13.0
  [ffbed154] + DocStringExtensions v0.9.3
  [f6369f11] + ForwardDiff v0.10.35
  [3587e190] + InverseFunctions v0.1.8
  [92d709cd] + IrrationalConstants v0.2.2
  [692b3bcd] + JLLWrappers v1.4.1
  [682c06a0] + JSON v0.21.3
  [2ab3a3ac] + LogExpFunctions v0.3.23
  [1914dd2f] + MacroTools v0.5.10
  [b8f27783] + MathOptInterface v1.13.1
  [6405355b] + Mosek v10.0.2
  [1ec41992] + MosekTools v0.13.2
  [d8a4904e] + MutableArithmetics v1.2.3
  [77ba4419] + NaNMath v1.0.2
  [bac558e1] + OrderedCollections v1.4.1
  [69de0a69] + Parsers v2.5.8
  [21216c6a] + Preferences v1.3.0
  [66db9d55] + SnoopPrecompile v1.0.3
  [276daf66] + SpecialFunctions v2.2.0
  [90137ffa] + StaticArrays v1.5.17
  [1e83bf80] + StaticArraysCore v1.4.0
  [3bb67fe8] + TranscodingStreams v0.9.11
  [1b915085] + WinReg v0.3.1
  [6e34b625] + Bzip2_jll v1.0.8+0
  [efe28fd5] + OpenSpecFun_jll v0.5.5+0
  [0dad84c5] + ArgTools
  [56f22d72] + Artifacts
  [2a0f44e3] + Base64
  [ade2ca70] + Dates
  [f43a241f] + Downloads
  [b77e0a4c] + InteractiveUtils
  [b27032c2] + LibCURL
  [76f85450] + LibGit2
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [56ddb016] + Logging
  [d6f4376e] + Markdown
  [a63ad114] + Mmap
  [ca575930] + NetworkOptions
  [44cfe95a] + Pkg
  [de0858da] + Printf
  [9abbd945] + Profile
  [3fa0cd96] + REPL
  [9a3f8284] + Random
  [ea8e919c] + SHA
  [9e88b42a] + Serialization
  [6462fe0b] + Sockets
  [2f01184e] + SparseArrays
  [10745b16] + Statistics
  [fa267f1f] + TOML
  [a4e569a6] + Tar
  [8dfed614] + Test
  [cf7118a7] + UUIDs
  [4ec0a83e] + Unicode
  [e66e0078] + CompilerSupportLibraries_jll
  [deac9b47] + LibCURL_jll
  [29816b5a] + LibSSH2_jll
  [c8ffd9c3] + MbedTLS_jll
  [14a3606d] + MozillaCACerts_jll
  [05823500] + OpenLibm_jll
  [83775a58] + Zlib_jll
  [8e850ede] + nghttp2_jll
  [3f19e933] + p7zip_jll
Precompiling project...
  1 dependency successfully precompiled in 8 seconds (38 already precompiled)

julia> using MosekTools

julia> Mosek.getversion()
(10, 0, 38)

Yes, and it failed again.