Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error:Unable to locate KNITRO installation, please check your environment variable KNITRODIR. #184

Closed
yecyn opened this issue Apr 19, 2021 · 5 comments

Comments

@yecyn
Copy link

yecyn commented Apr 19, 2021

Hello,

I've downloaded KNITRO from Artelys, and I have unpacked the zip file and have a folder named "knitro-12.3.0-MacOS-64" under my home file.

However, while I was running the using KNITRO in jupyter notebook, I got the following error:

Failed to precompile KNITRO [67920dd8-b58e-52a8-8622-53c4cffbe346] to /Users/lshi/.julia/compiled/v1.6/KNITRO/jl_HkU5Zq.

Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IJulia.IJuliaStdio{Base.PipeEndpoint}, internal_stdout::IJulia.IJuliaStdio{Base.PipeEndpoint})
   @ Base ./loading.jl:1360
 [3] compilecache(pkg::Base.PkgId, path::String)
   @ Base ./loading.jl:1306
 [4] _require(pkg::Base.PkgId)
   @ Base ./loading.jl:1021
 [5] require(uuidkey::Base.PkgId)
   @ Base ./loading.jl:914
 [6] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:901
 [7] eval
   @ ./boot.jl:360 [inlined]
 [8] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base ./loading.jl:1094

The I tried running ] build KNITRO, but got the following error:

Error building `KNITRO`: 
ERROR: LoadError: Unable to locate KNITRO installation, please check your environment variable KNITRODIR.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] top-level scope
   @ ~/.julia/packages/KNITRO/8BikX/deps/build.jl:45
 [3] include(fname::String)
   @ Base.MainInclude ./client.jl:444
 [4] top-level scope
   @ none:5
in expression starting at /Users/lshi/.julia/packages/KNITRO/8BikX/deps/build.jl:44

Stacktrace:
  [1] pkgerror(msg::String)
    @ Pkg.Types /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Types.jl:55
  [2] (::Pkg.Operations.var"#81#86"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec})()
    @ Pkg.Operations /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:1040
  [3] withenv(::Pkg.Operations.var"#81#86"{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"#108#112"{String, Pkg.Operations.var"#81#86"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec}, Pkg.Types.PackageSpec})()
    @ Pkg.Operations /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:1540
  [5] with_temp_env(fn::Pkg.Operations.var"#108#112"{String, Pkg.Operations.var"#81#86"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec}, Pkg.Types.PackageSpec}, temp_env::String)
    @ Pkg.Operations /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:1442
  [6] (::Pkg.Operations.var"#107#111"{Pkg.Operations.var"#81#86"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec}, Pkg.Types.Context, Pkg.Types.PackageSpec, String, Pkg.Types.Project, String})(tmp::String)
    @ Pkg.Operations /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:1515
  [7] mktempdir(fn::Pkg.Operations.var"#107#111"{Pkg.Operations.var"#81#86"{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 /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:1481
 [10] build_versions(ctx::Pkg.Types.Context, uuids::Vector{Base.UUID}; verbose::Bool)
    @ Pkg.Operations /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:1021
 [11] build(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}, verbose::Bool)
    @ Pkg.Operations /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:902
 [12] build(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; verbose::Bool, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Pkg.API /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:893
 [13] build
    @ /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:877 [inlined]
 [14] #build#70
    @ /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:73 [inlined]
 [15] build(pkgs::Vector{Pkg.Types.PackageSpec})
    @ Pkg.API /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:72
 [16] do_cmd!(command::Pkg.REPLMode.Command, repl::IJulia.MiniREPL)
    @ Pkg.REPLMode /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Pkg/src/REPLMode/REPLMode.jl:408
 [17] do_cmd(repl::IJulia.MiniREPL, input::String; do_rethrow::Bool)
    @ Pkg.REPLMode /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Pkg/src/REPLMode/REPLMode.jl:386
 [18] top-level scope
    @ In[18]:1
 [19] eval
    @ ./boot.jl:360 [inlined]
 [20] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
    @ Base ./loading.jl:1094

It would great if someone could please help me, thank you so much!

@odow
Copy link
Member

odow commented Apr 19, 2021

I guess you need something like:

ENV["KNITRODIR"] = "~/knitro-12.3.0-MacOS-64"
] build KNITRO
using KNITRO

The documentation should be improved.

@yecyn
Copy link
Author

yecyn commented Apr 20, 2021

Yes, thank you so much!!

@chengg04
Copy link

I still receive the same error message after setting the environment variable. More specifically, after ENV["KNITRODIR"] = "~/knitro-13.0.1-MacOS-M1 and ] build KNITRO, I got the message Error:Unable to locate KNITRO installation, please check your environment variable KNITRODIR..

I tried a workaround where I directly create a deps.jl file inside KNITRO.jl package folder, and put in the following lines:

const libknitro = "~/knitro-13.0.1-MacOS-M1/lib/libknitro.dylib"
const amplexe = "~/knitro-13.0.1-MacOS-M1/knitroampl/knitroampl"

and received the following error when trying to build KNITRO:

ERROR: LoadError: could not load library "/Users/chengguo/knitro-13.0.1-MacOS-M1/lib/libknitro.dylib"
dlopen(/Users/chengguo/knitro-13.0.1-MacOS-M1/lib/libknitro.dylib, 0x0001): tried: '~/knitro-13.0.1-MacOS-M1/lib//libknitro.dylib' (no such file), '/libknitro.dylib' (no such file), '/Users/chengguo/knitro-13.0.1-MacOS-M1/lib/libknitro.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '~/knitro-13.0.1-MacOS-M1/lib//libknitro1301.dylib' (no such file), '/libknitro1301.dylib' (no such file), '/Users/chengguo/knitro-13.0.1-MacOS-M1/lib/libknitro1301.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

which seems to indicate that I should install a Knitro version for Intel processor, even though I have an M1 Mac.

@odow
Copy link
Member

odow commented May 14, 2022

Hi @chengg04, what is versioninfo()? Are you running the M1 build of Julia?

Note that most solvers (and JuMP) have troubles with M1 at the moment: jump-dev/JuMP.jl#2971. I would stick to the Intel builds and Rosetta.

p.s. please make a new post rather than commenting on an old closed issue.

@chengg04
Copy link

Thank you very much @odow. You are right, my Julia build is for Intel (via Rosetta), not for M1. I re-downloaded Knitro for OSX Intel and was able to run it with Julia.

I'll remember to make a new post next time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants