How can I solve the problem of "missing GUROBI_LIBRARY"? - cmake

I encountered the following problem when I was trying to run the code from Fast and Safe Trajectory Planner for Flights in Unknown Environments
CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find GUROBI (missing: GUROBI_LIBRARY)
I think I followed all the instructions correctly and the file ~/.bashrc is appended with the following statements:
source /opt/ros/melodic/setup.bash
export GUROBI_HOME="/home/zjnyly/Desktop/gurobi911/linux64"
export PATH="${PATH}:${GUROBI_HOME}/bin"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"
export GRB_LICENSE_FILE="/home/zjnyly/gurobi.lic"
source /home/zjnyly/Desktop/ws//devel/setup.bash
I then tried to change the version of gurobi manully in FindGUROBI.cmake file, but I don't know how to correctly write it.
(the version of gurobi on my computer is 9.1.1)
find_library(GUROBI_LIBRARY
NAMES gurobi gurobi91
HINTS ${GUROBI_DIR} $ENV{GUROBI_HOME}
PATH_SUFFIXES lib)
I'm new to this field and I don't know much about these things. I'd appreciate it if you could help me. Thanks!

I guess you did not set your environment variables correctly, please check.
As the work only tested in Ubuntu 16.04/ROS Kinetic, Ubuntu 18.04/ROS Melodic and
Gurobi 8.1, Gurobi 9.0, and Gurobi 9.1. so use the relevant version.

Related

Library not loaded: #rpath/libtbb.dylib in Prophet / Python

I'm on a Mac X1, Monterey.
I've installed prophet and run into this issue when trying to fit a model.
RuntimeError: Error during optimization: console log output:
dyld[90668]: Library not loaded: #rpath/libtbb.dylib
Referenced from: /Users/{username}/opt/anaconda3/lib/python3.9/site-packages/prophet/stan_model/prophet_model.bin
Reason: tried: '/private/var/folders/cd/dfrqgp4s4ll55cwb7rtgccbw0000gq/T/pip-install-rjpuj450/prophet_d7e4cce10e414c89a572fe3605ae9269/build/lib.macosx-11.1-arm64-cpython-39/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib' (no such file), '/private/var/folders/cd/dfrqgp4s4ll55cwb7rtgccbw0000gq/T/pip-install-rjpuj450/prophet_d7e4cce10e414c89a572fe3605ae9269/build/lib.macosx-11.1-arm64-cpython-39/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib' (no such file), '/usr/local/lib/libtbb.dylib' (no such file), '/usr/lib/libtbb.dylib' (no such file)
I know this has to do with the wrong paths being searched. I can find the dylib in
/Users/{user}/opt/anaconda3/lib/python3.9/site-packages/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/
But, it seems prophet doesn't know to look there. I'm curious how I can update/fix either the rpath variable or find another solution?
I tried to create a symbolic link with sudo ln -s, but don't have permissions on the laptop.
TIA!
I got it to work on Apple Silicon (M1 Max in my case) by installing older versions of both pystan and prophet:
pip install pystan==2.19.1.1
pip install prophet==1.0
The other important piece of the puzzle is that you should use Python 3.8 to get it working.
Installing older versions of the libraries and using Python 3.8 are both talked about in issue #2002 on Github, but there's not really an explanation of the libtbb.dylib error message.

Setting MIP and NLP solvers path using Pyomo MindtPySolver

I am using Pyomo 5.6.8 and trying to resolve a non linear optimization problem using MindtPySolver.
I have no issue on my local machine, simply calling the solve method with these arguments:
SolverFactory('mindtpy').solve(model, mip_solver='cbc', nlp_solver='ipopt')
However, when I go cloud on Azure, Pyomo doesn't get the path to the CBC and IPOPT solvers. When needing to resolve a problem that is linear, I can bypass the issue using the following command, by adding executable argument when creating SolverFactory instance with a LP solver:
SolverFactory("cbc", executable="/path/to/my/virtual/env/bin/cbc")
In my non-linear programming case, MindtpySolver doesn't accept additional argument. I looked at the doc & source code and couldn't find option to specify solver path, that is unfortunately not recognized by default on my Azure environment.
I tried to pass options using the "solver_args" options found on source code like this:
SolverFactory('mindtpy').solve(
model,
nlp_solver_args={
"executable": "/path/to/my/virtual/env/bin/ipopt"
},
mip_solver_args={
"executable": "/path/to/my/virtual/env/bin/cbc"
},
mip_solver='cbc', nlp_solver='ipopt',
)
But I'm still getting "WARNING: Could not locate the 'ipopt' executable, which is required for solver" like errors. I insist on the fact that all solvers (here cbc and ipopt) can be found in my virtual environment.
Is there a way to specify solvers path using MindtPySolver?
I may have same issue too, My optimize problem is Mixed-Integer Nonlinear Programs, and it have to using "SolverFactory('mindtpy').solve(model, mip_solver='glpk', nlp_solver='ipopt')" And the solver is in Django Framework with Apache2 WSGI Service which WSGIDaemonProcess : Conda Env.
When call api via Web Browser. It will rise error like cannot find "ipopt" solver. and "glpk" solver too. and SolverFactory allow us set only one Executable.
BTW, Already find out how to fix it.
After you install ipopt and plugin solver via Conda install.
Just going deep in python package and edit raw file.
My path are below:
/home/user/miniconda3/envs/py385/lib/python3.8/site-packages/pyomo/solvers/plugins/solvers/GLPK.py
/home/user/miniconda3/envs/py385/lib/python3.8/site-packages/pyomo/solvers/plugins/solvers/IPOPT.py
Find function below and change it.
def _default_executable(self):
executable = Executable('/home/user/miniconda3/envs/py385/bin/glpsol')
def _default_executable(self):
executable = Executable("/home/user/miniconda3/envs/py385/bin/ipopt")
You can find where is plugin solver located by type in terminal command
"which ipopt", "which glpsol"

Installed gurobi , not refelecting when importing

I have installed gurobi, however it does not get reflected when importing.
I get the following error:
No module name gurobi
You didn't write which API you are using. If you are using python, you should use import gurobipy and not gurobi. You also need to setup some environment variables (GUROBI_HOME, PATH and LD_LIBRARY_PATH). See Gurobi quick start guide.

How to let TensorFlow XLA know the CUDA path

I installed TensorFlow nightly build version via the command
pip install tf-nightly-gpu --prefix=/tf/install/path
When I tried to run any XLA example, TensorFlow has error "Unable to find libdevice dir. Using '.' Failed to compile ptx to cubin. Will attempt to let GPU driver compile the ptx. Not found: /usr/local/cuda-10.0/bin/ptxas not found".
So apparently TensorFlow cannot find my CUDA path. In my system, the CUDA is installed in /cm/shared/apps/cuda/toolkit/10.0.130. Since I didn't build TensorFlow from source, by default XLA searches the folder /user/local/cuda-*. But since I do not have this folder, it will issue an error.
Currently my workaround is to create a symbolic link. I checked the TensorFlow source code in tensorflow/compiler/xla/service/gpu/nvptx_compiler.cc. There is a comment in the file "// CUDA location explicitly specified by user via --xla_gpu_cuda_data_dir has highest priority." So how to pass values to this flag? I tried the following two environment variables, but neither of them works:
export XLA_FLAGS="--xla_gpu_cuda_data_dir=/cm/shared/apps/cuda10.0/toolkit/10.0.130/"
export TF_XLA_FLAGS="--xla_gpu_cuda_data_dir=/cm/shared/apps/cuda10.0/toolkit/10.0.130/"
So how to use the flag "--xla_gpu_cuda_data_dir"? Thanks.
you can run export XLA_FLAGS=--xla_gpu_cuda_data_dir=/path/to/cuda in terminal
There is a code change for this issue, but not clear how to use. Check here https://github.com/tensorflow/tensorflow/issues/23783

Not getting TBB to compile test examples

I am not getting TBB to work. I am following the steps in the "Getting started" document.
I am doing the following steps:
downloading the linux files + the sources files.
extracting them in 1 directory
calling make
going to tbb.../bin calling source tbbvars.sh intel64
going to examples/Getting_started/sub_string_finder
calling make
I then get the error:
sub_string_finder.cpp:32:30: fatal error: tbb/parallel_for.h: No such file or directory
I really googled a lot but can't find any related stuff.
I did also try to add some -I statement but it didnt help
I assume it is kind of a including/linking problem but I dont know how to fix.
This is all done on fedora 16 64bit. (kernel 3.1.4) // TBB version 4.0
The solution was to install tbb-devel package.