Giter Club home page Giter Club logo

Comments (18)

phantomas1234 avatar phantomas1234 commented on June 12, 2024

Weird, I thought I tested installing the release. Let me try again.

from swiglpk.

phantomas1234 avatar phantomas1234 commented on June 12, 2024

I couldn't reproduce the problem and the error looks a lot like something I tried to fix before I released 1.2.0. So I just made a new release. Can you check if you still have the problem?
I also removed the 1.1.2 and 1.1.3 releases from pypi because they're broken (I forgot to remove them earlier).

Here is what I get:

(swiglpk3.4)megatron-5390:~ niso$ pip install swiglpk
Collecting swiglpk
  Downloading swiglpk-1.2.1.tar.gz
Installing collected packages: swiglpk
  Running setup.py install for swiglpk
Successfully installed swiglpk-1.2.1
You are using pip version 6.0.8, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(swiglpk3.4)megatron-5390:~ niso$ python
Python 3.4.3 (default, Mar 23 2015, 04:19:36) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import swiglpk
>>>

from swiglpk.

jonls avatar jonls commented on June 12, 2024

I still have the same problem with 1.2.1. I think you are not hitting this issue because you are still using pip 6. The new cache system in pip 7 means that pip install will use bdist_wheel to build a cached wheel. This can be disabled with --no-cache-dir as I mentioned above. It still seems to me that bdist_wheel is broken though.

from swiglpk.

phantomas1234 avatar phantomas1234 commented on June 12, 2024

Hmmm, I tried with --no-cache-dir before. Here is what I get with a newer version of pip.

(cameo3.4)megatron-5390:~ niso$ pip uninstall swiglpk
You are using pip version 7.1.0, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Uninstalling swiglpk-1.1.2:
  /Users/niko/.virtualenvs/cameo3.4/lib/python3.4/site-packages/swiglpk.egg-link
Proceed (y/n)? y
  Successfully uninstalled swiglpk-1.1.2
(cameo3.4)megatron-5390:~ niso$ pip uninstall swiglpk
You are using pip version 7.1.0, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Cannot uninstall requirement swiglpk, not installed
(cameo3.4)megatron-5390:~ niso$ pip install swiglpk
You are using pip version 7.1.0, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting swiglpk
  Using cached swiglpk-1.2.1.tar.gz
Building wheels for collected packages: swiglpk
  Running setup.py bdist_wheel for swiglpk
  Stored in directory: /Users/niko/Library/Caches/pip/wheels/56/4d/d4/481102820ae8d1c9958d7eb5e5ff5108c2f9d6c734a350884a
Successfully built swiglpk
Installing collected packages: swiglpk
Successfully installed swiglpk-1.2.1
(cameo3.4)megatron-5390:~ niso$ python
Python 3.4.3 (default, Mar 23 2015, 04:19:36) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import swiglpk
>>> dir(swiglpk)
['GLP_ASN_MAX', 'GLP_ASN_MIN', 'GLP_ASN_MMP', 'GLP_BF_BG', 'GLP_BF_FT', 'GLP_BF_GR', 'GLP_BR_DTH', 'GLP_BR_FFV', 'GLP_BR_LFV', 'GLP_BR_MFV', 'GLP_BR_PCH', 'GLP_BS', 'GLP_BT_BFS',

Indeed, pip > 7.0.0 seems to use bdist_wheel but I am not hitting your problem. I will try reproduce this on another machine and with your exact pip version. Thank you for your patience.

from swiglpk.

jonls avatar jonls commented on June 12, 2024

I just noticed that you were using Python 3.4 and not Python 2.7 as I was. In Python 3 the issue seems to go away completely so it appears that it is Python 2 specific. I also tested the install on a Linux box with Python 2.7 and it too results in an error, although a different one:

>>> import swiglpk
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jon/env/lib/python2.7/site-packages/swiglpk.py", line 120, in <module>
    class glp_prob(_object):
  File "/home/jon/env/lib/python2.7/site-packages/swiglpk.py", line 126, in glp_prob
    __swig_setmethods__["_opaque_prob"] = _swiglpk.glp_prob__opaque_prob_set
AttributeError: 'module' object has no attribute 'glp_prob__opaque_prob_set'

from swiglpk.

jonls avatar jonls commented on June 12, 2024

@phantomas1234 By the way, you accidentally broke the glp_term_hook when you reverted the change. Part of the code in glpk.i is missing in the latest version.

from swiglpk.

phantomas1234 avatar phantomas1234 commented on June 12, 2024

@jonls Hi, I made a new release and removed all the the shenanigans in setup.py. I hope I was also able to fix the broken glpk.i (sorry for that).

from swiglpk.

jonls avatar jonls commented on June 12, 2024

Thanks. The problem persists in 1.2.3 on OSX/Python 2 with AttributeError: 'module' object has no attribute 'GLP_MAJOR_VERSION' and on Linux/Python 2 with AttributeError: 'module' object has no attribute 'glp_prob__opaque_prob_set'. Interestingly it now also fails on OSX/Python 3 with the same error. Version 1.2.1 did not fail on Python 3. This is with SWIG 3.0.7 and GLPK 4.48 on OSX, and SWIG 1.3.40 and GLPK 4.54 on Linux. The SWIG on Linux is apparently quite old so I'll try a newer version there. It actually works on Travis CI with SWIG 2 so the error on Linux may just be due to the older version.

from swiglpk.

jonls avatar jonls commented on June 12, 2024

Ok, so testing again on Linux with SWIG 3.0.7 I now also get AttributeError: 'module' object has no attribute 'GLP_MAJOR_VERSION' instead of the error with glp_prob__opaque_prob_set that appeared with SWIG 1.3.40. Any ideas?

from swiglpk.

phantomas1234 avatar phantomas1234 commented on June 12, 2024

@jonls hmmm, I guess I need to try it on a linux machine (or any machine that is not my dev machine). I would be very surprised though if I get the same error given that I am testing swiglpk on travis-ci. Do you have glpk properly installed? I thought the installation should fail if you don't, but your error looks very similar to an error that I've seen before where the copied glpk.h header file (copied into the same dir as setup.py) would be overwritten with no content and consequently no glpk methods were wrapped by swig. Can you please check that there is an glpk_clean.h file in the dir after you run setup.py that actually contains glpk declarations? In any case, bare with me, I'll try my best to investigate this. Also, I just realized that there are egg files available for linux on pypi. Could that be an issue? Is setup.py run if a package is installed from egg or is python just putting the uncompressed archive(?) into site-packages?

from swiglpk.

jonls avatar jonls commented on June 12, 2024

Ok, here is the setup that I tried today on the Linux machine (SWIG 3.0.7 and GLPK 4.54): I clone swiglpk from Github then I checkout the 1.2.3 tag. I then do python setup.py bdist_wheel. The glpk_clean.h and glpk_wrap.c are not obviously incorrect (empty or otherwise). Then I take the resulting wheel file and try to install it into a clean virtualenv using

pip install ~/swiglpk/dist/swiglpk-1.2.3-cp27-none-linux_x86_64.whl

Then I open Python and try to import and I end up with the AttributeError as before. Since I can reproduce the error without going to PyPI, I don't think the egg on PyPI is the issue.

I have put a copy of the glpk_clean.h and glpk_wrap.c files here: https://gist.github.com/jonls/e6c0acfe728a5f0df3e1

from swiglpk.

phantomas1234 avatar phantomas1234 commented on June 12, 2024

I was able to reproduce the problem on a lubuntu machine when installing from pypi with pip >= 7.1.2 (no issue on OS X however). Can't reproduce the problem when installing from source via python setup.py bdist_wheel as you suggested. Anyways, I think I am getting closer ...

from swiglpk.

phantomas1234 avatar phantomas1234 commented on June 12, 2024

@jonls Ok, I am back from a long paternity leave. Maybe you have already lost interest in this issue? Congrats on your PLoS CB paper btw! Were you planning to add glpk support to PSAMM by using these bindings? I still can only reproduce the problem (the glp_prob__opaque_prob_set one) when installing from PyPI and not when running python setup.py bdist_wheel and subsequently pip install path/to/swiglpk-....whl like you described. If you want you can get the wheel I generated here. I am curious if you still get the problem. Now, I don't even know where to start with the PyPI issue ... Still no issue on OS X either.
pip install swiglpk --no-cache-dir also does not solve the issue for me (as it did for you at some point).

from swiglpk.

phantomas1234 avatar phantomas1234 commented on June 12, 2024

Ok, I just realized that I also get the "GLP_MAJOR_VERSION" issue on OS X with python 3.5 when installing directly from pypi

from swiglpk.

phantomas1234 avatar phantomas1234 commented on June 12, 2024

This is btw where the original custom build and install commands came from http://stackoverflow.com/questions/12491328/python-distutils-not-include-the-swig-generated-module

from swiglpk.

jonls avatar jonls commented on June 12, 2024

@phantomas1234 Thanks! I'm still interested in solving this issue and eventually adding support for GLPK in PSAMM. I'll take a look at this again when I have some time.

from swiglpk.

phantomas1234 avatar phantomas1234 commented on June 12, 2024

@jonls I think I fixed the bdist_wheel problem. Motivated by this setup.py I wrote a custom CustomBdistWheel cmdclass (these are by the way necessary to ensure that swig is run before anything else so cannot be avoided ...). Can you install swiglpk==1.2.12 from pypi and confirm that the issues are gone? It would make me so happy since it has started to annoy other people as well biosustain/cameo#46.

from swiglpk.

jonls avatar jonls commented on June 12, 2024

@phantomas1234 Thanks! This seems to work now on OSX with Python 2.7.

from swiglpk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.