Problem installing CPLEX.jl with CPLEX 22.1.1 on Mac OS

Hello

I just installed CPLEX 22.1.1

poss@Mac-de-Michael x86-64_osx % pwd
/Applications/CPLEX_Studio_Community2211/cplex/bin/x86-64_osx

In configured CPLEX_STUDIO_BINARIES as requested:

julia> ENV["CPLEX_STUDIO_BINARIES"]
"/Applications/CPLEX_Studio_Community2211/cplex/bin/x86-64_osx/"

Yet, the installation fails:

julia> Pkg.build("CPLEX")
    Building CPLEX → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/ac239474b90c8cea06e5595ac87b1235900f3044/build.log`
ERROR: Error building `CPLEX`: 
ERROR: LoadError: Unable to install CPLEX.jl.

The versions of CPLEX supported by CPLEX.jl are:

* 12.10
* 20.1
* 22.1 22.1.1

You must download and install one of these versions separately.

You should set the `CPLEX_STUDIO_BINARIES` environment variable to point to
the install location then try again. For example (updating the path to the
correct location):
...

Am I doing something wrong?

What is ls lib in that path?

Another quick check/fix is to rename
Applications/CPLEX_Studio_Community2211
To
Applications/CPLEX_Studio2211

What is ls lib in that path?

poss@Mac-de-Michael x86-64_osx % ls lib
ls: lib: No such file or directory
poss@Mac-de-Michael x86-64_osx % ls
cplex			cplexamp		libcplex2211.dylib
cplex.log		cpxchecklic

Another quick check/fix is to rename
Applications/CPLEX_Studio_Community2211
To
Applications/CPLEX_Studio2211

I renamed as suggested and adapted

ENV["CPLEX_STUDIO_BINARIES"] = "/Applications/CPLEX_Studio2211/cplex/bin/x86-64_osx/"

but get the same issue as before (same by adapting to CPLEX_Studio221).

It looks like you have installed the x86-64 (intel) version of CPLEX. I assume you have an M1 or M2 Mac? If so, you will also need to install the x86-64 version of Julia: Download Julia

Alternatively, download and install the aarch64 version of CPLEX.

Hi Dears

I have the same problem which I could not solve during the last 2 weeks!
I checked all possible conversations and methods,
I did this link step-by-step:
–jump-dev/CPLEX.jl#note-for-windows

then this topic:

Then the current topic,

I re-install Julia several times, I clean and install CPLEX several times,

(I am using Mac OSX M2)
I install macOS x86 (Intel or Rosetta) and Cplex x86
not worked,
I installed macOS (Apple Silicon) and arm Cplex, but it did not work,
I installed both of them, and none worked!!!

this is the Error I received in the Julia:

julia> ENV[“CPLEX_STUDIO_BINARIES”] = “/Applications/CPLEX_Studio_Community2211/cplex/bin/x86-64_osx/libcplex2211.dylib”

“/Applications/CPLEX_Studio_Community2211/cplex/bin/x86-64_osx/libcplex2211.dylib”

julia> import Pkg

julia> Pkg.add(“CPLEX”)

Resolving package versions…

No Changes to ~/.julia/environments/v1.10/Project.toml

No Changes to ~/.julia/environments/v1.10/Manifest.toml

julia> Pkg.build(“CPLEX”)

Building CPLEX → ~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/ac239474b90c8cea06e5595ac87b1235900f3044/build.log

ERROR: Error building CPLEX:

ERROR: LoadError: Unable to install CPLEX.jl.

The versions of CPLEX supported by CPLEX.jl are:

  • 12.10

  • 20.1

  • 22.1 22.1.1

You must download and install one of these versions separately.

You should set the CPLEX_STUDIO_BINARIES environment variable to point to

the install location then try again. For example (updating the path to the

correct location):


ENV["CPLEX_STUDIO_BINARIES"] = "/Applications/CPLEX_Studio221/cplex/bin/x86-64_osx/"

import Pkg

Pkg.add("CPLEX")

Pkg.build("CPLEX")

See the CPLEX.jl README at GitHub - jump-dev/CPLEX.jl: Julia interface for the CPLEX optimization software for further

instructions.

Stacktrace:

[1] error(s::String)

@ Base ./error.jl:35

[2] try_local_installation()

@ Main ~/.julia/packages/CPLEX/eQ4bU/deps/build.jl:140

[3] top-level scope

@ ~/.julia/packages/CPLEX/eQ4bU/deps/build.jl:158

[4] include(fname::String)

@ Base.MainInclude ./client.jl:489

[5] top-level scope

@ none:5

in expression starting at /Users/sharara/.julia/packages/CPLEX/eQ4bU/deps/build.jl:151

Stacktrace:

[1] pkgerror(msg::String)

@ Pkg.Types /Applications/Julia-1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/Pkg/src/Types.jl:70

[2] (::Pkg.Operations.var"#67#74"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String})()

@ Pkg.Operations /Applications/Julia-1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/Pkg/src/Operations.jl:1156

[3] withenv(::Pkg.Operations.var"#67#74"{…}, ::Pair{…}, ::Vararg{…})

@ Base ./env.jl:257

[4] (::Pkg.Operations.var"#117#122"{String, Bool, Bool, Bool, Pkg.Operations.var"#67#74"{…}, Pkg.Types.PackageSpec})()

@ Pkg.Operations /Applications/Julia-1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/Pkg/src/Operations.jl:1824

[5] with_temp_env(fn::Pkg.Operations.var"#117#122"{…}, temp_env::String)

@ Pkg.Operations /Applications/Julia-1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/Pkg/src/Operations.jl:1705

[6] (::Pkg.Operations.var"#115#120"{…})(tmp::String)

@ Pkg.Operations /Applications/Julia-1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/Pkg/src/Operations.jl:1794

[7] mktempdir(fn::Pkg.Operations.var"#115#120"{…}, parent::String; prefix::String)

@ Base.Filesystem ./file.jl:766

[8] mktempdir(fn::Function, parent::String)

@ Base.Filesystem ./file.jl:762

[9] mktempdir

@ ./file.jl:762 [inlined]

[10] sandbox(fn::Function, ctx::Pkg.Types.Context, target::Pkg.Types.PackageSpec, target_path::String, sandbox_path::String, sandbox_project_override::Pkg.Types.Project; preferences::Dict{…}, force_latest_compatible_version::Bool, allow_earlier_backwards_compatible_versions::Bool, allow_reresolve::Bool)

@ Pkg.Operations /Applications/Julia-1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/Pkg/src/Operations.jl:1752

[11] build_versions(ctx::Pkg.Types.Context, uuids::Set{Base.UUID}; verbose::Bool)

@ Pkg.Operations /Applications/Julia-1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/Pkg/src/Operations.jl:1137

[12] build_versions

@ /Applications/Julia-1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/Pkg/src/Operations.jl:1055 [inlined]

[13] build(ctx::Pkg.Types.Context, uuids::Set{Base.UUID}, verbose::Bool)

@ Pkg.Operations /Applications/Julia-1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/Pkg/src/Operations.jl:995

[14] build(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; verbose::Bool, kwargs::@Kwargs{io::Base.TTY})

@ Pkg.API /Applications/Julia-1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/Pkg/src/API.jl:1056

[15] build(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::@Kwargs{})

@ Pkg.API /Applications/Julia-1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/Pkg/src/API.jl:159

[16] build(pkgs::Vector{Pkg.Types.PackageSpec})

@ Pkg.API /Applications/Julia-1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/Pkg/src/API.jl:148

[17] build

@ /Applications/Julia-1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/Pkg/src/API.jl:147 [inlined]

[18] build(pkg::String)

@ Pkg.API /Applications/Julia-1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/Pkg/src/API.jl:146

[19] top-level scope

@ REPL[4]:1

Some type information was truncated. Use show(err) to see complete types.

(I have Cplex 22.11)

and while I run my main program:

Precompiling CPLEX
Info Given CPLEX was explicitly requested, output will be shown live
ERROR: LoadError: CPLEX not properly installed. Please run Pkg.build(“CPLEX”)
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] top-level scope
@ ~/.julia/packages/CPLEX/eQ4bU/src/CPLEX.jl:12
[3] include
@ ./Base.jl:495 [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, UInt128}}, source::Nothing)
@ Base ./loading.jl:2222
[5] top-level scope
@ stdin:3
in expression starting at /Users/sharara/.julia/packages/CPLEX/eQ4bU/src/CPLEX.jl:6
in expression starting at stdin:3
✗ CPLEX
0 dependencies successfully precompiled in 1 seconds. 48 already precompiled.

ERROR: The following 1 direct dependency failed to precompile:

CPLEX [a076750e-1247-5638-91d2-ce28b192dca0]

Failed to precompile CPLEX [a076750e-1247-5638-91d2-ce28b192dca0] to “/Users/sharara/.julia/compiled/v1.10/CPLEX/jl_thkDb6”.
ERROR: LoadError: CPLEX not properly installed. Please run Pkg.build(“CPLEX”)
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] top-level scope
@ ~/.julia/packages/CPLEX/eQ4bU/src/CPLEX.jl:12
[3] include
@ ./Base.jl:495 [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, UInt128}}, source::Nothing)
@ Base ./loading.jl:2222
[5] top-level scope
@ stdin:3
in expression starting at /Users/sharara/.julia/packages/CPLEX/eQ4bU/src/CPLEX.jl:6
in expression starting at stdin:
Stacktrace:
[1] pkgerror(msg::String)
@ Pkg.Types ~/.julia/juliaup/julia-1.10.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Pkg/src/Types.jl:70
[2] precompile(ctx::Pkg.Types.Context, pkgs::Vector{…}; internal_call::Bool, strict::Bool, warn_loaded::Bool, already_instantiated::Bool, timing::Bool, _from_loading::Bool, kwargs::@Kwargs{…})
@ Pkg.API ~/.julia/juliaup/julia-1.10.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Pkg/src/API.jl:1659
[3] precompile(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::@Kwargs{_from_loading::Bool})
@ Pkg.API ~/.julia/juliaup/julia-1.10.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Pkg/src/API.jl:159
[4] precompile
@ ~/.julia/juliaup/julia-1.10.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Pkg/src/API.jl:147 [inlined]
[5] precompile#114
@ ~/.julia/juliaup/julia-1.10.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Pkg/src/API.jl:146 [inlined]
[6] #invokelatest#2
@ ./essentials.jl:894 [inlined]
[7] invokelatest
@ ./essentials.jl:889 [inlined]
[8] _require(pkg::Base.PkgId, env::String)
@ Base ./loading.jl:1963
[9] __require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base ./loading.jl:1812
[10] #invoke_in_world#3
@ ./essentials.jl:926 [inlined]
[11] invoke_in_world
@ ./essentials.jl:923 [inlined]
[12] _require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base ./loading.jl:1803
[13] macro expansion
@ ./loading.jl:1790 [inlined]
[14] macro expansion
@ ./lock.jl:267 [inlined]
[15] __require(into::Module, mod::Symbol)
@ Base ./loading.jl:1753
[16] #invoke_in_world#3
@ ./essentials.jl:926 [inlined]
[17] invoke_in_world
@ ./essentials.jl:923 [inlined]
[18] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1746
[19] eval
@ ./boot.jl:385 [inlined]
[20] include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String)
@ Base ./loading.jl:2076
[21] include_string(m::Module, txt::String, fname::String)
@ Base ./loading.jl:2086
[22] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::@Kwargs{})
@ Base ./essentials.jl:892
[23] invokelatest(::Any, ::Any, ::Vararg{Any})
@ Base ./essentials.jl:889
[24] inlineeval(m::Module, code::String, code_line::Int64, code_column::Int64, file::String; softscope::Bool)
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.75.2/scripts/packages/VSCodeServer/src/eval.jl:263
[25] (::VSCodeServer.var"#67#72"{…})()
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.75.2/scripts/packages/VSCodeServer/src/eval.jl:181
[26] withpath(f::VSCodeServer.var"#67#72"{…}, path::String)
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.75.2/scripts/packages/VSCodeServer/src/repl.jl:274
[27] (::VSCodeServer.var"#66#71"{…})()
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.75.2/scripts/packages/VSCodeServer/src/eval.jl:179
[28] hideprompt(f::VSCodeServer.var"#66#71"{…})
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.75.2/scripts/packages/VSCodeServer/src/repl.jl:38
[29] (::VSCodeServer.var"#65#70"{…})()
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.75.2/scripts/packages/VSCodeServer/src/eval.jl:150
[30] with_logstate(f::Function, logstate::Any)
@ Base.CoreLogging ./logging.jl:515
[31] with_logger
@ ./logging.jl:627 [inlined]
[32] (::VSCodeServer.var"#64#69"{VSCodeServer.ReplRunCodeRequestParams})()
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.75.2/scripts/packages/VSCodeServer/src/eval.jl:255
[33] #invokelatest#2
@ ./essentials.jl:892 [inlined]
[34] invokelatest(::Any)
@ Base ./essentials.jl:889
[35] (::VSCodeServer.var"#62#63")()
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.75.2/scripts/packages/VSCodeServer/src/eval.jl:34
Some type information was truncated. Use show(err) to see complete types.

I have a deadline this week and still, I have not done the main optimization and its possible errors… I stopped here… please kindly help me…

I think installed the Mac OS version of CPLEX (I actually have an M3), entitled: cos_installer_preview-22.1.1.0.R0-M08SXML-osx,
and CPLEX is working fine:

poss@Mac-de-Michael ~ % /Applications/CPLEX_Studio2211/cplex/bin/x86-64_osx/cplex ; exit;

Welcome to IBM(R) ILOG(R) CPLEX(R) Interactive Optimizer Community Edition 22.1.1.0
  with Simplex, Mixed Integer & Barrier Optimizers
5725-A06 5725-A29 5724-Y48 5724-Y49 5724-Y54 5724-Y55 5655-Y21
Copyright IBM Corp. 1988, 2022.  All Rights Reserved.

Type 'help' for a list of available commands.
Type 'help' followed by a command name for more
information on commands.

CPLEX>

would you please say what did you do?

I cannot build CPLEX in julia. I was just saying I think my CPLEX installation is appropriate for my environement.

1 Like

@mposs, you have installed the Intel x86 version of CPLEX. It can run because of the Rosetta compatibility layer. To use with Julia, you must also use the x86 version of Julia.

1 Like

@Sharara Your CPLEX_STUDIO_BINARIES isn’t the correct path. It should be the directory, not the file. See the example in the error message.

which I could not solve during the last 2 weeks!

Oh no! In future please feel free to ask questions earlier. It’s not fun trying to solve a problem without success

1 Like

Thank you. Removing the julia version I had installed with juliaup, and installing manually the x86 version works. I wonder if this shouldn’t be documented somewhere? Or had I done spmething “wrong”?

1 Like

If you use juliaup, then you can install the x86-64 version with juliaup add 1~x64, and then start it with julia +1~x64.

I wonder if this shouldn’t be documented somewhere?

We could add this to the CPLEX README. The question does come up from time to time. It’s not specific to CPLEX or Julia though. If you’re downloading any binaries on an M machine, you need to make sure that any interoperations use the same architecture.

You are right, I never have seen a support team like Julia before (for other software)
Maybe, that’s why I was not comfortable to ask sooner,

About CPLEX, the problem is solved on my side, too.
But, to be honest, I do not know how!!!

I deleted and installed Julia and CPLEX several times, several versions, and several pairs.
non of them worked, but suddenly it worked! passed the Error and showed another error related to the code!

1 Like