question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PyPy from shapely.geos import causes "TypeError: unsupported operand type(s) for +: 'list' and 'tuple'"

See original GitHub issue

Expected behavior and actual behavior.

PyPy is able to import from shapely.geos.

Steps to reproduce the problem.

While running Travis tests on geoalchemy2.

__________________ ERROR collecting tests/test_comparator.py ___________________
tests/test_comparator.py:5: in <module>
    from geoalchemy2.types import Geometry
geoalchemy2/__init__.py:1: in <module>
    from .types import (  # NOQA
geoalchemy2/types.py:17: in <module>
    from .shape import to_shape
geoalchemy2/shape.py:10: in <module>
    import shapely.wkb
.tox/pypysqla11/site-packages/shapely/wkb.py:4: in <module>
    from shapely.geos import WKBReader, WKBWriter, lgeos
.tox/pypysqla11/site-packages/shapely/geos.py:224: in <module>
    new_func.argtypes = [c_void_p] + old_func.argtypes
E   TypeError: unsupported operand type(s) for +: 'list' and 'tuple'

https://travis-ci.org/github/geoalchemy/geoalchemy2/jobs/662462792#L760

I’ve tried PyPy and PyPy3.

Tests on Python 2.7, 3.{5,6,7,8} work fine.

Unfortunately I don’t have PyPy installed locally to test further.

https://github.com/Toblerity/Shapely/blob/d8ff5de8baee6bbbd8465c92197764cdaaa6395a/shapely/geos.py#L224

Can this be changed to new_func.argtypes = [c_void_p] + list(old_func.argtypes)

Not that I know if that would work, or quite why it was needed.

Operating system

Linux Ubuntu Xenial (Travis)

Shapely version and provenance

1.70 installed from PyPI using pip. https://files.pythonhosted.org/packages/44/ec/4eddbf9d17a917c51fb4ad159aa7137f506681e91ab559cf87d120e1d78d/Shapely-1.7.0.tar.gz

libgeos-3.7.1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
cjmayocommented, Mar 16, 2020

Thanks for the quick update. I’ve tested geoalchemy2 with https://github.com/Toblerity/Shapely/archive/9ca22240d3272df9598c30878c6f8562e50f1ec8.tar.gz and it is passing all tests with PyPy and Python 2.7, 3.{5-8}.

0reactions
oppianmattcommented, Aug 20, 2020

any chance on publishing this to pypi please?

Read more comments on GitHub >

github_iconTop Results From Across the Web

PyPy from shapely.geos import causes "TypeError ... - GitHub
PyPy from shapely.geos import causes "TypeError: unsupported operand type(s) for +: 'list' and 'tuple'" #866.
Read more >
TypeError: unsupported operand type(s) for /: 'tuple' and 'int'
The error message is very explicit: return (data[i - 1] + data[i])/2 TypeError: unsupported operand type(s) for /: 'tuple' and 'int'.
Read more >
[Example code]-Issue installing shapely Python Package
I am running python 3.6 on windows and am attempting to install Shapely using pip install shapely==1.6b2. It is giving me the following...
Read more >
unsupported operand type(s) for /: 'int' and 'tuple' mean in ...
It means you have lost track of what data you hold in each of your variables, and also you seem to assume that...
Read more >
Browse Python Technical Problem Clusters - Code Grepper
failed to convert a numpy array to a tensor (unsupported object type tuple). values outside range pandas · python3 copy file · read...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found