ERROR: LoadError: UndefVarError: `Gurobi` not defined
回答済みHi Gurobi Team,
I would like to use Gurobi Solver to run a GenX model research; however, I keep receiving "ERROR: LoadError: UndefVarError: `Gurobi` not defined" (as what attachment 1 shown) while running a case by executing the command julia> include(“<path to your case>/Run.jl”)
My computer is MacBook Air (M1, 2020) and below is the version for each packages.
(base) doriskong@10-16-167-201 ~ % gurobi_cl --version
Gurobi Optimizer version 9.5.2 build v9.5.2rc0 (mac64[arm])
Copyright (c) 2022, Gurobi Optimization, LLC
julia> using Pkg
julia> Pkg.status()
Project GenX v0.3.6
Status `~/Desktop/Hydrogen/GenX-main/Project.toml`
[6e4b80f9] BenchmarkTools v1.3.2
[336ed68f] CSV v0.10.11
[9961bab8] Cbc v1.2.0
[e2554f3b] Clp v1.0.3
[aaaa29a8] Clustering v0.15.5
[861a8166] Combinatorics v1.0.2
[a93c6f00] DataFrames v1.6.1
[864edb3b] DataStructures v0.18.15
[b4f34e82] Distances v0.10.11
[2e9cd046] Gurobi v1.2.0
[87dc4568] HiGHS v1.7.5
[4076af6c] JuMP v1.16.0
[b8f27783] MathOptInterface v1.23.0
[731186ca] RecursiveArrayTools v2.38.10
[2913bbd2] StatsBase v0.34.2
[ddb6d928] YAML v0.4.9
[ade2ca70] Dates
[37e2e46d] LinearAlgebra
[9a3f8284] Random
[10745b16] Statistics v1.9.0
Last but not least, I have checked my Gurobi.jl package is compatible with the installed Gurobi Optimizer by running a simple linear optimization problem. I am also attaching the codes in the Run.jl file I executed, which is from Ricks, W., Xu, Q., & Jenkins, J. D. (2022).
Thank you so much for your assistance and I look forward to any suggestions you may have.
-
> Attachment 1

> Attachment 2
0 -
Hi,
Are you able to follow the steps and successfully run an example that are listed on the GenX README?
- Riley
0 -
Hi Riley,
Thank you so much for your prompt response! Yes I am. I followed the steps listed on the GenX readme step by step and also successfully run all cases in the example_systems folder, although I'm not sure whether all cases in the example_systems folder used Gurobi optimization tool or not.

0 -
Hi,
We've noted that there are the following lines in GenX.jl which may be relevant:
# Uncomment if Gurobi or CPLEX active license and installations are there and the user intends to use either of them
#using CPLEX
#using Gurobi
Based on your screenshots I believe you will need to modify:/Users/doriskong/Desktop/GenX-main/src/GenX.jl
After uncommenting the line for Gurobi, can you try again in a fresh instance of the Julia REPL and see if this resolves your issue?
- Riley
0 -
Hi Riley,
I really appreciate your help! I have uncomment the Gurobi, and this time the errors turn out to be
ERROR: LoadError: IOError: readdir("/Users/doriskong/Desktop/GenX-main/../../2030/100CFE_2030_SoCal_1000_4kg/Inputs"): no such file or directory (ENOENT)
But I have checked the path is right and there're indeed have "Inputs" files...
If I run the
include("2030_MoreZones/100CFE_2030_SoCal_1000_4kg/Run_247.jl"), then the error will turn out to be
ERROR: LoadError: SystemError: opening file "/Users/doriskong/Desktop/GenX-main/Settings/genx_settings.yml/gurobi_settings.yml": Not a directory
I'm not sure whether it's because I have cloned the "Settings" folder in the GenX-main folder. If I didn't cloned the "Settings" folder , the terminal will keep showing this error:
ERROR: LoadError: SystemError: opening file "/Users/doriskong/Desktop/GenX-main/Settings/genx_settings.yml": No such file or directory
Below are the screenshots after I uncomment the Gurobi and comment out the other Solvers.



The related codes in the "2030_MoreZones" folder can be accessed here: https://zenodo.org/records/7442511
As a note, I just used the raw files I accessed from the above website and haven't done any adjustments.
Thanks again for your time and effort!!!
0 -
Hi Jia Yi Kung,
This has ventured into not being an Gurobi-related issue so I can only provide some brief suggestions. This is now either a GenX issue or an issue with the code published by the authors of the paper. My guess is the latter, the use of relative paths doesn't seem robust and they provide little documentation. However my recommendations are:
* Remove the Settings folder in your GenX-main
* In the Julia REPL change directory to the one containing Run_247.jl and try runninginclude("Run_247.jl")from within that directory.
- Riley
0 -
Hi Riley,
Thanks and appreciate for your time and effort on this matter! Following your recommendations, I have removed the Settings folder in my GenX-main and changed directory in the Julia REPL. At this point, I also Replaced
`julia --project="/tigress/wricks/
GenX_CFE" Run_247.jl `with
`julia --project="." Run_247.jl`
in the Run_247.sh file (/Users/doriskong/Desktop/GenX-main/2030_MoreZones/100CFE_2030_SoCal_1000_4kg/Run_247.sh).
At this point, I continue to receive this error despite I import lots of packages it asked for:
"ERROR: LoadError: Failed to precompile GenX [top-level] to "/Users/doriskong/.julia/compiled/v1.9/ jl_MYzAxq”


I understand that this might not be an Gurobi-related issue anymore but will open to any suggestions and advice. Thanks again for your guidance along the way! :)
0 -
Hi,
My only advice is to follow the instructions suggested in the error:
Run 'Pkg.instantiate()' to install all recorded dependencies
- Riley
0 -
Hi Jia Yi Kung,
I am having the same problem when trying to use Gurobi with GenX. Did you ever figure this out?
-Ivy
0 -
Hi Rachael,
I have figured it out but I'm not sure whether you used the same dataset as I have. My problem was solved after the authors updated the version of their dataset, which includes the 24/7 matching constraints.
Also, the dataset I used here requires more RAM to run than a single desktop can provide, so I ended up using only a single region for my study. Hope this helps!Best,Doris0 -
Thanks for responding, I doubt we are using the same data sets but I was assuming it was some sort of Path issue that I cant figure out since the Error message seems to be that GenX can't find a reference to Gurobi.
I'm not entirely sure what you mean by 24/7 matching constraints, the time domain reduction? At this stage I'm just trying to get an example system to run.
Thanks,
Rachael
0
サインインしてコメントを残してください。
コメント
11件のコメント