PyMySQL / mysqlclient

MySQL database connector for Python (with Python 3 support)

Home Page:https://mysqlclient.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Package installation fails after new release v2.2.0

pauliuskrispis opened this issue · comments

Describe the bug

Hi guys! I cannot seem to install mysqlclient via pip after the new release (v2.2.0).

Dropping the stack trace:

Collecting mysqlclient (from mysql==0.0.3->-r /app/requirements.txt (line 12))
  Downloading mysqlclient-2.2.0.tar.gz (89 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.5/89.5 kB 250.3 MB/s eta 0:00:00
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'error'
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [24 lines of output]
      /bin/sh: 1: pkg-config: not found
      /bin/sh: 1: pkg-config: not found
      Trying pkg-config --exists mysqlclient
      Command 'pkg-config --exists mysqlclient' returned non-zero exit status 127.
      Trying pkg-config --exists mariadb
      Command 'pkg-config --exists mariadb' returned non-zero exit status 127.
      Traceback (most recent call last):
        File "/usr/local/lib/python3.8/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/local/lib/python3.8/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/local/lib/python3.8/dist-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-d4slkkxg/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/tmp/pip-build-env-d4slkkxg/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-d4slkkxg/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 154, in <module>
        File "<string>", line 48, in get_config_posix
        File "<string>", line 27, in find_package_name
      Exception: Can not find valid pkg-config name.
      Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

I just want to verify if this is related to the new release.

I can confirm from my testing that 2.1.1 worked fine and 2.2.0 failed to build for me as seen by @pauliuskrispis

As message said, you need to install pkg-config

@methane Alpine Linux doesn't have a pkg-config package. It does have a pkgconfig but installing that didn't resolve the issue for me.

You should fix it by yourself or alpine community.

Same issue here, please fix this as soon as possible. Reopen the issue as it is important.

Exporting environment variables as a workaround is definitely not proper.

commented

@methane I've got pkg-config installed, but still mysqlclient >= 2.2.0 fails to install as follows on Ubuntu 22.04 LTS and python 3.10:

Collecting mysqlclient==2.2.0 (from -r base-requirements.txt (line 65))                                                                                                                                                                        
  Downloading mysqlclient-2.2.0.tar.gz (89 kB)                                                                                                                                                                                                 
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.5/89.5 kB 8.4 MB/s eta 0:00:00                                                                                                                                                                
  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                                                                                                                                                                                                                               
  ╰─> [22 lines of output]                                                                                                                                                                                                                     
      Trying pkg-config --exists mysqlclient                                                                                                                                                                                                   
      Command 'pkg-config --exists mysqlclient' returned non-zero exit status 1.                                                                                                                                                               
      Trying pkg-config --exists mariadb                                                                                                                                                                                                       
      Command 'pkg-config --exists mariadb' returned non-zero exit status 1.                                                                                                                                                                   
      Traceback (most recent call last):                                                                                                                                                                                                       
        File "/home/quividi/.venv/vidicenter/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>                                                                                       
          main()                                                                                                                                                                                                                               
        File "/home/quividi/.venv/vidicenter/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 "/home/quividi/.venv/vidicenter/lib/python3.10/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-vvrc6ll4/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel                                                                                            
          return self._get_build_requires(config_settings, requirements=['wheel'])                                                                                                                                                             
        File "/tmp/pip-build-env-vvrc6ll4/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires                                                                                                     
          self.run_setup()                                                                                                                                                                                                                     
        File "/tmp/pip-build-env-vvrc6ll4/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in run_setup                                                                                                               
          exec(code, locals())                                                                                                                                                                                                                 
        File "<string>", line 154, in <module>                                                                                                                                                                                                 
        File "<string>", line 48, in get_config_posix                                                                                                                                                                                          
        File "<string>", line 27, in find_package_name                                                                                                                                                                                         
      Exception: Can not find valid pkg-config name.                                                                                                                                                                                           
      Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually                                                                                                                                                                     
      [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.