neovim / pynvim

Python client and plugin host for Nvim
http://pynvim.readthedocs.io/en/latest/
Apache License 2.0
1.48k stars 118 forks source link

Greenlet is still unavailable for arm64? #502

Closed mt1ger closed 2 years ago

mt1ger commented 2 years ago

I am not sure if I did anything wrong? I still can not install arm64 version neovim since pynvim is not available. I guess greenlet is still not ready.

Python 3.10.1 (main, Dec  6 2021, 22:18:13) [Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pynvim
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/homebrew/lib/python3.10/site-packages/pynvim/__init__.py", line 11, in <module>
    from pynvim.msgpack_rpc import (ErrorResponse, child_session, socket_session,
  File "/opt/homebrew/lib/python3.10/site-packages/pynvim/msgpack_rpc/__init__.py", line 10, in <module>
    from pynvim.msgpack_rpc.session import ErrorResponse, Session
  File "/opt/homebrew/lib/python3.10/site-packages/pynvim/msgpack_rpc/session.py", line 7, in <module>
    import greenlet
  File "/opt/homebrew/lib/python3.10/site-packages/greenlet/__init__.py", line 29, in <module>
    from ._greenlet import _C_API # pylint:disable=no-name-in-module
ImportError: dlopen(/opt/homebrew/lib/python3.10/site-packages/greenlet/_greenlet.cpython-310-darwin.so, 0x0002): tried: '/opt/homebrew/lib/python3.10/site-packages/greenlet/_greenlet.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/_greenlet.cpython-310-darwin.so' (no such file), '/usr/lib/_greenlet.cpython-310-darwin.so' (no such file)

Please help me out. Thanks. P.S.: I have uninstalled greenlet from pip and installed greenlet from the source. #473

pip uninstall greenlet
pip install -I greenlet --no-binary greenlet
Shougo commented 2 years ago

Please read the error messages. Your installed binary is x86.

mt1ger commented 2 years ago

@Shougo I know I installed x86 version. That is basically where the error happened. However, can you tell me how to install the specific arm64 version of greenlet? pip install is not an option. It says it installed an arm64 version however it does not. I tried install from source and got the same error.

Shougo commented 2 years ago

Please use this. https://unix.stackexchange.com/questions/82089/pip-install-cpu-you-selected-does-not-support-x86-64-instruction-set

mt1ger commented 2 years ago

Still the same error...

➜  /Users/mt1ger
>>> pip3 uninstall greenlet
Found existing installation: greenlet 1.1.2
Uninstalling greenlet-1.1.2:
  Would remove:
    /opt/homebrew/Cellar/python@3.10/3.10.1/Frameworks/Python.framework/Versions/3.10/include/python3.10/greenlet/greenlet.h
    /opt/homebrew/lib/python3.10/site-packages/greenlet-1.1.2-py3.10.egg-info
    /opt/homebrew/lib/python3.10/site-packages/greenlet/*
Proceed (Y/n)? y
  Successfully uninstalled greenlet-1.1.2
➜  /Users/mt1ger
>>> CFLAG='-march=arm64' pip3 install -I greenlet --no-binary greenlet
Collecting greenlet
  Using cached greenlet-1.1.2.tar.gz (91 kB)
  Preparing metadata (setup.py) ... done
Skipping wheel build for greenlet, due to binaries being disabled for it.
Installing collected packages: greenlet
    Running setup.py install for greenlet ... done
Successfully installed greenlet-1.1.2
➜  /Users/mt1ger
>>> py
Python 3.10.1 (main, Dec  6 2021, 22:18:13) [Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pynvim
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/homebrew/lib/python3.10/site-packages/pynvim/__init__.py", line 11, in <module>
    from pynvim.msgpack_rpc import (ErrorResponse, child_session, socket_session,
  File "/opt/homebrew/lib/python3.10/site-packages/pynvim/msgpack_rpc/__init__.py", line 10, in <module>
    from pynvim.msgpack_rpc.session import ErrorResponse, Session
  File "/opt/homebrew/lib/python3.10/site-packages/pynvim/msgpack_rpc/session.py", line 7, in <module>
    import greenlet
  File "/opt/homebrew/lib/python3.10/site-packages/greenlet/__init__.py", line 29, in <module>
    from ._greenlet import _C_API # pylint:disable=no-name-in-module
ImportError: dlopen(/opt/homebrew/lib/python3.10/site-packages/greenlet/_greenlet.cpython-310-darwin.so, 0x0002): tried: '/opt/homebrew/lib/python3.10/site-packages/greenlet/_greenlet.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/_greenlet.cpython-310-darwin.so' (no such file), '/usr/lib/_greenlet.cpython-310-darwin.so' (no such file)
>>>
Shougo commented 2 years ago

It is not pynvim issue. https://github.com/python-greenlet/greenlet/issues/234

mt1ger commented 2 years ago

Ok. I got it. Thank you for your replies.

yoshiya0503 commented 2 years ago

It is easy to build and install from source code.

1 clone greenlet to your appropriate directory. (https://github.com/python-greenlet/greenlet)

2 check setup.py and setup.cfg

3 python setup.py bdist_wheel (build on your arm64 environment)

4 pip install dist/xxxx.whl (install from created wheel file for arm64)

5 pip list (you can check greenlet your original version)

6 check nvim (:checkhealth and see your python)
alok commented 2 years ago

@yoshiya0503 i tried your steps but got the same issue

ImportError: dlopen(/opt/homebrew/lib/python3.9/site-packages/greenlet/_greenlet.cpython-39-darwin.so, 0x0002): tried: '/opt/homebrew/lib/python3.9/site-packages/greenlet/_greenlet.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
vvuk commented 1 year ago

FWIW -- building and installing from source code works, but you have to edit setup.py and add the following to the if sys.platform == 'darwin' section:

      cpp_compile_args.append("-arch")
      cpp_compile_args.append("arm64")
      cpp_link_args.append("-arch")
      cpp_link_args.append("arm64")

for whatever reason building bdist_ext forces -arch x86_64.

yushangakki commented 1 year ago

I added those but it is not working :(