arup-group / elara

Command line utility for processing MATSim events output files.
MIT License
13 stars 4 forks source link

Support Python 3.11 #227

Open mfitz opened 1 year ago

mfitz commented 1 year ago

Elara will not install into a Python 3.11.0 environment. On an EC2 instance running Ubuntu:

Distributor ID: Ubuntu
Description:    Ubuntu 20.04 LTS
Release:    20.04
Codename:   focal

I was able to make pip install work by upgrading the following libraries:

$ diff requirements.txt requirements-3.11.txt

< Fiona==1.8.20
---
> Fiona==1.8.22

< geopandas==0.7.0
< lxml==4.6.3
---
> geopandas==0.12.2
> lxml==4.9.2

< numpy==1.19.0
< matplotlib==3.5
< pandas==1.3.5
---
> numpy==1.23.5
> matplotlib==3.6.2
> pandas==1.5.2

< pyarrow==7.0.0
< pyproj==2.6.1.post1
---
> pyarrow==10.0.1
> pyproj==3.4.1

However, there were failures in the test suite:

FAIL Required test coverage of 86.0% not reached. Total coverage: 84.09%
================================================================== short test summary info ===================================================================
FAILED tests/test_5_benchmark.py::test_pt_volume_counter_bus - TypeError: got an unexpected keyword argument 'verbose'
FAILED tests/test_5_benchmark.py::test_pt_interactions_counter_bus - TypeError: got an unexpected keyword argument 'verbose'
FAILED tests/test_5_benchmark.py::test_links_counter_car_init - TypeError: got an unexpected keyword argument 'verbose'
FAILED tests/test_5_benchmark.py::test_links_counter_bus_init - TypeError: got an unexpected keyword argument 'verbose'
FAILED tests/test_5_benchmark.py::test_points_counter_init - TypeError: got an unexpected keyword argument 'verbose'
FAILED tests/test_5_benchmark.py::test_benchmark_workstation_with_link_bms - TypeError: got an unexpected keyword argument 'verbose'
FAILED tests/test_7_factory.py::test_bfs - TypeError: got an unexpected keyword argument 'verbose'
FAILED tests/test_7_factory.py::test_write_geojson - NotImplementedError: A polygon does not itself provide the array interface. Its rings do.
FAILED tests/test_7_factory.py::test_write_geojson_no_path - NotImplementedError: A polygon does not itself provide the array interface. Its rings do.
FAILED tests/test_7_factory.py::test_write_geojson_tool - NotImplementedError: A polygon does not itself provide the array interface. Its rings do.
FAILED tests/test_7_factory.py::test_bfs_depends - TypeError: got an unexpected keyword argument 'verbose'
FAILED tests/test_7_factory.py::test_write_geojson_tool_no_path - NotImplementedError: A polygon does not itself provide the array interface. Its rings do.
FAILED tests/test_8_main.py::test_main - TypeError: got an unexpected keyword argument 'verbose'
FAILED tests/test_8_main.py::test_main_ordering_graph - TypeError: got an unexpected keyword argument 'verbose'
FAILED tests/test_8_main.py::test_main_missing_requirement_still_fulfilled - TypeError: got an unexpected keyword argument 'verbose'
======================================================= 15 failed, 325 passed, 193 warnings in 38.56s ========================================================
(elara-3.11.0) arup@workbox-michael:~/elara$

The TypeError failures look like:

elara/factory.py:771: in build
    return build_dag(queue=queue, write_path=write_path)
elara/factory.py:829: in build_dag
    current.build(write_path=write_path)
elara/benchmarking.py:2206: in build
    scores = benchmark.build({}, write_path=write_path)
elara/benchmarking.py:829: in build
    bm_results_summary_plot.savefig(os.path.join(self.config.output_path,"benchmarks", plot_name), verbose=False)
../.pyenv/versions/elara-3.11.0/lib/python3.11/site-packages/matplotlib/figure.py:3274: in savefig
    self.canvas.print_figure(fname, **kwargs)
../.pyenv/versions/elara-3.11.0/lib/python3.11/site-packages/matplotlib/backend_bases.py:2338: in print_figure
    result = print_method(
../.pyenv/versions/elara-3.11.0/lib/python3.11/site-packages/matplotlib/backend_bases.py:2204: in <lambda>
    print_method = functools.wraps(meth)(lambda *args, **kwargs: meth(
../.pyenv/versions/elara-3.11.0/lib/python3.11/site-packages/matplotlib/_api/deprecation.py:385: in wrapper
    arguments = signature.bind(*inner_args, **inner_kwargs).arguments
../.pyenv/versions/3.11.0/lib/python3.11/inspect.py:3204: in bind
    return self._bind(args, kwargs)

The NotImplementedError failures look like:

tmpdir = local('/tmp/pytest-of-arup/pytest-7/test_write_geojson0')

    def test_write_geojson(tmpdir):
        df = pd.DataFrame({1:[1,2,3], 2: [4,5,6]})
        poly = Polygon(((0,0), (1,0), (1,1), (0,1)))
>       gdf = gp.GeoDataFrame(df, geometry=[poly]*3)

tests/test_7_factory.py:626:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../.pyenv/versions/elara-3.11.0/lib/python3.11/site-packages/geopandas/geodataframe.py:188: in __init__
    self.set_geometry(geometry, inplace=True, crs=crs)
../.pyenv/versions/elara-3.11.0/lib/python3.11/site-packages/geopandas/geodataframe.py:346: in set_geometry
    level = _ensure_geometry(level, crs=crs)
../.pyenv/versions/elara-3.11.0/lib/python3.11/site-packages/geopandas/geodataframe.py:62: in _ensure_geometry
    out = from_shapely(data, crs=crs)
../.pyenv/versions/elara-3.11.0/lib/python3.11/site-packages/geopandas/array.py:154: in from_shapely
    return GeometryArray(vectorized.from_shapely(data), crs=crs)
../.pyenv/versions/elara-3.11.0/lib/python3.11/site-packages/geopandas/_vectorized.py:154: in from_shapely
    aout[:] = out
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <shapely.geometry.polygon.Polygon object at 0x7f75504c3d50>

    @property
    def __array_interface__(self):
>       raise NotImplementedError(
        "A polygon does not itself provide the array interface. Its rings do.")
E       NotImplementedError: A polygon does not itself provide the array interface. Its rings do.

../.pyenv/versions/elara-3.11.0/lib/python3.11/site-packages/shapely/geometry/polygon.py:300: NotImplementedError