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

A subtle oddity in Python 3.5 on Windows #18

Closed
langit opened this issue Dec 14, 2016 · 2 comments
Closed

A subtle oddity in Python 3.5 on Windows #18

langit opened this issue Dec 14, 2016 · 2 comments

Comments

@langit
Copy link

langit commented Dec 14, 2016

This is a very subtle problem, it only occurs for Python 3.5 on Windows.
First of all, solve() should invoke swiglpk.glp_simplex() and print out some messages.
Then this weird exception never happens on other combinations of platforms and Python versions.
To install pymprog to replicate this, just do: pip install pymprog

Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:16:59) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> from pymprog import *
>>> begin('t')
model('t') is the default model.
>>> maximize(15*x + 10*y, 'profit')
Max profit: 15 * x + 10 * y
>>> x <= 3
0 <= x <= 3 continuous
>>> y <= 4
0 <= y <= 4 continuous
>>> x + y <= 5
R1: x + y <= 5
>>> solve()
>>> sensitivity()

PyMathProg 1.0 Sensitivity Report Created: 2016/12/14 Wed 12:30PM
================================================================================
Variable            Activity   Dual.Value     Obj.Coef   Range.From   Range.Till
--------------------------------------------------------------------------------
 x                         3            5           15           10          inf
*y                         2            0           10            0           15
StopIteration

During handling of the above exception, another exception occurred:

SystemError: <built-in function delete_doubleArray> returned a result with an error set

During handling of the above exception, another exception occurred:

SystemError: <built-in function delete_intArray> returned a result with an error set

During handling of the above exception, another exception occurred:

SystemError: <built-in function delete_doubleArray> returned a result with an error set

During handling of the above exception, another exception occurred:

SystemError: <built-in function delete_doubleArray> returned a result with an error set

During handling of the above exception, another exception occurred:

SystemError: <built-in function delete_intArray> returned a result with an error set

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<pyshell#9>", line 1, in <module>
    sensitivity()
  File "<string>", line 10, in sensitivity
  File "C:\Users\phbs\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pymprog.py", line 5580, in sensitivity
    me.sensit()
  File "C:\Users\phbs\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pymprog.py", line 5574, in sensit
    me.coef_ranges()
  File "C:\Users\phbs\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pymprog.py", line 5608, in coef_ranges
    for vals in me._viter(cols): print(fmt%vals)
SystemError: <built-in function delete_doubleArray> returned a result with an error set
@phantomas1234
Copy link
Contributor

Hi, I am sorry, I overlooked this issue. I don't have a Windows machine unfortunately, so I can't try it. I tried to it on my mac but then this happened

In [1]: from pymprog import *
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-1-99a5561cc5c9> in <module>()
----> 1 from pymprog import *

/Users/niso/Downloads/pymathprog/pymprog.py in <module>()
    352             print("'''", d, "''',\n", sep='')
    353 
--> 354 class LinkGLPK(type):
    355     '''this metaclass will add glpk functions related to a problem instance
    356 to a class that wraps such an instance. the instance will be stored in

/Users/niso/Downloads/pymathprog/pymprog.py in LinkGLPK()
    359     glpk_h = 'glpk-4.60/src/glpk.h'
    360     doc_dir = 'glpk-4.60/doc'
--> 361     _related = Extractor(glpk_h, doc_dir).lp_related()
    362 
    363     _related ={

/Users/niso/Downloads/pymathprog/pymprog.py in lp_related(me, silent)
    338 
    339     def lp_related(me, silent=False):
--> 340         funs = me.grep_funs(r'(glp_\w+)\s*\(\s*glp_prob\s*\*', 1)
    341         dod = me.grep_doc(funs)
    342 

/Users/niso/Downloads/pymathprog/pymprog.py in grep_funs(me, rex, i)
    114         rex = me.re.compile(rex)
    115         funs = []
--> 116         with open(me.glpk_h) as header:
    117             for line in header:
    118                 if "#ifdef GLP_UNDOC" in line:

FileNotFoundError: [Errno 2] No such file or directory: 'glpk-4.60/src/glpk.h'

I have glpk 4.61 installed. Would it be possible to not hardcode the version? GLPK versions in the swiglpk wheels will probably change over time.

@cdiener
Copy link
Member

cdiener commented Jan 11, 2022

Seems to be fixed now.

@cdiener cdiener closed this as completed Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants