Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt PEP517 / pyproject.toml #29

Open
hobofan opened this issue Jul 27, 2024 · 0 comments
Open

Adopt PEP517 / pyproject.toml #29

hobofan opened this issue Jul 27, 2024 · 0 comments

Comments

@hobofan
Copy link

hobofan commented Jul 27, 2024

Is your feature request related to a problem? Please describe.
pip 23.1 and newer (which are the default in Python 3.12) enforce build isolation when building the wheel from source (happening for me due to usage of macOS). This causes the build to fail due to the cmake build dependency not being available.

The same problem also happens when trying to install from source using a PEP517-based package manager like e.g. Poetry.

Describe the solution you'd like

As far as I understand it, the solution would be to add a pyproject.toml file to the project that declares the build dependencies such as cmake.

Describe alternatives you've considered

Short term workaround is to use an older pip version. E.g. I manually downgrade the pip version and install the package in my venv:

poetry install
source .venv/bin/activate
pip install --upgrade pip==23.0.1
pip install pylibCZIrw==4.1.1

Additional context

Build log from a successful build on an older pip version ``` Collecting pylibCZIrw Using cached pylibCZIrw-4.1.1.tar.gz (5.4 MB) Preparing metadata (setup.py) ... done Requirement already satisfied: numpy in /Users/hobofan/.asdf/installs/python/3.10.14/lib/python3.10/site-packages (from pylibCZIrw) (2.0.1) Requirement already satisfied: cmake in /Users/hobofan/.asdf/installs/python/3.10.14/lib/python3.10/site-packages (from pylibCZIrw) (3.30.1) Requirement already satisfied: xmltodict in /Users/hobofan/.asdf/installs/python/3.10.14/lib/python3.10/site-packages (from pylibCZIrw) (0.13.0) Requirement already satisfied: validators in /Users/hobofan/.asdf/installs/python/3.10.14/lib/python3.10/site-packages (from pylibCZIrw) (0.33.0) Installing collected packages: pylibCZIrw DEPRECATION: pylibCZIrw is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559 Running setup.py install for pylibCZIrw ... done Successfully installed pylibCZIrw-4.1.1 ```
Build log from a failing build on a current pip version
Collecting pylibCZIrw
  Using cached pylibCZIrw-4.1.1.tar.gz (5.4 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy in /Users/hobofan/.asdf/installs/python/3.10.14/lib/python3.10/site-packages (from pylibCZIrw) (2.0.1)
Requirement already satisfied: cmake in /Users/hobofan/.asdf/installs/python/3.10.14/lib/python3.10/site-packages (from pylibCZIrw) (3.30.1)
Requirement already satisfied: xmltodict in /Users/hobofan/.asdf/installs/python/3.10.14/lib/python3.10/site-packages (from pylibCZIrw) (0.13.0)
Requirement already satisfied: validators in /Users/hobofan/.asdf/installs/python/3.10.14/lib/python3.10/site-packages (from pylibCZIrw) (0.33.0)
Building wheels for collected packages: pylibCZIrw
  Building wheel for pylibCZIrw (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pylibCZIrw (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [79 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-14.1-arm64-cpython-310
      creating build/lib.macosx-14.1-arm64-cpython-310/pylibCZIrw
      copying pylibCZIrw/__init__.py -> build/lib.macosx-14.1-arm64-cpython-310/pylibCZIrw
      copying pylibCZIrw/czi.py -> build/lib.macosx-14.1-arm64-cpython-310/pylibCZIrw
      running egg_info
      writing pylibCZIrw.egg-info/PKG-INFO
      writing dependency_links to pylibCZIrw.egg-info/dependency_links.txt
      writing requirements to pylibCZIrw.egg-info/requires.txt
      writing top-level names to pylibCZIrw.egg-info/top_level.txt
      reading manifest file 'pylibCZIrw.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no previously-included files matching '*' found under directory 'libs/libCZIrw/Src/CZICheck'
      warning: no previously-included files matching '*' found under directory 'libs/libCZIrw/Src/CZICmd'
      warning: no previously-included files matching '*' found under directory 'libs/libCZIrw/Src/Test'
      warning: no previously-included files matching '*' found under directory 'libs/libCZIrw/Src/libCZI_UnitTests'
      warning: no previously-included files found matching 'README.md'
      adding license file 'COPYING.txt'
      adding license file 'COPYING.LESSER.txt'
      adding license file 'NOTICE.txt'
      writing manifest file 'pylibCZIrw.egg-info/SOURCES.txt'
      running build_ext
      Traceback (most recent call last):
        File "/Users/hobofan/.asdf/installs/python/3.10.14/bin/cmake", line 5, in <module>
          from cmake import cmake
      ModuleNotFoundError: No module named 'cmake'
      Traceback (most recent call last):
        File "/Users/hobofan/.asdf/installs/python/3.10.14/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/hobofan/.asdf/installs/python/3.10.14/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/hobofan/.asdf/installs/python/3.10.14/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "/private/var/folders/8v/4hslx9cd01g3h9cxxdr3njpm0000gn/T/pip-build-env-xqisir4i/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 415, in build_wheel
          return self._build_with_temp_dir(
        File "/private/var/folders/8v/4hslx9cd01g3h9cxxdr3njpm0000gn/T/pip-build-env-xqisir4i/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 397, in _build_with_temp_dir
          self.run_setup()
        File "/private/var/folders/8v/4hslx9cd01g3h9cxxdr3njpm0000gn/T/pip-build-env-xqisir4i/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 497, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/private/var/folders/8v/4hslx9cd01g3h9cxxdr3njpm0000gn/T/pip-build-env-xqisir4i/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 313, in run_setup
          exec(code, locals())
        File "<string>", line 149, in <module>
        File "/private/var/folders/8v/4hslx9cd01g3h9cxxdr3njpm0000gn/T/pip-build-env-xqisir4i/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 108, in setup
          return distutils.core.setup(**attrs)
        File "/private/var/folders/8v/4hslx9cd01g3h9cxxdr3njpm0000gn/T/pip-build-env-xqisir4i/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 184, in setup
          return run_commands(dist)
        File "/private/var/folders/8v/4hslx9cd01g3h9cxxdr3njpm0000gn/T/pip-build-env-xqisir4i/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 200, in run_commands
          dist.run_commands()
        File "/private/var/folders/8v/4hslx9cd01g3h9cxxdr3njpm0000gn/T/pip-build-env-xqisir4i/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 970, in run_commands
          self.run_command(cmd)
        File "/private/var/folders/8v/4hslx9cd01g3h9cxxdr3njpm0000gn/T/pip-build-env-xqisir4i/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 956, in run_command
          super().run_command(command)
        File "/private/var/folders/8v/4hslx9cd01g3h9cxxdr3njpm0000gn/T/pip-build-env-xqisir4i/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 989, in run_command
          cmd_obj.run()
        File "/private/var/folders/8v/4hslx9cd01g3h9cxxdr3njpm0000gn/T/pip-build-env-xqisir4i/overlay/lib/python3.10/site-packages/setuptools/command/bdist_wheel.py", line 373, in run
          self.run_command("build")
        File "/private/var/folders/8v/4hslx9cd01g3h9cxxdr3njpm0000gn/T/pip-build-env-xqisir4i/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/8v/4hslx9cd01g3h9cxxdr3njpm0000gn/T/pip-build-env-xqisir4i/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 956, in run_command
          super().run_command(command)
        File "/private/var/folders/8v/4hslx9cd01g3h9cxxdr3njpm0000gn/T/pip-build-env-xqisir4i/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 989, in run_command
          cmd_obj.run()
        File "/private/var/folders/8v/4hslx9cd01g3h9cxxdr3njpm0000gn/T/pip-build-env-xqisir4i/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 135, in run
          self.run_command(cmd_name)
        File "/private/var/folders/8v/4hslx9cd01g3h9cxxdr3njpm0000gn/T/pip-build-env-xqisir4i/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/8v/4hslx9cd01g3h9cxxdr3njpm0000gn/T/pip-build-env-xqisir4i/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 956, in run_command
          super().run_command(command)
        File "/private/var/folders/8v/4hslx9cd01g3h9cxxdr3njpm0000gn/T/pip-build-env-xqisir4i/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 989, in run_command
          cmd_obj.run()
        File "<string>", line 32, in run
        File "/Users/hobofan/.asdf/installs/python/3.10.14/lib/python3.10/subprocess.py", line 421, in check_output
          return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
        File "/Users/hobofan/.asdf/installs/python/3.10.14/lib/python3.10/subprocess.py", line 526, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['cmake', '--version']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pylibCZIrw
Failed to build pylibCZIrw
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (pylibCZIrw)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant