Forum Discussion
FICO
9 years agoCommunity Manager
xpress python module: has no attribute
I am trying to use xpress with python for the first time. I have installed Xpress 8.3 32 bit. I am trying to run the first example from A Practical Guide to the New Python Interface for FICO Xpress Optimizer | FICO® (http://www.fico.com/en/latest-thinking/on-demand-webinar/a-practical-guide-to-the-new-python-interface-for-fico-xpress-optimizer)
if I run:
import xpress as xp
x = xp.var(vartype = zp.integer, lb= -1, ub = 5)
Then I get the error:
AttributeError: module 'Xpress' has no attribute 'var'
I get a similar error when I try to use xp.problem
Does anyone know why this is happening?
Kind regards,
Meagan
2 Replies
- FICOCommunity Manager
Hi Meagan,
that's a weird error, since var and problem are two fundamental classes in the Xpress module. For what it's worth, a similar error happened to me a few times when there was a "xpress.py" file around with no valuable content. The effect of the "import xpress" command is that of importing all objects from xpress.py, which prevents from importing the actual module. I assume this depends very much on where you run the command. Can you check the files in the directory where you're running Python?
Also, while we're at it: make sure you replace that zp.integer with xp.integer in the call to xp.var().
Pietro
- FICOCommunity Manager
Hi again Meagan,
we have found recently a problem with the Python interface that might explain the behavior you are observing. We have fixed the bug and it will be gone in the next patch release.
Related Content
Related Content
Problem with Xpress installation: Module `mminsight' not found.
I attempted a new installation of Xpress and Insight on a Windows 11 PC. (Downloaded files yesterday.) xp9.8.0_win_x86_64_setup.exe and FICO_Xpress_Insight_5.16.1_Community_Edition_setup.exe installe...8 months agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum1 unread comment1 unread19Views0likes1Comment

