[CONPY-234] mariadb-1.1.5 doesn't build from source on Linux: Missing `packaging` dependency Created: 2022-11-07  Updated: 2022-11-08  Resolved: 2022-11-08

Status: Closed
Project: MariaDB Connector/Python
Component/s: Build
Affects Version/s: 1.1.5
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Brénainn Woodsend Assignee: Georg Richter
Resolution: Duplicate Votes: 0
Labels: None
Environment:

GNU/Linux 6.0.2-2-MANJARO x86_64


Issue Links:
Duplicate
is duplicated by CONPY-233 mariadb python adapter installation b... Closed
Python Version: 3.10.4

 Description   

This commit which uses the non-stdlib packaging library at build time now breaks anyone trying to install on POSIX from source.

/tmp> python -m venv env
/tmp> source ./env/bin/activate.fish
(env) /tmp> pip install mariadb
Collecting mariadb
  Downloading mariadb-1.1.5.tar.gz (81 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 81.9/81.9 KB 708.0 kB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-e76pgcey/mariadb_d9442f68620f4d98ba2087f53cd310e9/setup.py", line 12, in <module>
          from mariadb_posix import get_config
        File "/tmp/pip-install-e76pgcey/mariadb_d9442f68620f4d98ba2087f53cd310e9/mariadb_posix.py", line 4, in <module>
          from packaging import version
      ModuleNotFoundError: No module named 'packaging'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
 
× Encountered error while generating package metadata.
╰─> See above for output.
 
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Fortunately, the fix is easy. I see this commit adding packaging as a runtime dependency only which isn't enough. To add a build-time dependency, create a pyproject.toml containing:

[build-system]
requires = [
  "setuptools",
  "packaging",
]

Then pip automagically ensures that packaging is downloaded before trying to execute the setup.py.


Generated at Thu Feb 08 03:31:15 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.