uvloop icon indicating copy to clipboard operation
uvloop copied to clipboard

Import error with pypy37

Open nehaljwani opened this issue 4 years ago • 9 comments

  • uvloop version: 0.14.0
  • Python version: 3.7.9 (pypy)
  • Platform: linux (64 bit)
  • Can you reproduce the bug with PYTHONASYNCIODEBUG in env?: N/A
  • Does uvloop behave differently from vanilla asyncio? How?: N/A
./dev/bin/pip install uvloop
Collecting uvloop
  Downloading uvloop-0.14.0.tar.gz (2.0 MB)
     |████████████████████████████████| 2.0 MB 212 kB/s
Building wheels for collected packages: uvloop
  Building wheel for uvloop (setup.py) ... done
  Created wheel for uvloop: filename=uvloop-0.14.0-pp37-pypy37_pp73-linux_x86_64.whl size=1747119 sha256=f7ddb978dab6e8464b23974c5e5bec9d51fdb09808893908c98852f2a77b1875
  Stored in directory: /home/wani/.cache/pip/wheels/37/33/c5/76203c197d01739bf197c099e5473be584744c4bf284498ebf
Successfully built uvloop
Installing collected packages: uvloop
Successfully installed uvloop-0.14.0

./dev/bin/pypy
Python 3.7.9 (7e6e2bb30ac5fbdbd443619cae28c51d5c162a02, Jan 12 2021, 06:52:08)
[PyPy 7.3.3-beta0 with GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``"Somewhere inside the large
lumbering blob of PyPy there is an elegant core trying to get out." - cfbolz''
>>>> import uvloop
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/nwani_1611011952/dev/site-packages/uvloop/__init__.py", line 7, in <module>
    from .loop import Loop as __BaseLoop  # NOQA
ImportError: /tmp/nwani_1611011952/dev/site-packages/uvloop/loop.pypy37-pp73-x86_64-linux-gnu.so: undefined symbol: PyContext_CopyCurrent
>>>>

nehaljwani avatar Jan 19 '21 00:01 nehaljwani

subscribing

lostb1t avatar Jul 23 '21 14:07 lostb1t

Any updates on this issue is highly appreciated.

SudoNova avatar Aug 31 '21 18:08 SudoNova

Still getting this issue.

mohd-akram avatar Oct 14 '21 08:10 mohd-akram

Any updates on this one? Would also like to use uvloop via pypy37

mbwmbw1337 avatar Dec 05 '21 06:12 mbwmbw1337

Same issue for me, just installed uvloop on pypy:3.8-7.3.7-bullseye, I got the following error

File "/opt/pypy/lib/pypy3.8/site-packages/uvloop/__init__.py", line 7, in <module>
    from .loop import Loop as __BaseLoop  # NOQA
ImportError: /opt/pypy/lib/pypy3.8/site-packages/uvloop/loop.pypy38-pp73-x86_64-linux-gnu.so: undefined symbol: PyContext_CopyCurrent

guishake avatar Jan 02 '22 12:01 guishake

It happened on aarch64 linux platform(hardware is NanoPi NEO3) too. I test it by using

  • pypy3.8 Python 3.8.13 (4b1ae7a563b2c8614ef6faeaa60e749d10398c08, Apr 12 2022, 23:28:48) [PyPy 7.3.10-alpha0 with GCC 10.2.1 20210130 (Red Hat 10.2.1-11)]

  • pypy3.9

to import uvloop, and it says:

>>>> import uvloop
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/pyxy/.env/lib/pypy3.8/site-packages/uvloop/__init__.py", line 7, in <module>
    from .loop import Loop as __BaseLoop  # NOQA
ImportError: /home/pi/pyxy/.env/lib/pypy3.8/site-packages/uvloop/loop.pypy38-pp73-aarch64-linux-gnu.so: undefined symbol: PyContext_CopyCurrent

RuofengX avatar Apr 13 '22 06:04 RuofengX

It seems like pypy missing some Cfunction.

RuofengX avatar Apr 13 '22 06:04 RuofengX

In PyPy, the _contextvars module is pure python. In order to support it from C, PyPy needs to wrap and expose all the C interfaces. Currently PyPy exposes only PyContextVar_New, PyContextVar_Set, PyContextVar_Get. Using uvloop on PyPy is probably a bit of a foot gun, since the calls back and forth across the c emulation layer will be slower than using the pure python alternatives.

I would be curious to see how PyPy running asyncio performs in the performance benchmark in the uvloop README.

mattip avatar May 09 '22 15:05 mattip

I would be curious to see how PyPy running asyncio performs in the performance benchmark in the uvloop README.

Am curious if anyone tried this

jakirkham avatar Oct 23 '23 21:10 jakirkham