Development state
Hi,
it seems that the project is a little bit abandoned. 🫤This is really sad, since python-mip has the fastest binding available for CBC.
Will there be updates for coming python versions and also for CBC that is from October 2021 currently.
I'm afraid the project will die in near future or did already die.
EDIT: On Python 3.13 and 3.14 it does not install ... I repacked and installed it from an installation for Python 3.12 with mip==1.16rc0 towards Python 3.13 and it worked!
xcopy /s /e c:\Python312\lib\site-packages\mip mip_repack\mip
xcopy /s /e c:\Python312\lib\site-packages\mip-1.16rc0.dist-info mip_repack\mip-1.16rc0.dist-info
wheel pack mip_repack
...
pip install --ignore-requires-python mip-1.16rc0-py3-none-any.whl
I agree! Perhaps someone can make pull request with the changes you proposed?
So why did you need to repack? I tried in Python 3.13 and
pip install --ignore-requires-python mip
seems to work fine. This force installs a version of cffi that doesn't seem to work with Python 3.13, though. After doing
pip install cffi==2.0.0.b1
then I can import. So it seems that if you just edit pyproject.toml, then you should be able to install from a source checkout. You should be able to then build the most recent version of Cbc master and just drop it in.
I tried:
pip install cffi==2.0.0.b1
and then:
pip install --ignore-requires-python mip
This gives errors:
Collecting mip
Using cached mip-1.15.0-py3-none-any.whl.metadata (21 kB)
Collecting cffi==1.15.* (from mip)
Using cached cffi-1.15.1.tar.gz (508 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: pycparser in /home/cees/prive/day_ahead/day-ahead-6/.venv/lib/python3.13/site-packages (from cffi==1.15.*->mip) (2.22)
Using cached mip-1.15.0-py3-none-any.whl (15.3 MB)
Building wheels for collected packages: cffi
DEPRECATION: Building 'cffi' using the legacy setup.py bdist_wheel mechanism, which will be removed in a future version. pip 25.3 will enforce this behaviour change. A possible replacement is to use the standardized build interface by setting the `--use-pep517` option, (possibly combined with `--no-build-isolation`), or adding a `pyproject.toml` file to the source tree of 'cffi'. Discussion can be found at https://github.com/pypa/pip/issues/6334
Building wheel for cffi (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [43 lines of output]
running bdist_wheel
running build
running build_py
creating build/lib.linux-x86_64-cpython-313/cffi
copying cffi/verifier.py -> build/lib.linux-x86_64-cpython-313/cffi
copying cffi/vengine_gen.py -> build/lib.linux-x86_64-cpython-313/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-cpython-313/cffi
copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-cpython-313/cffi
copying cffi/recompiler.py -> build/lib.linux-x86_64-cpython-313/cffi
copying cffi/pkgconfig.py -> build/lib.linux-x86_64-cpython-313/cffi
copying cffi/model.py -> build/lib.linux-x86_64-cpython-313/cffi
copying cffi/lock.py -> build/lib.linux-x86_64-cpython-313/cffi
copying cffi/ffiplatform.py -> build/lib.linux-x86_64-cpython-313/cffi
copying cffi/error.py -> build/lib.linux-x86_64-cpython-313/cffi
copying cffi/cparser.py -> build/lib.linux-x86_64-cpython-313/cffi
copying cffi/commontypes.py -> build/lib.linux-x86_64-cpython-313/cffi
copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-cpython-313/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-cpython-313/cffi
copying cffi/api.py -> build/lib.linux-x86_64-cpython-313/cffi
copying cffi/__init__.py -> build/lib.linux-x86_64-cpython-313/cffi
copying cffi/_cffi_include.h -> build/lib.linux-x86_64-cpython-313/cffi
copying cffi/parse_c_type.h -> build/lib.linux-x86_64-cpython-313/cffi
copying cffi/_embedding.h -> build/lib.linux-x86_64-cpython-313/cffi
copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-cpython-313/cffi
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-x86_64-cpython-313/c
x86_64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -DFFI_BUILDING=1 -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/home/cees/prive/day_ahead/day-ahead-6/.venv/include -I/usr/include/python3.13 -c c/_cffi_backend.c -o build/temp.linux-x86_64-cpython-313/c/_cffi_backend.o
c/_cffi_backend.c: In function ‘b_do_dlopen’:
c/_cffi_backend.c:4523:22: warning: ‘Py_FileSystemDefaultEncoding’ is deprecated [-Wdeprecated-declarations]
4523 | Py_FileSystemDefaultEncoding, &filename_or_null, &flags))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/python3.13/Python.h:99,
from c/_cffi_backend.c:2:
/usr/include/python3.13/fileobject.h:22:46: note: declared here
22 | Py_DEPRECATED(3.12) PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
c/_cffi_backend.c: In function ‘_my_PyErr_WriteUnraisable’:
c/_cffi_backend.c:6112:9: error: implicit declaration of function ‘_PyErr_WriteUnraisableMsg’; did you mean ‘PyErr_WriteUnraisable’? [-Wimplicit-function-declaration]
6112 | _PyErr_WriteUnraisableMsg(PyText_AS_UTF8(s), NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
| PyErr_WriteUnraisable
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cffi
Running setup.py clean for cffi
Failed to build cffi
I think I misunderstand you. What did I wrong? What should I do?
So why did you need to repack? I tried in Python 3.13 and
pip install --ignore-requires-python mipseems to work fine. This force installs a version of
cffithat doesn't seem to work with Python 3.13, though. After doingpip install cffi==2.0.0.b1then I can import. So it seems that if you just edit
pyproject.toml, then you should be able to install from a source checkout. You should be able to then build the most recent version of Cbcmasterand just drop it in.
Well, I'd prefer (also for others) to have just pip install mip. Starting to fiddling around with workarounds is always a sign of a dying library. So I asked if it dies or not.
It might be worth mentioning that my colleague @miguelhisojo has been working on a PR (https://github.com/coin-or/python-mip/pull/415) to add support for Python 3.13. This might could help with this issue.
Well, I'd prefer (also for others) to have just pip install mip. Starting to fiddling around with workarounds is always a sign of a dying library. So I asked if it dies or not.
Sure, I understand, I was just trying to understand your workaround in order to determine what a long-term solution should be. I'm not a maintainer of this project, but I do maintain Cbc and I can help here a bit. Unfortunately, I do not have access to python-mip on Pypi, so even if I commit a fix here, it won't be possible to install using pip install mip.
This project certainly won't die if there is community support to keep it alive. We can see about bringing on some new maintainers if the current ones are no longer available.
Well, at least I could build a Wheel (on Windows) and install it with Python 3.13 but had to change the toml from
...
requires-python = ">=3.7,<3.13"
...
dependencies = ["cffi>=1.15"]
...
[tool.setuptools.package-data]
"mip.libraries" = ["*.so", "*.dylib", "*.dll"]
to
...
...
requires-python = ">=3.7"
...
dependencies = [
"cffi>=1.15; python_version < '3.13'",
"cffi>=2.0.0b1; python_version >= '3.13'"
]
...
[tool.setuptools.package-data]
"mip" = ["libraries/win64/*.dll", "libraries/*.so", "libraries/*.dylib"]
to get the libraries included. Nevertheless Pypy would be better.
I think the "cffi>=2.0.0b1; python_version >= '3.13'" is needed to get the beta cffi installed.
Just to note that cffi 2.0.0 was released in September, so no need for a beta release of cffi any more.