-
Notifications
You must be signed in to change notification settings - Fork 69
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
Python 3 support for CyLP #28
Conversation
Python 3 does not differentiate betten int and long so the PyInt_ functions must be replaced with PyLong_. Macros from cx_Oracle project.
The izip function fron itertools was removed from Python 3, use of zip is recommended.
TypeError and NotImplementedError are build ins
long was removed in Python 3, use int in its place.
The build in reduce function was removed in Python 3 and must be imported from functools.
Due to the different methods that Python 2 and 3 represent strings it is necessary to encode the filename passed to the readMps function which can then be converted into a char* pointer for use in C. Since strings do not share a type in Python 2 and 3 the filename argument of the readMps function must not be typed.
1b798eb has a mistake: it's missing a parenthesis at the end of the line:
in file QP.py in the same commit in QPGen.py on the very first line it's missing a "t" to import:
I also get an error when executing "python setup.py install" (but I have it with pip install too...): The culprit is the s_README encoding. I just commented it out from setup.py but I guess the encoding from the getBdistFriendlyString function should be fixed instead. Thanks! |
Good catch on those mistakes @sebastroy, I added a commit to fix them. Investigating the install issue. |
Great thanks! |
This may break the bdist_mpkg and bdist_wininst commands
Commit 13d5619 seem to fix the install issue although it might have broken the bdist_mpkg and bdist_wininst commands in setup.py. With commit 89ce697 and 7fd344c I am able to run
Unfortunately my knowledge of bdist_mpkg is limited and I have no idea where to begin to debug this. I get the same error messages on the current master so this may be limited to my machine. I have no way of easily testing the bdist_wininst command. |
I'm on linux myself... If I replace the call to getBdistFriendlyString and use plain "u" like the other two lines, install works but it possibly breaks the 2.7 version... In a nutshell, the issue is under python 2, str = bytes and under 3, bytes = bytes. |
Wanted to bump this PR and see if there was anything blocking this from being merged. I am very interested in having a Python 3 version of CyLP and am willing to fix up any outstanding issues. |
Fine by me |
Ping.. I am almost entirely 3 now.. Would be great to see this in the master branch |
Ditto on a desire to see this in master. |
It would be really great to see python3 support from CyLP |
Are we going to see action on this? |
Bump, Is this ever happening? |
I would still like to get back to CyLP and spend some time addressing the backlog of PRs, but I have obviously lost credibility in claiming this will happen. I will try to find a weekend soon when I can play with it. Obviously, it is not difficult to merge the PR. The time consuming part is testing. If those who have been using CyLP with Python 3 can post and say what their experience has been, it would be helpful in getting a level of comfort. |
I did not use this pull-request extensively, but i never approached problems! While documentation and (mostly) missing development is depressing, it's still a very interesting project and official python3 support would be great! (Two examples: footrule-ranking (Clp), kemeny-ranking (Cbc)) |
We are now just redirecting folks for Py-ART to use the @jjhelmus branch. Having master fork updated with jjhelmus/py3 would be great |
I don't think a fork would be in anyone's best interest. Although this is not exactly my project, I do have the ability to add collaborators and I think I said at some point that I would be happy to hear from anyone who is willing to help, though maybe that got lost in the fray. The implication of the above comment is that there are people who would be happy to help. I would want to have some discussions with those people to make sure we're on the same page, but this seems to be the way forward. |
Ok! I can help.. It looks like we have some conflicts. |
@jjhelmus was it just Py3 compatibility issues or did you refactor? I am wondering if I should start with the current master and work from that or try to resolve the conflicts. |
Actually now I look at the commits it looks quite involved. |
I created this patch over two years, I do not recall what all was done. Unfortunately, I do not have the time to re-work the patches or otherwise move this forward. I'd be happy for someone else to pick up this work but I cannot offer any help myself. |
No worries and understand @jjhelmus |
As there haven't been very many commits since this PR was created and such commits were not very involved, I hope that resolving the conflicts would be not be too difficult. @scollis, perhaps we can schedule a face-to-face meeting and discuss a strategy? It would certainly be helpful to have someone who's using CyLP regularly and has a little bandwidth to push this forward. I'll actually be using CyLP with students in the next month or two and I'm sure they will be wanting to use Python 3, so between the two of us, we should be able to get this going. |
Hi everyone, is CyLP a live project? I'm a developer of cvxpy, and we use CyLP to interface to Cbc. It's an important tool for us, so if we can help out in modernizing CyLP let us know. I've posted here because Python 3 support is essential. |
My rule of thumb for "dead" projects is last commit more than 4-6mo ago. For what it's worth, we are using ortools now. It was a bit clunky a few years ago but it came a long way since then and is very stable. It does not have 100% all the cbc features (neither does CyLP for that matter) but it had enough for us. Unlike pulp, it does interface with the coin-or library rather than launch cbc in a shell wrapped in python code. |
Hey @SteveDiamond We still use it.. I have been very slack in taking @tkralphs on his offer.. Having enough trouble with Py-ART which uses CyLP. |
What would be amazing is a LP code in Scipy.optimize or suchlike |
I'm still here and still hoping for a co-maintainer :). Although I have zero credibility left in terms of promises, I am going to be using CyLP myself in one of my classes this semester and will be trying to do some maintenance work over the next couple of weeks. |
I just re-generated the Cython files and updated this PR in #67. |
I posted a beta version with Python 3 support to Pypi:
There is a binary wheel for Windows, but you still need to build Cbc before installing on Linux and OS X. |
I seem to have figured out bug that prevented Cython 0.29 from properly re-generating the files. I re-generated the files once again with Cython 0.29 and just pushed a binary wheel up for Python 3.7 on Windows. With a little more testing, I'll be ready to merge and release an official Python 3 version. |
closes #15