CPLEX.jl icon indicating copy to clipboard operation
CPLEX.jl copied to clipboard

CPLEX.jl does not support Apple M1

Open Ratnam-Parikh opened this issue 3 years ago • 4 comments

Hi, I am having an issue while building CPLEX 20.10 and 12.10 on my Macbook M1 air. The error is that it cannot locate the CPLEX installation even though I have given the correct destinations for the binaries. Is the issue due to M1 Arch? Also, I am using the latest Julia version i.e. 1.7

Ratnam-Parikh avatar Nov 27 '21 05:11 Ratnam-Parikh

Is the issue due to M1 Arch

Did you download a specific version of CPLEX compiled for M1? A generic Mac install will not work. Given 12.10 and 20.1 are quite old, I'm not aware that IBM have released new versions of CPLEX for M1.

This SO answer would seem that they haven't but it's a bit old: https://stackoverflow.com/questions/66859628/cplex-installation-could-not-find-a-version-that-satisfies-and-no-matching

I suggest you contact IBM for support. Note that CPLEX.jl is maintained by the JuMP community and is not an official IBM product.

odow avatar Nov 27 '21 05:11 odow

Hi ! I had the same problem but apparently, this is NOT due to the M1 Arch. In my case, I managed to build CPLEX.jl with Julia 1.6 but not with Julia 1.7. I think this might comes from the Libdl package that reads the .dylib library file from CPLEX.

Try to use Julia 1.6 instead if possible 😊

TheoGuyard avatar Dec 03 '21 07:12 TheoGuyard

The Julia 1.6 macOS install uses Rosetta on M1. You can also install this version of Julia for 1.7: https://julialang.org/downloads/.

I think the problem is installing CPLEX on ARM.

odow avatar Dec 03 '21 22:12 odow

Note that CPLEX runs fine on Julia 1.7, https://github.com/jump-dev/CPLEX.jl/pull/385, so this must be some M1-specific problem.

Are you sure you installed both Julia and CPLEX for Rosetta and not ARM?

odow avatar Feb 17 '22 02:02 odow

It seems like CPLEX 22.1.1 know supports M1: https://stackoverflow.com/questions/74892000/cplex-22-1-on-macbook-with-m1-architecture. If anyone can confirm, I'll close this issue.

odow avatar Jan 23 '23 19:01 odow

Here's some official documentation that confirms CPLEX 22.1.1. can run on M1: https://community.ibm.com/community/user/ai-datascience/discussion/cplex-optimization-studio-2211-is-available.

If anyone still encounters issues, make sure you have installed a download containing .arm64 in the filename.

odow avatar Feb 14 '23 03:02 odow

Hello, so ive installed a .arm64 file for CPLEX and im still getting the error OP got (loaderror cant find file). Im using julia 1.8 and CPLEX version 22.1.1 on a M1 mac. For reference this is my path: Screen Shot 2023-06-05 at 11 53 51 PM

This is the message in Julia:

julia> ENV["CPLEX_STUDIO_BINARIES"] = "/Applications/CPLEX_Studio2211/cplex/bin/arm64_osx/"
"/Applications/CPLEX_Studio2211/cplex/bin/arm64_osx/"

julia> import Pkg

julia> Pkg.add("CPLEX")
   Resolving package versions...
  No Changes to `~/.julia/environments/v1.8/Project.toml`
  No Changes to `~/.julia/environments/v1.8/Manifest.toml`


julia> Pkg.build("CPLEX") 
    Building CPLEX → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/355f43dfc8efa286434d9fbc37d69c88c54da708/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 https://github.com/jump-dev/CPLEX.jl for further
instructions.

Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] try_local_installation()
   @ Main ~/.julia/packages/CPLEX/Vd1Gd/deps/build.jl:140
 [3] top-level scope
   @ ~/.julia/packages/CPLEX/Vd1Gd/deps/build.jl:158
 [4] include(fname::String)
   @ Base.MainInclude ./client.jl:476
 [5] top-level scope
   @ none:5
in expression starting at /Users/faresarafat/.julia/packages/CPLEX/Vd1Gd/deps/build.jl:151
Stacktrace:
  [1] pkgerror(msg::String)
    @ Pkg.Types /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Types.jl:67
  [2] (::Pkg.Operations.var"#66#73"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String})()
    @ Pkg.Operations /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:1060
  [3] withenv(::Pkg.Operations.var"#66#73"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String}, ::Pair{String, String}, ::Vararg{Pair{String}})
    @ Base ./env.jl:172
  [4] (::Pkg.Operations.var"#107#112"{String, Bool, Bool, Bool, Pkg.Operations.var"#66#73"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String}, Pkg.Types.PackageSpec})()
    @ Pkg.Operations /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:1619
  [5] with_temp_env(fn::Pkg.Operations.var"#107#112"{String, Bool, Bool, Bool, Pkg.Operations.var"#66#73"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String}, Pkg.Types.PackageSpec}, temp_env::String)
    @ Pkg.Operations /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:1493
  [6] (::Pkg.Operations.var"#105#110"{Dict{String, Any}, Bool, Bool, Bool, Pkg.Operations.var"#66#73"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String}, Pkg.Types.Context, Pkg.Types.PackageSpec, String, Pkg.Types.Project, String})(tmp::String)
    @ Pkg.Operations /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:1582
  [7] mktempdir(fn::Pkg.Operations.var"#105#110"{Dict{String, Any}, Bool, Bool, Bool, Pkg.Operations.var"#66#73"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String}, Pkg.Types.Context, Pkg.Types.PackageSpec, String, Pkg.Types.Project, String}, parent::String; prefix::String)
    @ Base.Filesystem ./file.jl:764
  [8] mktempdir(fn::Function, parent::String) (repeats 2 times)
    @ Base.Filesystem ./file.jl:760
  [9] 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{String, Any}, force_latest_compatible_version::Bool, allow_earlier_backwards_compatible_versions::Bool, allow_reresolve::Bool)
    @ Pkg.Operations /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:1540
 [10] build_versions(ctx::Pkg.Types.Context, uuids::Set{Base.UUID}; verbose::Bool)
    @ Pkg.Operations /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:1041
 [11] build(ctx::Pkg.Types.Context, uuids::Set{Base.UUID}, verbose::Bool)
    @ Pkg.Operations /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:898
 [12] build(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; verbose::Bool, kwargs::Base.Pairs{Symbol, Base.TTY, Tuple{Symbol}, NamedTuple{(:io,), Tuple{Base.TTY}}})
    @ Pkg.API /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:1029
 [13] build(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Pkg.API /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:156
 [14] build(pkgs::Vector{Pkg.Types.PackageSpec})
    @ Pkg.API /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:145
 [15] #build#99
    @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:144 [inlined]
 [16] build
    @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:144 [inlined]
 [17] #build#98
    @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:143 [inlined]
 [18] build(pkg::String)
    @ Pkg.API /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:143
 [19] top-level scope
    @ REPL[21]:1

fares2201 avatar Jun 05 '23 22:06 fares2201

A few questions that can help diagnose this:

  • What is versioninfo()
  • What is import Pkg; Pkg.status("CPLEX")
  • What files are in the arm64_osx directory?

odow avatar Jun 05 '23 23:06 odow

Thanks for the quick response! Appreciated!

-Julia Version 1.8.5 Commit 17cfb8e65ea (2023-01-08 06:45 UTC) Platform Info: OS: macOS (x86_64-apple-darwin21.4.0) CPU: 8 × Apple M1 Pro WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-13.0.1 (ORCJIT, westmere) Threads: 1 on 8 virtual cores

-Status ~/.julia/environments/v1.8/Project.toml [a076750e] CPLEX v1.0.0

-cplex cplexamp libcplex2211.dylib

fares2201 avatar Jun 05 '23 23:06 fares2201

OS: macOS (x86_64-apple-darwin21.4.0)

You've installed the x86 (Rosetta) build of Julia. If you install x86 Julia, you must also install x86 versions of dependencies.

So either:

  1. Install the "MacOS (Apple Silicon)" build of Julia from https://julialang.org/downloads/ and keep your current install of CPLEX, or
  2. Install the x86 (Intel) version of CPLEX

odow avatar Jun 05 '23 23:06 odow

Thanks Oscar for the quick replies! It worked :)

fares2201 avatar Jun 06 '23 14:06 fares2201