If odbc_config isn't found in the user's PATH, readlines() won't unpack anything and a ValueError will be raised. This issue is likely often to occur when a user is attempting to install pyodbc where it unfortunately produces an unhelpful error:
(example) RA80533@mbp example % python -m pip install --pre --no-binary :all: pyodbc
Collecting pyodbc
Using cached pyodbc-4.0.39.tar.gz (282 kB)
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
╰─> [20 lines of output]
Traceback (most recent call last):
File "/Users/RA80533/Desktop/example/.venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/Users/RA80533/Desktop/example/.venv/lib/python3.11/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/RA80533/Desktop/example/.venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
^^^^^^^^^^^^^^^^^^^^^
File "/private/var/folders/rx/mgpqyfxd01q4w5yhxdctdfcm0000gn/T/pip-build-env-b_hshvm7/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/var/folders/rx/mgpqyfxd01q4w5yhxdctdfcm0000gn/T/pip-build-env-b_hshvm7/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
self.run_setup()
File "/private/var/folders/rx/mgpqyfxd01q4w5yhxdctdfcm0000gn/T/pip-build-env-b_hshvm7/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 338, in run_setup
exec(code, locals())
File "<string>", line 371, in <module>
File "<string>", line 77, in main
File "<string>", line 205, in get_compiler_settings
ValueError: not enough values to unpack (expected 2, got 0)
[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.
Issue
setup.py attempts to run
odbc_config
in the user's shell viaos.popen()
:https://github.com/mkleehammer/pyodbc/blob/7b4e27781c7f1b75995ecca73d3018c929f4adef/setup.py#L204
It then calls
readlines()
and assumes there will be at least 2 values to unpack and assign tocflags
andldflags
:https://github.com/mkleehammer/pyodbc/blob/7b4e27781c7f1b75995ecca73d3018c929f4adef/setup.py#L205
If
odbc_config
isn't found in the user's PATH,readlines()
won't unpack anything and a ValueError will be raised. This issue is likely often to occur when a user is attempting to install pyodbc where it unfortunately produces an unhelpful error: