oracle / graalpython

A Python 3 implementation built on GraalVM
Other
1.2k stars 103 forks source link

Unable to pip install cryptography 3.4.7 #325

Closed jiridanek closed 1 year ago

jiridanek commented 1 year ago

Since pip install actually picks up older 3.4.7, I hoped this will work, but it did not

(.venv) [jdanek@fedora dtests]$ python3 -m pip install cryptography
INFO: Choosing GraalPy tested version 3.4.7 for cryptography
Collecting cryptography==3.4.7
  WARNING: Cache entry deserialization failed, entry ignored
  Downloading cryptography-3.4.7.tar.gz (546 kB)
     |████████████████████████████████| 546 kB 36 kB/s 
Looking for GraalPy patches for cryptography
Patching package cryptography using /home/jdanek/Downloads/graalvm-ce-java17-22.3.1/languages/python/lib-graalpython/patches/cryptography/sdist/cryptography-3.4.7.patch
patching file setup.py
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
INFO: Choosing GraalPy tested version 7 for pytest>=6.0; extra == "test"
Requirement already satisfied: cffi>=1.12 in ./.venv/lib/python3.8/site-packages (from cryptography==3.4.7) (1.15.1)
Requirement already satisfied: pycparser in ./.venv/lib/python3.8/site-packages (from cffi>=1.12->cryptography==3.4.7) (2.21)
Building wheels for collected packages: cryptography
  Building wheel for cryptography (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/jdanek/repos/testing/dtests/.venv/bin/graalpy /home/jdanek/repos/testing/dtests/.venv/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp6glnrsd7
       cwd: /tmp/pip-install-2e_woqk8/cryptography
  Complete output (477 lines):

[...]

  Traceback (most recent call last):
    File "/home/jdanek/repos/testing/dtests/.venv/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
      main()
    File "/home/jdanek/repos/testing/dtests/.venv/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/home/jdanek/repos/testing/dtests/.venv/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 204, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/tmp/pip-unpacked-wheel-rcdramdd/setuptools/build_meta.py", line 413, in build_wheel
    File "/tmp/pip-unpacked-wheel-rcdramdd/setuptools/build_meta.py", line 398, in _build_with_temp_dir
    File "/tmp/pip-unpacked-wheel-rcdramdd/setuptools/build_meta.py", line 335, in run_setup
    File "<string>", line 152, in <module>
    File "/tmp/pip-build-env-obaxx3wv/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 108, in setup
      return distutils.core.setup(**attrs)
    File "/tmp/pip-build-env-obaxx3wv/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 185, in setup
      return run_commands(dist)
    File "/tmp/pip-build-env-obaxx3wv/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
      dist.run_commands()
    File "/tmp/pip-unpacked-wheel-rcdramdd/setuptools/_distutils/dist.py", line 969, in run_commands
    File "/tmp/pip-unpacked-wheel-rcdramdd/setuptools/dist.py", line 1221, in run_command
    File "/tmp/pip-unpacked-wheel-rcdramdd/setuptools/_distutils/dist.py", line 988, in run_command
    File "/tmp/pip-unpacked-wheel-u9u704y2/wheel/bdist_wheel.py", line 380, in run
    File "/tmp/pip-unpacked-wheel-u9u704y2/wheel/bdist_wheel.py", line 329, in get_tag
  AssertionError: would build wheel with unsupported tag ('graalpy38', 'graalpy_38_native_x86_64_linux', 'linux_i686')
  ----------------------------------------
  ERROR: Failed building wheel for cryptography
Failed to build cryptography
ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly

I have graalvm-ce-java17-22.3.1

$  cat /etc/redhat-release 
Fedora release 38 (Thirty Eight)
$ uname -a
Linux fedora 6.2.8-300.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Mar 22 19:29:30 UTC 2023 x86_64 GNU/Linux
msimacek commented 1 year ago

Currently, you need to downgrade your wheel package version to wheel==0.38.*. The current release of wheel is not yet compatible. We made graalpy's pip prefer wheel 0.38 when installing, so we shouldn't get this problem in the next release.

jiridanek commented 1 year ago

I got the same failure with wheel 0.38.4

$ Downloads/graalvm-ce-java17-22.3.1/bin/graalpy -m venv cryp
We're not using symlinks in a Graal Python venv
$ cryp/bin/graalpy -m pip install 'wheel==0.38.*'
Collecting wheel==0.38.*
  WARNING: Cache entry deserialization failed, entry ignored
  Downloading wheel-0.38.4-py3-none-any.whl (36 kB)
Looking for GraalPy patches for wheel
Patching package wheel using /home/jdanek/Downloads/graalvm-ce-java17-22.3.1/languages/python/lib-graalpython/patches/wheel/whl/wheel.patch
INFO: Choosing GraalPy tested version 7 for pytest>=3.0.0; extra == "test"
INFO: Choosing GraalPy tested version 20.1.1 for pip>=19.1; extra == "tests"
Installing collected packages: wheel
Looking for GraalPy patches for wheel
Patching package wheel using /home/jdanek/Downloads/graalvm-ce-java17-22.3.1/languages/python/lib-graalpython/patches/wheel/whl/wheel.patch
Successfully installed wheel-0.38.4
WARNING: You are using pip version 20.1.1; however, version 23.0.1 is available.
You should consider upgrading via the '/home/jdanek/cryp/bin/graalpy -m pip install --upgrade pip' command.
$ cryp/bin/graalpy -m pip install cryptography
INFO: Choosing GraalPy tested version 3.4.7 for cryptography
Collecting cryptography==3.4.7
  WARNING: Cache entry deserialization failed, entry ignored
  Downloading cryptography-3.4.7.tar.gz (546 kB)
     |████████████████████████████████| 546 kB 972 kB/s 
Looking for GraalPy patches for cryptography
Patching package cryptography using /home/jdanek/Downloads/graalvm-ce-java17-22.3.1/languages/python/lib-graalpython/patches/cryptography/sdist/cryptography-3.4.7.patch
patching file setup.py
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
INFO: Choosing GraalPy tested version 7 for pytest>=6.0; extra == "test"
Processing ./.cache/pip/wheels/a4/35/44/98933504be58d2a9930392ddffe66c82272768e59834cc5bf0/cffi-1.15.1-graalpy38-graalpy_38_native_x86_64_linux-linux_i686.whl
Looking for GraalPy patches for cffi
Collecting pycparser
  WARNING: Cache entry deserialization failed, entry ignored
  Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
     |████████████████████████████████| 118 kB 6.1 MB/s 
Looking for GraalPy patches for pycparser
Building wheels for collected packages: cryptography
  Building wheel for cryptography (PEP 517) ... \

[...]

  Traceback (most recent call last):
    File "/home/jdanek/cryp/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
      main()
    File "/home/jdanek/cryp/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/home/jdanek/cryp/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 204, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/tmp/pip-unpacked-wheel-19s2tjtt/setuptools/build_meta.py", line 413, in build_wheel
    File "/tmp/pip-unpacked-wheel-19s2tjtt/setuptools/build_meta.py", line 398, in _build_with_temp_dir
    File "/tmp/pip-unpacked-wheel-19s2tjtt/setuptools/build_meta.py", line 335, in run_setup
    File "<string>", line 152, in <module>
    File "/tmp/pip-build-env-wjdmgw59/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 108, in setup
      return distutils.core.setup(**attrs)
    File "/tmp/pip-build-env-wjdmgw59/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 185, in setup
      return run_commands(dist)
    File "/tmp/pip-build-env-wjdmgw59/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
      dist.run_commands()
    File "/tmp/pip-unpacked-wheel-19s2tjtt/setuptools/_distutils/dist.py", line 969, in run_commands
    File "/tmp/pip-unpacked-wheel-19s2tjtt/setuptools/dist.py", line 1221, in run_command
    File "/tmp/pip-unpacked-wheel-19s2tjtt/setuptools/_distutils/dist.py", line 988, in run_command
    File "/tmp/pip-unpacked-wheel-punsg8hl/wheel/bdist_wheel.py", line 380, in run
    File "/tmp/pip-unpacked-wheel-punsg8hl/wheel/bdist_wheel.py", line 329, in get_tag
  AssertionError: would build wheel with unsupported tag ('graalpy38', 'graalpy_38_native_x86_64_linux', 'linux_i686')
  ----------------------------------------
  ERROR: Failed building wheel for cryptography
Failed to build cryptography
ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly
msimacek commented 1 year ago

Ah, it uses an isolated build that pulls in it's own wheel. Can you try with --no-build-isolation? Also, using the latest snapshot should work.

jiridanek commented 1 year ago

I was already in the process of trying the snapshot, which seems to work,

$ Downloads/graalpy-23.1.0-dev-linux-amd64/bin/graalpy -m venv venvgpy_nightly
$ venvgpy_nightly/bin/graalpy -m ginstall install wheel
Installing required dependency: wheel ... 
Package not found: 'wheel'
$ venvgpy_nightly/bin/graalpy -m pip install cryptography
[...]
  Running setup.py install for cffi ... done
Successfully installed cffi-1.15.1 cryptography-3.4.7 pycparser-2.21

Trying with --no-build-isolation,

$ graalpy -m pip install cryptography --no-build-isolation
[...]
    Traceback (most recent call last):
      File "/home/jdanek/repos/testing/dtests/.venv/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
        main()
      File "/home/jdanek/repos/testing/dtests/.venv/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "/home/jdanek/repos/testing/dtests/.venv/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 133, in prepare_metadata_for_build_wheel
        return hook(metadata_directory, config_settings)
      File "/tmp/pip-unpacked-wheel-j92qsw0k/setuptools/build_meta.py", line 158, in prepare_metadata_for_build_wheel
      File "/tmp/pip-unpacked-wheel-j92qsw0k/setuptools/build_meta.py", line 143, in run_setup
      File "/tmp/pip-install-4f106r8l/cryptography/setup.py", line 14, in <module>
        from setuptools_rust import RustExtension
    ModuleNotFoundError: No module named 'setuptools_rust'
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/jdanek/repos/testing/dtests/.venv/bin/graalpy /home/jdanek/repos/testing/dtests/.venv/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp3cd3iyl6 Check the logs for full command output.

I'm happy with using the snapshot for the time being, thanks!

msimacek commented 1 year ago

Good, thanks for testing.