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

uWSGI 2.0.25: TypeError: sequence item 14: expected str instance, NoneType found #2630

Closed
chickahoona opened this issue Apr 14, 2024 · 9 comments

Comments

@chickahoona
Copy link

Hi,

I am running into an issue with the newest uwsgi (2.0.25). I am pinning things now to 2.0.24 so its not really a big deal for now, yet this of course prevents me from upgrading to newer patches which (especially for seucity updates) will be a problem for me :(

Steps to reproduce the issue

docker run -it python:3.11.3-alpine3.16 /bin/sh
apk add build-base && pip3 install uwsgi

The full error output:

Collecting uwsgi
  Using cached uwsgi-2.0.25.tar.gz (811 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: uwsgi
  Building wheel for uwsgi (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [49 lines of output]
      /usr/local/lib/python3.11/site-packages/setuptools/_distutils/dist.py:264: UserWarning: Unknown distribution option: 'descriptions'
        warnings.warn(msg)
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib
      copying uwsgidecorators.py -> build/lib
      /usr/local/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      installing to build/bdist.linux-x86_64/wheel
      running install
      using profile: buildconf/default.ini
      detected include path: ['/usr/local/include', '/usr/include/fortify', '/usr/include', '/usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/include']
      Patching "bin_name" to properly install_scripts dir
      detected CPU cores: 16
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-rpmde5o5/uwsgi_bf87333a916945eea9e199e0dca8ae21/setup.py", line 117, in <module>
          setup(
        File "/usr/local/lib/python3.11/site-packages/setuptools/__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/local/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/usr/local/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/usr/local/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands
          self.run_command(cmd)
        File "/usr/local/lib/python3.11/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "/usr/local/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
          cmd_obj.run()
        File "/usr/local/lib/python3.11/site-packages/wheel/bdist_wheel.py", line 378, in run
          self.run_command("install")
        File "/usr/local/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
          self.distribution.run_command(command)
        File "/usr/local/lib/python3.11/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "/usr/local/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
          cmd_obj.run()
        File "/tmp/pip-install-rpmde5o5/uwsgi_bf87333a916945eea9e199e0dca8ae21/setup.py", line 79, in run
          uc.build_uwsgi(conf)
        File "/tmp/pip-install-rpmde5o5/uwsgi_bf87333a916945eea9e199e0dca8ae21/uwsgiconfig.py", line 325, in build_uwsgi
          print("configured CFLAGS: %s" % ' '.join(cflags))
                                          ^^^^^^^^^^^^^^^^
      TypeError: sequence item 14: expected str instance, NoneType found
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for uwsgi
  Running setup.py clean for uwsgi
Failed to build uwsgi
Installing collected packages: uwsgi
  Running setup.py install for uwsgi ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for uwsgi did not run successfully.
  │ exit code: 1
  ╰─> [34 lines of output]
      /usr/local/lib/python3.11/site-packages/setuptools/_distutils/dist.py:264: UserWarning: Unknown distribution option: 'descriptions'
        warnings.warn(msg)
      running install
      /usr/local/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      using profile: buildconf/default.ini
      detected include path: ['/usr/local/include', '/usr/include/fortify', '/usr/include', '/usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/include']
      Patching "bin_name" to properly install_scripts dir
      detected CPU cores: 16
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-rpmde5o5/uwsgi_bf87333a916945eea9e199e0dca8ae21/setup.py", line 117, in <module>
          setup(
        File "/usr/local/lib/python3.11/site-packages/setuptools/__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/local/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/usr/local/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/usr/local/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands
          self.run_command(cmd)
        File "/usr/local/lib/python3.11/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "/usr/local/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
          cmd_obj.run()
        File "/tmp/pip-install-rpmde5o5/uwsgi_bf87333a916945eea9e199e0dca8ae21/setup.py", line 79, in run
          uc.build_uwsgi(conf)
        File "/tmp/pip-install-rpmde5o5/uwsgi_bf87333a916945eea9e199e0dca8ae21/uwsgiconfig.py", line 325, in build_uwsgi
          print("configured CFLAGS: %s" % ' '.join(cflags))
                                          ^^^^^^^^^^^^^^^^
      TypeError: sequence item 14: expected str instance, NoneType found
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> uwsgi
@xrmx
Copy link
Collaborator

xrmx commented Apr 14, 2024

thanks for reporting. Could you please build it from git and help debugging the issue a bit?

@chickahoona
Copy link
Author

This line here fails because clfags contains a parameter that is no String, but None instead:
https://github.com/unbit/uwsgi/blob/2.0.25/uwsgiconfig.py#L325

I follwoed it back. Its pcre_cflags here that is None
https://github.com/unbit/uwsgi/blob/2.0.25/uwsgiconfig.py#L1105

That parameter is populated here:
https://github.com/unbit/uwsgi/blob/2.0.25/uwsgiconfig.py#L1094

And when I manually execute it I get:

# pcre-config --cflags
/bin/sh: pcre-config: not found

So one can install pcre-dev:

apk add pcre-dev

It then failed with some classic missing headers, yet that could be fixed with:

apk add linux-headers

So afterwards I could finally build uwsgi. The complete "solution" is:

docker run -it python:3.11.3-alpine3.16 /bin/sh
apk add build-base linux-headers pcre-dev && pip3 install uwsgi

That missing pcre-dev package was quite unpleasant to troubleshoot. A check if it exists and then throwing a meaningful error would be quite beneficial. :(

@xrmx
Copy link
Collaborator

xrmx commented Apr 15, 2024

Thanks! What values do you have in required_pcre and pcre_libs?

@chickahoona
Copy link
Author

chickahoona commented Apr 15, 2024

required_pcre is auto
pcre_libs is None

The call here to popuplate pcre_libs:

https://github.com/unbit/uwsgi/blob/2.0.25/uwsgiconfig.py#L1088C33-L1088C53

is none, as the command isn't found:

# pcre2-config --libs8
/bin/sh: pcre2-config: not found

@xrmx
Copy link
Collaborator

xrmx commented Apr 15, 2024

The we are missing a guard around here https://github.com/unbit/uwsgi/blob/2.0.25/uwsgiconfig.py#L1104

@a-wakeel
Copy link

I have faced the same issue, building inside docker, instead i downgraded to 2.0.24

@AnonHax0r
Copy link

AnonHax0r commented Apr 15, 2024

I too had this issue, C_FLAGS were missing, broke our pipeline and we redeployed with 2.0.24 and problem was resolved.

Built in docker via AWS CodeDeploy on AmazonLinux2023.

@xrmx xrmx closed this as completed Apr 15, 2024
@xrmx
Copy link
Collaborator

xrmx commented Apr 15, 2024

Fixed by #2632

@chickahoona
Copy link
Author

I can confirm that the new release (2.0.25.1) fixed it for me. Thanks alot!

oharsta added a commit to SURFscz/SBS that referenced this issue Apr 19, 2024
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

Successfully merging a pull request may close this issue.

4 participants