how to resolve Import error in gurobi solver - gurobi

i am using ubuntu system and trying to implement a simple optimization problem in pyomo using gurobi solver but came acroos following error
ERROR: Solver (gurobi) returned non-zero return code (1)
: Solver log: ImportError: No module named site
[ 0.03] Pyomo Finished
ERROR: Unexpected exception while running model:
Solver (gurobi) did not exit normally
errorcode: 1
i installed gurobi using conda
i added below lines in .bashrc file
but still could'nt get the result
export GUROBI_HOME="/home/yash/anaconda3/pkgs/gurobi-8.1.1-py36_0"
export PATH="${PATH}:${GUROBI_HOME}/bin"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"
and i can import site from python so that is not the problem
output errors which i got

Related

How to resolve "module has no attribute 'entropy_decode_index' error in ubuntu for TFF?

I got "module '0b1a516c7ccf3157373118bcf0f434168745c8a4' has no attribute 'entropy_decode_index' error after a clean intall of tensorflow federated (TFF) on Ubuntu 22.04. System: AMD 6900HS, Nvidia3050ti. The first "import tensorflow_federated" line fails.
There is not even a single entry on google concerning this error message and I am shocked.
The detailed error message is:
File "/home/egosis/venv/lib/python3.9/site-packages/tensorflow_compression/python/ops/init.py", line 17, in
from tensorflow_compression.python.ops.gen_ops import *
AttributeError: module '0b1a516c7ccf3157373118bcf0f434168745c8a4' has no attribute 'entropy_decode_index'
Every answer is gladly appreciated.
I tried installing TFF v0.46.0, v0.45.0 and v0.44.0 of tff but it did not help.

Mypy typing errors when upgrading to Twisted 21.2.0

In trying to upgrade the Twisted package from 20.3.0 to 21.2.0.
After the upgrade, when running Mypy I'm getting the following errors when accessing the reactor (from twisted.internet import reactor):
error: Module has no attribute "run" [attr-defined]
error: Module has no attribute "running" [attr-defined]
error: Module has no attribute "running" [attr-defined]
error: Module has no attribute "callLater" [attr-defined]
error: Module has no attribute "callInThread" [attr-defined]
error: Module has no attribute "callFromThread" [attr-defined]
error: Module has no attribute "spawnProcess" [attr-defined]
error: Module has no attribute "spawnProcess" [attr-defined]
When running Mypy with reveal_type(reactor):
Revealed type is '_importlib_modulespec.ModuleType'
I'm trying to understand what is the best way to handle this situation without just ignoring the errors so I can have the type checking when using the reactor.
Is there a better way to import the reactor? Is there a way to mark the type of the reactor for Mypy? should I cast it to a type every time before using it?
This seems to be an assigned bug in Twisted (https://twistedmatrix.com/trac/ticket/9909) and the proposed fix sounds like a breaking change.
One of the comments on their Trac describes casting it, as you suggest, as a workaround:
from typing import cast
import twisted.internet.reactor
from twisted.internet.interfaces import IReactorCore
reactor = cast(IReactorCore, twisted.internet.reactor)
reactor.run()
It took a ridiculous amount of searching but I finally found the solution in the Twisted source code itself. Add the following comment to the end of your line:
# type: ignore[attr-defined]
for example:
reactor.callFromThread(reactor.stop) # type: ignore[attr-defined]
That will "fix" it.

react-native-progress-webview Unable to resolve module

I found this project interesting at the NPM,
https://www.npmjs.com/package/react-native-progress-webview
however I followed the instruction, it shows the following error:
error: bundling failed: Error: Unable to resolve module `react-native-progess-webview` from `mycomponent.js`: Module `react-native-progess-webview` does not exist in the Haste module map
I already installed 'react-native-webview' and it works fine, however react-native-progess-webview seems not able to be imported.
I am just simply importing the library like this:
import ProgressWebView from "react-native-progess-webview";
How to solve?
I found that it is a typo in the tutorial, in the tutorial it is:
import ProgressWebView from "react-native-progess-webview";
but the correct one is:
import ProgressWebView from "react-native-progress-webview";
There is an "r" in the "progress".

ImportError: cannot import name 'preprocessor_pb2' in the training part after installation was successful

I installed the object detection API correctly using this https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md and I checked by running model_builder_test.py
This gave me a OK result.
Then I moved on to running the train.py on my dataset using the following command
python train.py --logtostderr --pipeline_config_path=pipeline.config --train_dir=train_file
And I am getting the error ImportError: cannot import name 'preprocessor_pb2'
This particular preprocessor_pb2.py exists in the path it is looking for i.e
C:\Users\SP-TestMc\Anaconda3\envs\tensorflow\models-master\models-master\research\object_detection\protos
What could be the reason for this error then?
See https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md#protobuf-compilation. Sounds like you need to compile the protos before using the Python scripts.

Error while using web version of Gurobi solver

I am trying to solve a linear programming problem using the Gurobi solver web version. This is the link: http://www.neos-server.org/neos/solvers/index.html
But irrespective of the problem I submit, I get the following error:
---------- Begin Solver Output -----------
Executing /opt/neos/Drivers/gurobi/gurobi-mps-wrapper-driver.py at time: 2013-06-10 14:17:48.434197
Error: /usr/bin/env: /opt/gurobi/latest/linux64/bin/python2.5: No such file or directory
I am submitting files in the MPS format.
Why am I getting this error?