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.

1.7.0 breaks linux compatibility with pyinstaller

See original GitHub issue

Expected behavior and actual behavior.

Expected: Shapely is able to load libgeos_c.so.1 in a pyinstaller-packaged application. Actual: Program throws an exception on startup:

Traceback (most recent call last):
  File "/home/runner/work/inkstitch/inkstitch/inkstitch.py", line 8, in <module>
  File "/home/runner/.local/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 396, in load_module
  File "/home/runner/work/inkstitch/inkstitch/lib/extensions/__init__.py", line 1, in <module>
  File "/home/runner/.local/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 396, in load_module
  File "/home/runner/work/inkstitch/inkstitch/lib/extensions/auto_satin.py", line 5, in <module>
  File "/home/runner/.local/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 396, in load_module
  File "/home/runner/work/inkstitch/inkstitch/lib/i18n.py", line 6, in <module>
  File "/home/runner/.local/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 396, in load_module
  File "/home/runner/work/inkstitch/inkstitch/lib/utils/__init__.py", line 3, in <module>
  File "/home/runner/.local/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 396, in load_module
  File "/home/runner/work/inkstitch/inkstitch/lib/utils/geometry.py", line 3, in <module>
  File "/home/runner/.local/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 396, in load_module
  File "/home/runner/.local/lib/python2.7/site-packages/shapely/geometry/__init__.py", line 4, in <module>
  File "/home/runner/.local/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 396, in load_module
  File "/home/runner/.local/lib/python2.7/site-packages/shapely/geometry/base.py", line 18, in <module>
  File "/home/runner/.local/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 396, in load_module
  File "/home/runner/.local/lib/python2.7/site-packages/shapely/coords.py", line 8, in <module>
  File "/home/runner/.local/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 396, in load_module
  File "/home/runner/.local/lib/python2.7/site-packages/shapely/geos.py", line 196, in <module>
  File "/home/runner/.local/lib/python2.7/site-packages/shapely/geos.py", line 184, in _geos_version
AttributeError: 'NoneType' object has no attribute 'GEOSversion'

This seems to happen because _lgeos is None. The logic in #485 doesn’t do anything if the geos_c library file is named libgeos_c.so.1 as happens when Shapely is installed NOT as a wheel. It seems to me as if everything would work if the outer else clause were run, but it isn’t.

When installing Shapely as a wheel, the problem goes away. In case you’re curious, we were installing Shapely with --no-binary to work around the very problem that #485 seems to fix. The wheel has libgeos_c in a different spot, and pyinstaller couldn’t find it.

Steps to reproduce the problem.

Package a python application that uses Shapely v1.7.0 using pyinstaller 3.3.1. Run the program.

Operating system

Linux 4.15.0-66-generic #75-Ubuntu SMP Tue Oct 1 05:24:09 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Shapely version and provenance

Shapely 1.7.0 installed from pypi not as a whl (with pip install --no-binary).

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
sgilliescommented, Feb 27, 2021

I’m going to close this. The entire category of errors involving dynamic loading of GEOS is going away in 2.0 and we won’t be doing anything about any of them in the meanwhile.

1reaction
lexelbycommented, Feb 2, 2020

Fair enough. I don’t think I’m they one to do that since I don’t know much about pyinstaller. I do think I know enough about this particular bug to submit a PR, if you’re interested?

Read more comments on GitHub >

github_iconTop Results From Across the Web

1.7.0 breaks linux compatibility with pyinstaller #831 - GitHub
1.7.0 breaks linux compatibility with pyinstaller #831 ... Package a python application that uses Shapely v1.7.0 using pyinstaller 3.3.1. Run the program.
Read more >
python - Pynput with pyinstaller 1.7.0 - Stack Overflow
The problem is that I'm using pyinstaller to convert my script into an executable, and I like pyinstaller because it can also make...
Read more >
Release 4.10 David Cortesi - PyInstaller Documentation
PyInstaller supports Python 3.6 or newer, and correctly bundles the major Python packages such as numpy, PyQt, Django, wxPython, and others.
Read more >
PyInstaller Documentation - Read the Docs
PyInstaller is tested against Windows, Mac OS X, and Linux. ... PyInstaller works with the default Python 2.7 provided with current Mac OS...
Read more >
pyinstaller 3.4 - PyPI
PyInstaller is tested against Windows, Mac OS X, and Linux. ... Works out-of-the-box with any Python version 2.7 / 3.4-3.7. Fully multi-platform, and...
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