reinterpretcat / vrp

A Vehicle Routing Problem solver
https://reinterpretcat.github.io/vrp/
Apache License 2.0
368 stars 71 forks source link

Something seems wrong with the pip package #104

Closed blaggacao closed 1 year ago

blaggacao commented 1 year ago
In [2]: import vrp_cli

In [3]: vrp_cli.lib
Out[3]: <Lib object for '/home/blaggacao/src/.../env/lib/python3.10/site-packages/vrp_cli/native.so'>

In [4]: vrp_cli.lib.solve_pragmatic
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File <ipython-input-4-e39910a693ad>:1
----> 1 vrp_cli.lib.solve_pragmatic

AttributeError: cffi library '/home/blaggacao/src/.../env/lib/python3.10/site-packages/vrp_cli/native.so' has no function, constant or global variable named 'solve_pragmatic'

I couldn't find the publishing routine in the repo automation so I assume publishing to pip is done manually from your local machine.

Maybe somehow something went wrong for this version, that I use:

  "vrp-cli~=1.21.0",
blaggacao commented 1 year ago

v1.19.2 is good, btw:

In [2]: import vrp_cli

In [3]: vrp_cli.solve_pragmatic
Out[3]: <function vrp_cli.vrp_cli.solve_pragmatic(problem, matrices, config)>
reinterpretcat commented 1 year ago

Yeah, need to see what I did wrong with maturin and local Python environment. Or maybe it is better to spend some time and setup dedicated github actions. Need to find some time for it..

As workaround, you can try to build the package locally using maturin as described here: https://reinterpretcat.github.io/vrp/examples/interop/python.html#using-maturin

blaggacao commented 1 year ago

I got myself into an environment that builds with nix shell nixpkgs#cargo nixpkgs#rustc nixpkgs#maturin. Let me see how far I can get from there.

And that looks actually like it built successfully:

❯ /home/blaggacao/src/github.com/reinterpretcat/vrp/vrp-cli/.venv/bin/python
Python 3.9.7 (default, Jun 22 2022, 20:11:26)
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import vrp_cli
>>> vrp_cli
<module 'vrp_cli' from '/home/blaggacao/src/github.com/reinterpretcat/vrp/vrp-cli/.venv/lib/python3.9/site-packages/vrp_cli/__init__.py'>
AttributeError: module 'vrp_cli' has no attribute 'lib'
>>> vrp_cli.__all__
['convert_to_pragmatic', 'get_routing_locations', 'solve_pragmatic']
>>>
reinterpretcat commented 1 year ago

I've added a dedicated github action [1] to build and publish to PyPI, but cannot make it work as it fails with You are running out of disk space. The runner will stop working when the machine runs out of disk space. Free space left: 43 MB. Tried multiple times with reduced amount of architectures, cleaning deps, project's target folder.. No luck so far

[1] https://github.com/reinterpretcat/vrp/actions/workflows/maturin.yaml

reinterpretcat commented 1 year ago

I was able to publish update (1.21.1) to PyPI using dedicated github action, so it should work now on different OS families (windows, macos, linux) and architectures (x86_64, armv7), see https://github.com/reinterpretcat/vrp/blob/master/.github/workflows/maturin.yaml