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.

Segmentation Fault on pyproj.transform

See original GitHub issue

I’m trying to convert a shapely polygon to a different CRS using a transformer:

import pyproj
from shapely.ops import transform
import shapely.wkt

poly = shapely.wkt.loads("POLYGON((11.32494067504356 48.81382282568276,10.760727610912785 48.03424052262582,12.501645259614333 47.67215127486503,13.38216064327573 48.133953565438105,11.32494067504356 48.81382282568276,11.32494067504356 48.81382282568276))")

transformer = pyproj.Transformer.from_crs("EPSG:4326", "EPSG:32631", always_xy=True)
img_poly = transform(transformer.transform, poly)

However, this is giving me a segmentation fault, without being able to know anything else. When I activated faulthandler following this old bug https://github.com/pyproj4/pyproj/issues/8, i obtained:

  File "/opt/homebrew/lib/python3.9/site-packages/shapely/geometry/polygon.py", line 54 in __init__
  File "/opt/homebrew/lib/python3.9/site-packages/shapely/ops.py", line 304 in transform
  File "/Users/me/Documents/test.py", line 197 in <module>
zsh: segmentation fault  python3 test.py

Environment Information

(I’m using M1 Mac, just in case) pyproj info: pyproj: 3.3.1 PROJ: 8.2.0 data dir: /opt/homebrew/lib/python3.9/site-packages/pyproj/proj_dir/share/proj user_data_dir: /Users/me/Library/Application Support/proj PROJ DATA (recommended version): 1.8 PROJ Database: 1.2 EPSG Database: v10.038 [2021-10-21] ESRI Database: ArcMap 12.8 [2021-05-06] IGNF Database: 3.1.0 [2019-05-24]

System: python: 3.9.13 (main, May 24 2022, 21:13:51) [Clang 13.1.6 (clang-1316.0.21.2)] executable: /opt/homebrew/opt/python@3.9/bin/python3.9 machine: macOS-12.3.1-arm64-arm-64bit

Python deps: /opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/_distutils_hack/init.py:30: UserWarning: Setuptools is replacing distutils. warnings.warn(“Setuptools is replacing distutils.”) certifi: 2022.06.15 Cython: None setuptools: 62.3.2 pip: 22.1.1

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sgilliescommented, Aug 18, 2022
0reactions
snowman2commented, Aug 18, 2022

Looks like they have a similar issue without pyproj. Going to close this as I believe it is a better fit in shapely.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Segmentation fault: pyproj chrashes python when changing crs
Geopandas object to_crs results in a 691 segmentation fault and crashes python. ... I'm working with pyproj 2.2.0 installed with pip. My version ......
Read more >
Problem transforming coordinates with PyProj
I am having problems transforming from EPSG25830 (ETRS89) to EPSG3857. I have read and followed step by step the tutorial in PyProj web...
Read more >
but not all – Cartopy maps with segmentation fault 11 - Stack ...
I can use Cartopy to successfully plot some maps but, in some cases, the Python kernel dies with Segmentation Fault 11. I wanted...
Read more >
I get "segmentation fault" error everytime starting convert
I get "segmentation fault" error everytime starting convert, and memory core is dumped. I am using Arch Linux on my headless VPS (I...
Read more >
PROJ coordinate transformation software library - GitHub
Avoid segmentation fault when transformation coordinates outside grid area in deformation (#934). • Avoid doing false easting/northing ...
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