ontap-rest-python icon indicating copy to clipboard operation
ontap-rest-python copied to clipboard

Wheel build is broken in a clean Python environment

Open TimotheusBachinger opened this issue 2 years ago • 2 comments

Hi NetApp,

we need to build and compile from source and using netapp_ontap-9.14.1.0.tar.gz for that which fails with:

╭─ /tmp/netapp_original/netapp_ontap-9.14.1.0 
╰─$ python -m pip install --no-binary=":all:" --no-deps --compile --isolated --prefix=$PWD .
Processing /tmp/netapp_original/netapp_ontap-9.14.1.0
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [26 lines of output]
      Traceback (most recent call last):
        File "/home/timotheus/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/timotheus/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/timotheus/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-1qdt_rr5/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-1qdt_rr5/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-1qdt_rr5/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 480, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-1qdt_rr5/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 9, in <module>
        File "/tmp/netapp_original/netapp_ontap-9.14.1.0/netapp_ontap/__init__.py", line 1889, in <module>
          from netapp_ontap.error import NetAppRestError
        File "/tmp/netapp_original/netapp_ontap-9.14.1.0/netapp_ontap/error.py", line 11, in <module>
          from netapp_ontap.response import NetAppResponse
        File "/tmp/netapp_original/netapp_ontap-9.14.1.0/netapp_ontap/response.py", line 8, in <module>
          import requests
      ModuleNotFoundError: No module named 'requests'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

[notice] A new release of pip is available: 23.3.1 -> 23.3.2
[notice] To update, run: pip install --upgrade pip

The setup.py defines correctly the needed build dependency with:

    install_requires=["marshmallow>=3.2.1", "requests>=2.26.0", "requests-toolbelt>=0.9.1", "urllib3>=1.26.7","certifi>=2022.12.7"],

but the build fails as it already needs requests during import netapp_ontap.

Here a simple workaround:

9d8
< import netapp_ontap
13c12
<     version=netapp_ontap.__version__,
---
>     version="9.14.1.0",
17c16
<     long_description=netapp_ontap.__doc__,
---
>     long_description="see netapp_ontap.__doc__",

Which results in a successful build without having requests installed beforehand.

Could you fix this on your side?

Regards Timi

TimotheusBachinger avatar Jan 17 '24 10:01 TimotheusBachinger

Thank you for reporting an issue! If you haven't already joined our Discord community, then we invite you to do so. This is a great place to get help and ask questions from our community.

github-actions[bot] avatar Jan 17 '24 10:01 github-actions[bot]

I have currently a work around in place by using a fork in our build process in case any body needs a quick solution: https://github.com/Checkmk/checkmk/commit/36ae1e1230cacd53a508a7c2eed6d9f2fdf8f6f5 and https://github.com/Checkmk/netapp-ontap-cmk/commit/e38ce4ce357ad2ea8f47260c269757f8805bdbce

TimotheusBachinger avatar Jan 18 '24 08:01 TimotheusBachinger