Closed cgohlke closed 3 years ago
hope ?
I'm lost in thoughts, it seems the problem is back with PyPy-3.7-7.3.6, and now Pyproj is droping support for 3.7. I may give up and hope for a better PyPy-3.8.
@stonebig, are you using the latest pyproj version?
pyproj-3.2.1
I have lot of (new ?) problems of messageless crash with PyPy-3.7-7.3.6 just released (and rc3, and rc2). But this one was supposed to be fixed. So I hope it's an hint to all the other problems.
I have lot of (new ?) problems of messageless crash with PyPy-3.7-7.3.6 just released (and rc3, and rc2).
That is also my experience. I get reproducible crashes in numpy's _multiarray_umath
extension. Unfortunately pypy does not ship with debug symbols. The PyErr_SetFromWindowsErr
function seems to have changed ABI. Not sure that is causing these problems. I'll skip PyPy-3.7-7.3.6 for now. Recompiling is not an option.
there seems to be maybe a hint from https://libera.irclog.whitequark.org/pypy/2021-10-18 "more fallout from the release: it seems CPython on windows moved to linking with libffi-8 when we link with libffi-7"
@cgohlke PyPy-3.7-7.3.6 broke binary compatibility with previous versions. I released 7.3.7 to revert the breaking changes. Sorry for the mess.
Thank you! Do you think it is safe to start building for pypy3.8-v7.3.7?
I think so. it would be nice to get some feedback. Issues of failures can be opened on the PyPy bug tracker
Hi. I'm a bit lost in thoughts,
On My PC, with pypy3.7-v7.3.7-win64.zip and re-downloaded pyproj-3.2.1-pp37-pypy37_pp73-win_amd64.whl wheel , this basic test from first cells of https://github.com/pyproj4/pyproj/blob/master/docs/advanced_examples.rst fails:
import numpy as np
from pyproj import Transformer, transform
transformer = Transformer.from_crs(2263, 4326)
x_coords = np.random.randint(80000, 120000)
y_coords = np.random.randint(200000, 250000)
Python 3.7.12 (44db26267d0a, Oct 24 2021, 14:22:11)
[PyPy 7.3.7 with MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
========== RESTART: C:/WinP/bd37/buPyPy/WPy64-37120/notebooks/test.py ==========
Traceback (most recent call last):
File "C:/WinP/bd37/buPyPy/WPy64-37120/notebooks/test.py", line 2, in <module>
from pyproj import Transformer, transform
File "C:\WinP\bd37\buPyPy\WPy64-37120\pypy3.7-v7.3.7-win64\site-packages\pyproj\__init__.py", line 49, in <module>
import pyproj.network
File "C:\WinP\bd37\buPyPy\WPy64-37120\pypy3.7-v7.3.7-win64\site-packages\pyproj\network.py", line 10, in <module>
from pyproj._network import ( # noqa: F401 pylint: disable=unused-import
File "pyproj\_network.pyx", line 1, in init pyproj._network
ValueError: array.array size changed, may indicate binary incompatibility. Expected 72 from C header, got 24 from PyObject
>>>
The only binary wheel for PyPy on https://pypi.org/project/pyproj/#files is one for windows. Perhaps somehow it missed the change in #883?
@cgohlke creates the Windows wheels. The wheels for Linux & OSX are built here: https://github.com/pyproj4/pyproj-wheels/. Contributions welcome =).
@cgohlke made another wheel, so problem moved down to rtree wheel now, that seems a bit lost with pypy3.7-v7.3.7 old way of things
pypy3.8-v7.3.7 is clother to cPython standard, so unmaintained rtree may feel better.
see also rtreee issue https://github.com/Toblerity/rtree/issues/191
after copying around rtree DLLs, another tree hit
Python 3.7.12 (44db26267d0a, Oct 24 2021, 14:22:11)
[PyPy 7.3.7 with MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
=========== RESTART: C:\WinP\bd37\buPyPy\WPy64-37120\notebooks\sea.py ==========
================================ RESTART: Shell ================================
>>>
========= RESTART: C:/WinP/bd37/buPyPy/WPy64-37120/notebooks/pyproj.py =========
Traceback (most recent call last):
File "C:/WinP/bd37/buPyPy/WPy64-37120/notebooks/pyproj.py", line 2, in <module>
from pyproj import Transformer, transform
File "C:/WinP/bd37/buPyPy/WPy64-37120/notebooks\pyproj.py", line 2, in <module>
from pyproj import Transformer, transform
ImportError: cannot import name 'Transformer'
>>>
transformer.py seems lowercase on Windows ... playing lowercase with the example or the 'transformer.py' leads me to :
transformer = transformer.from_crs(2263, 4326)
AttributeError: module 'pyproj.transformer' has no attribute 'from_crs'
Back to this problem on PyPy-3.8rc1+nightly.... ... it's the only binary problem I still detect, as PyPy-3.8 has now roughly as much compatible packages as PyPy-3.7
@stonebig could you confirm you are using pyproj 3.3 from https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyproj, and that this line fails?
>>>> import pyproj
I have once again recompiled the pyproj package for PyPy and it is importing again. I think this issue is due to Cython producing incompatible versions of C files when cythonizing on CPython vs PyPy, which makes it hard and error prone to build CPython and PyPy wheels from the same copy of the source without removing the cythonized files in between builds.
Thanks @cgohlke. It seems this cython-translation time directive, which was added in #883, means that the cython c-code will indeed change depending on implementation. Over at cython/cython#3448, the discussion of this problem ended with
I think it's ok to consider the array.array internals CPython specific. Using them is not (currently) compatible with PyPy. The decision is then up to the users.
and cython HEAD emits a warning when using array.array on PyPy.
In h5py a similar problem was solved by replacing a local variable that used array.array('B', n)
with <char *>emalloc(n)
, but it seems replacing ~create_array
~ empty_array
with something that requires a deallocation step will be more intrusive for pyproj, since the returned named tuple from GeodIntermediateReturn has array.array
for lons
, lats
, and azis
(sp?).
Perhaps the translation time directive could be replaced with a runtime check for sys.implementation.name == 'pypy'
. This would work because the cython code from cpython cimport array; cdef array.array
compiles on PyPy but would not run at runtime so the warning would not be emitted (the alternative code path is slightly slower).
Importing pyproj 3.0.1 on PyPy for Windows raises the following error:
The issue is that there is "no clean C interface to the array.array object in Python". See discussion at https://github.com/h5py/h5py/issues/1514 and https://github.com/h5py/h5py/pull/1515 for a possible fix.