Python 3.10 error
elkuku opened this issue · comments
So, after #35 has been solved, I now got another cryptic error message...
$ maxfield-plan example_portals.txt --num_agents 3 --num_cpus 0 --verbose --output_csv
Found 18 portals in portal file: example_portals.txt
Starting field generation with 4 CPUs.
Field generation runtime: 236.3 seconds.
==============================
Maxfield Plan Results:
portals = 18
links = 45
fields = 40
max keys needed = 4
AP from portals = 31500
AP from links = 14085
AP from fields = 50000
TOTAL AP = 95585
==============================
Optimizing agent link assignments.
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/maxfield/router.py", line 127, in time_evaluator
File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/maxfield/router.py", line 127, in time_evaluator
File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/maxfield/router.py", line 127, in time_evaluator
[Previous line repeated 896 more times]
TypeError: 'numpy.float64' object cannot be interpreted as an integer
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/bin/maxfield-plan", line 4, in <module>
__import__('pkg_resources').run_script('maxfield==4.0', 'maxfield-plan')
File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 656, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1460, in run_script
exec(script_code, namespace, namespace)
File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/EGG-INFO/scripts/maxfield-plan", line 92, in <module>
File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/maxfield/maxfield.py", line 241, in maxfield
File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/maxfield/plan.py", line 232, in route_agents
File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/maxfield/router.py", line 345, in route_agents
File "/usr/lib/python3.10/site-packages/ortools/constraint_solver/pywrapcp.py", line 5413, in CloseModelWithParameters
return _pywrapcp.RoutingModel_CloseModelWithParameters(self, search_parameters)
SystemError: <built-in function RoutingModel_CloseModelWithParameters> returned a result with an exception set
Interesting! I am not able to reproduce this error.
$ maxfield-plan example_portals.txt --num_agents 3 --num_cpus 0 --verbose --output_csv
Found 18 portals in portal file: example_portals.txt
Starting field generation with 8 CPUs.
Field generation runtime: 21.4 seconds.
==============================
Maxfield Plan Results:
portals = 18
links = 45
fields = 40
max keys needed = 6
AP from portals = 31500
AP from links = 14085
AP from fields = 50000
TOTAL AP = 95585
==============================
Optimizing agent link assignments.
Route optimization runtime: 22.2 seconds
Total plan build time: 18.2 minutes
Could you try installing maxfield in a virtual environment to see if it's maybe something funny going on with your packages?
python -m venv testenv
source testenv/bin/activate
cd /path/to/maxfield
python setup.py install
Could you try installing maxfield in a virtual environment to see if it's maybe something funny going on with your packages?
I tried but I failed :(
(testenv) ~/r/maxfield (master|✚60…) $ python setup.py install
running install
running bdist_egg
running egg_info
creating maxfield.egg-info
writing maxfield.egg-info/PKG-INFO
writing dependency_links to maxfield.egg-info/dependency_links.txt
writing requirements to maxfield.egg-info/requires.txt
writing top-level names to maxfield.egg-info/top_level.txt
writing manifest file 'maxfield.egg-info/SOURCES.txt'
reading manifest file 'maxfield.egg-info/SOURCES.txt'
adding license file 'LICENSE.md'
writing manifest file 'maxfield.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/maxfield
copying maxfield/field.py -> build/lib/maxfield
copying maxfield/geometry.py -> build/lib/maxfield
copying maxfield/maxfield.py -> build/lib/maxfield
copying maxfield/fielder.py -> build/lib/maxfield
copying maxfield/router.py -> build/lib/maxfield
copying maxfield/reorder.py -> build/lib/maxfield
copying maxfield/generator.py -> build/lib/maxfield
copying maxfield/__init__.py -> build/lib/maxfield
copying maxfield/plan.py -> build/lib/maxfield
copying maxfield/results.py -> build/lib/maxfield
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/maxfield
copying build/lib/maxfield/field.py -> build/bdist.linux-x86_64/egg/maxfield
copying build/lib/maxfield/geometry.py -> build/bdist.linux-x86_64/egg/maxfield
copying build/lib/maxfield/maxfield.py -> build/bdist.linux-x86_64/egg/maxfield
copying build/lib/maxfield/fielder.py -> build/bdist.linux-x86_64/egg/maxfield
copying build/lib/maxfield/router.py -> build/bdist.linux-x86_64/egg/maxfield
copying build/lib/maxfield/reorder.py -> build/bdist.linux-x86_64/egg/maxfield
copying build/lib/maxfield/generator.py -> build/bdist.linux-x86_64/egg/maxfield
copying build/lib/maxfield/__init__.py -> build/bdist.linux-x86_64/egg/maxfield
copying build/lib/maxfield/plan.py -> build/bdist.linux-x86_64/egg/maxfield
copying build/lib/maxfield/results.py -> build/bdist.linux-x86_64/egg/maxfield
byte-compiling build/bdist.linux-x86_64/egg/maxfield/field.py to field.cpython-310.pyc
byte-compiling build/bdist.linux-x86_64/egg/maxfield/geometry.py to geometry.cpython-310.pyc
byte-compiling build/bdist.linux-x86_64/egg/maxfield/maxfield.py to maxfield.cpython-310.pyc
byte-compiling build/bdist.linux-x86_64/egg/maxfield/fielder.py to fielder.cpython-310.pyc
byte-compiling build/bdist.linux-x86_64/egg/maxfield/router.py to router.cpython-310.pyc
byte-compiling build/bdist.linux-x86_64/egg/maxfield/reorder.py to reorder.cpython-310.pyc
byte-compiling build/bdist.linux-x86_64/egg/maxfield/generator.py to generator.cpython-310.pyc
byte-compiling build/bdist.linux-x86_64/egg/maxfield/__init__.py to __init__.cpython-310.pyc
byte-compiling build/bdist.linux-x86_64/egg/maxfield/plan.py to plan.cpython-310.pyc
byte-compiling build/bdist.linux-x86_64/egg/maxfield/results.py to results.cpython-310.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
installing scripts to build/bdist.linux-x86_64/egg/EGG-INFO/scripts
running install_scripts
running build_scripts
creating build/scripts-3.10
copying and adjusting bin/maxfield-plan -> build/scripts-3.10
changing mode of build/scripts-3.10/maxfield-plan from 644 to 755
creating build/bdist.linux-x86_64/egg/EGG-INFO/scripts
copying build/scripts-3.10/maxfield-plan -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts
changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/maxfield-plan to 755
copying maxfield.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying maxfield.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying maxfield.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying maxfield.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying maxfield.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/maxfield-4.0-py3.10.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing maxfield-4.0-py3.10.egg
Copying maxfield-4.0-py3.10.egg to /home/elkuku/repos/maxfield/testenv/lib/python3.10/site-packages
Adding maxfield 4.0 to easy-install.pth file
Installing maxfield-plan script to /home/elkuku/repos/maxfield/testenv/bin
Installed /home/elkuku/repos/maxfield/testenv/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg
Processing dependencies for maxfield==4.0
Searching for pygifsicle
Reading https://pypi.org/simple/pygifsicle/
Downloading https://files.pythonhosted.org/packages/21/78/c1f6a45c338352915e7da9ca5e6bf519d687272f7bff694a70768d3db00b/pygifsicle-1.0.5.tar.gz#sha256=be7fef569c5a52c03493ab6cdb3a661634e0863127abdd5c57cbd29150fb5dfc
Best match: pygifsicle 1.0.5
Processing pygifsicle-1.0.5.tar.gz
Writing /tmp/easy_install-nklh6nzm/pygifsicle-1.0.5/setup.cfg
Running pygifsicle-1.0.5/setup.py -q bdist_egg --dist-dir /tmp/easy_install-nklh6nzm/pygifsicle-1.0.5/egg-dist-tmp-da_z6k4v
Installing gifsicle on Linux requires sudo!
The current system was detected to be manjaro
Please run the following command in your terminal:
The sources to compile can be found at: https://github.com/kohler/gifsicle
Press any key to continue with the installation of the python package.
zip_safe flag not set; analyzing archive contents...
Moving pygifsicle-1.0.5-py3.10.egg to /home/elkuku/repos/maxfield/testenv/lib/python3.10/site-packages
Adding pygifsicle 1.0.5 to easy-install.pth file
Installed /home/elkuku/repos/maxfield/testenv/lib/python3.10/site-packages/pygifsicle-1.0.5-py3.10.egg
Searching for imageio
Reading https://pypi.org/simple/imageio/
Downloading https://files.pythonhosted.org/packages/29/24/a3a7aa7f1e7f1c3a5c9fe2ff3fec8d9d17e10741eafb710f06705744b35f/imageio-2.16.1-py3-none-any.whl#sha256=d8d17c59b6f5f3b350bbbe346e7cb7dda0399b1881d93ad01cb29b5acdb24c42
Best match: imageio 2.16.1
Processing imageio-2.16.1-py3-none-any.whl
Installing imageio-2.16.1-py3-none-any.whl to /home/elkuku/repos/maxfield/testenv/lib/python3.10/site-packages
Adding imageio 2.16.1 to easy-install.pth file
Installing imageio_download_bin script to /home/elkuku/repos/maxfield/testenv/bin
Installing imageio_remove_bin script to /home/elkuku/repos/maxfield/testenv/bin
Installed /home/elkuku/repos/maxfield/testenv/lib/python3.10/site-packages/imageio-2.16.1-py3.10.egg
Searching for matplotlib
Reading https://pypi.org/simple/matplotlib/
Downloading https://files.pythonhosted.org/packages/8a/46/425a44ab9a71afd2f2c8a78b039c1af8ec21e370047f0ad6e43ca819788e/matplotlib-3.5.1.tar.gz#sha256=b2e9810e09c3a47b73ce9cab5a72243a1258f61e7900969097a817232246ce1c
Best match: matplotlib 3.5.1
Processing matplotlib-3.5.1.tar.gz
Writing /tmp/easy_install-if9it_id/matplotlib-3.5.1/setup.cfg
Running matplotlib-3.5.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-if9it_id/matplotlib-3.5.1/egg-dist-tmp-ti2bg5g_
WARNING: The wheel package is not available.
WARNING: The wheel package is not available.
WARNING: The wheel package is not available.
WARNING: The wheel package is not available.
WARNING: The wheel package is not available.
WARNING: The wheel package is not available.
WARNING: The wheel package is not available.
listing git files failed - pretending there aren't any
error: Setup script exited with error: Failed to download any of the following:
['https://downloads.sourceforge.net/project/freetype/freetype2/2.6.1/freetype-2.6.1.tar.gz',
'https://download.savannah.gnu.org/releases/freetype/freetype-2.6.1.tar.gz',
'https://download.savannah.gnu.org/releases/freetype/freetype-old/freetype-2.6.1.tar.gz'].
Please download one of these urls and extract it into 'build/' at the top-level of the source repository.
I tried downloading the mentioned font and extracting it into the build directory but it made no difference....
I have to confess that I have no experience with Python virtual environments.
BTW. I also tested on virtual machines running Ubuntu LTS and unstable which are using Python 3.8 and 3.9 - without any issues.
A freshly installed VM with Manjaro, which uses Python 3.10 also gave me the same error I have locally so I guess its the Python version...
Could you maybe test with 3.10?...
So... since I am not able to manage python virtual environments on my own... I used PyCharme to help me out:
(venv) ~/r/e/example (master|✚64…) $ python --version
Python 3.9.12
(venv) ~/r/e/example (master|…) $ maxfield-plan example_portals.txt --num_agents 3 --num_cpus 0 --verbose --output_csv
Found 18 portals in portal file: example_portals.txt
Starting field generation with 4 CPUs.
[...]
Total maxfield runtime: 422.5 seconds
(venv2) ~/r/e/example (master|✚64…) $ python --version
Python 3.10.2
(venv2) ~/r/e/example (master|…) $ maxfield-plan example_portals.txt --num_agents 3 --num_cpus 0 --verbose --output_csv
Found 18 portals in portal file: example_portals.txt
Starting field generation with 4 CPUs.
[...]
Optimizing agent link assignments.
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/maxfield/router.py", line 127, in time_evaluator
File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/maxfield/router.py", line 127, in time_evaluator
File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/maxfield/router.py", line 127, in time_evaluator
[Previous line repeated 896 more times]
TypeError: 'numpy.float64' object cannot be interpreted as an integer
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/bin/maxfield-plan", line 4, in <module>
__import__('pkg_resources').run_script('maxfield==4.0', 'maxfield-plan')
File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 656, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1460, in run_script
exec(script_code, namespace, namespace)
File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/EGG-INFO/scripts/maxfield-plan", line 92, in <module>
File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/maxfield/maxfield.py", line 241, in maxfield
File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/maxfield/plan.py", line 232, in route_agents
File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/maxfield/router.py", line 345, in route_agents
File "/usr/lib/python3.10/site-packages/ortools/constraint_solver/pywrapcp.py", line 5413, in CloseModelWithParameters
return _pywrapcp.RoutingModel_CloseModelWithParameters(self, search_parameters)
SystemError: <built-in function RoutingModel_CloseModelWithParameters> returned a result with an exception set
So yeah.. I think I can now confirm, that this issue happens when using Python 3.10 (and probably above..)