Docker-compose 不再构建镜像(AttributeError: cython_sources)

huangapple go评论105阅读模式
英文:

Docker-compose no longer building image (AttributeError: cython_sources)

问题

I've extracted the relevant information from your text:

You have a Django-React site, and suddenly your Docker Compose is no longer building, even though you haven't made changes to your requirements or image versions. Here's your requirements.txt:

  1. Django>=3.2.4,<4.0
  2. djangorestframework>=3.12.4,<3.14.0
  3. djangorestframework-simplejwt>=4.8.0,<5.3.0
  4. psycopg2>=2.8.6,<2.9
  5. drf-spectacular>=0.15.1,<0.30
  6. django-allauth>0.5,<1.0
  7. dj-rest-auth>=3.0,<4.0

You are facing issues with the build, specifically related to drf-spectacular. When you remove it, the build works, but you still encounter issues after adding pyyaml dependency.

You're wondering why these versions worked together before but not now, and you're seeking information on what might have changed.

Let me know if you need further assistance.

英文:

I am building a django-react site and suddenly my docker-compose no longer builds despite any changes to requirements or image versions.

My requirements.txt looks as follows:

  1. Django>=3.2.4,<4.0
  2. djangorestframework>=3.12.4,<3.14.0
  3. djangorestframework-simplejwt>=4.8.0,<5.3.0
  4. psycopg2>=2.8.6,<2.9
  5. drf-spectacular>=0.15.1,<0.30
  6. django-allauth>0.5,<1.0
  7. dj-rest-auth>=3.0,<4.0

The error output:

  1. => [backend internal] load .dockerignore 0.0s
  2. => => transferring context: 234B 0.0s
  3. => [backend internal] load build definition from Dockerfile 0.0s
  4. => => transferring dockerfile: 933B 0.0s
  5. => [backend internal] load metadata for docker.io/library/python:3.9-alpine3.13 0.5s
  6. => [backend 1/6] FROM docker.io/library/python:3.9-alpine3.13@sha256:a7cbd1e7784a35a098cedbc8681b790d35ff6030a5e13f043185e2465003a040 0.0s
  7. => [backend internal] load build context 0.0s
  8. => => transferring context: 2.53kB 0.0s
  9. => CACHED [backend 2/6] WORKDIR /app/backend 0.0s
  10. => CACHED [backend 3/6] COPY ./requirements.txt /tmp/requirements.txt 0.0s
  11. => CACHED [backend 4/6] COPY ./requirements.dev.txt /tmp/requirements.dev.txt 0.0s
  12. => CACHED [backend 5/6] COPY . /app/backend 0.0s
  13. => ERROR [backend 6/6] RUN python -m venv /py && /py/bin/pip install --upgrade pip && apk add --update --no-cache postgresql-client jpeg-dev && apk add --update --no-cache --virtual .tmp- 18.9s
  14. ------
  15. > [backend 6/6] RUN python -m venv /py && /py/bin/pip install --upgrade pip && apk add --update --no-cache postgresql-client jpeg-dev && apk add --update --no-cache --virtual .tmp-build-deps
  16. build-base postgresql-dev musl-dev zlib zlib-dev && /py/bin/pip install -r /tmp/requirements.txt && if [ true = "true" ]; then /py/bin/pip install -r /tmp/requirements.dev.txt ; fi &&
  17. rm -rf /tmp && apk del .tmp-build-deps && adduser --disabled-password --no-create-home django-user:
  18. 2.951 Requirement already satisfied: pip in /py/lib/python3.9/site-packages (21.2.4)
  19. 3.090 Collecting pip
  20. 3.202 Downloading pip-23.2-py3-none-any.whl (2.1 MB)
  21. 3.389 Installing collected packages: pip
  22. 3.389 Attempting uninstall: pip
  23. 3.389 Found existing installation: pip 21.2.4
  24. 3.454 Uninstalling pip-21.2.4:
  25. 3.458 Successfully uninstalled pip-21.2.4
  26. 4.339 Successfully installed pip-23.2
  27. 4.506 fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
  28. 4.832 fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
  29. 5.062 (1/9) Installing libjpeg-turbo (2.1.0-r0)
  30. 5.092 (2/9) Installing pkgconf (1.7.3-r0)
  31. 5.116 (3/9) Installing libjpeg-turbo-dev (2.1.0-r0)
  32. 5.137 (4/9) Installing jpeg-dev (9d-r1)
  33. 5.156 (5/9) Installing libedit (20191231.3.1-r1)
  34. 5.179 (6/9) Installing libsasl (2.1.28-r0)
  35. 5.204 (7/9) Installing libldap (2.4.57-r1)
  36. 5.263 (8/9) Installing libpq (13.11-r0)
  37. 5.287 (9/9) Installing postgresql-client (13.11-r0)
  38. 5.358 Executing busybox-1.32.1-r7.trigger
  39. 5.362 OK: 20 MiB in 45 packages
  40. 5.383 fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
  41. 5.520 fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
  42. 5.644 (1/37) Upgrading musl (1.2.2-r1 -> 1.2.2-r2)
  43. 5.676 (2/37) Upgrading libcrypto1.1 (1.1.1l-r0 -> 1.1.1s-r0)
  44. 5.755 (3/37) Upgrading libssl1.1 (1.1.1l-r0 -> 1.1.1s-r0)
  45. 5.806 (4/37) Upgrading zlib (1.2.11-r3 -> 1.2.12-r3)
  46. 5.830 (5/37) Installing libgcc (10.2.1_pre1-r3)
  47. 5.860 (6/37) Installing libstdc++ (10.2.1_pre1-r3)
  48. 5.923 (7/37) Installing binutils (2.35.2-r1)
  49. 6.069 (8/37) Installing libmagic (5.39-r0)
  50. 6.137 (9/37) Installing file (5.39-r0)
  51. 6.156 (10/37) Installing libgomp (10.2.1_pre1-r3)
  52. 6.191 (11/37) Installing libatomic (10.2.1_pre1-r3)
  53. 6.208 (12/37) Installing libgphobos (10.2.1_pre1-r3)
  54. 6.307 (13/37) Installing gmp (6.2.1-r1)
  55. 6.342 (14/37) Installing isl22 (0.22-r0)
  56. 6.403 (15/37) Installing mpfr4 (4.1.0-r0)
  57. 6.501 (16/37) Installing mpc1 (1.2.0-r0)
  58. 6.528 (17/37) Installing gcc (10.2.1_pre1-r3)
  59. 7.430 (18/37) Installing musl-dev (1.2.2-r2)
  60. 7.544 (19/37) Installing libc-dev (0.7.2-r3)
  61. 7.574 (20/37) Installing g++ (10.2.1_pre1-r3)
  62. 8.135 (21/37) Installing make (4.3-r0)
  63. 8.157 (22/37) Installing fortify-headers (1.1-r0)
  64. 8.177 (23/37) Installing patch (2.7.6-r7)
  65. 8.209 (24/37) Installing build-base (0.5-r3)
  66. 8.229 (25/37) Installing libxml2 (2.9.14-r2)
  67. 8.293 (26/37) Installing llvm10-libs (10.0.1-r1)
  68. 8.719 (27/37) Installing clang-libs (10.0.1-r0)
  69. 9.345 (28/37) Installing clang (10.0.1-r0)
  70. 9.587 (29/37) Installing llvm10 (10.0.1-r1)
  71. 9.695 (30/37) Installing openssl-dev (1.1.1s-r0)
  72. 9.724 (31/37) Installing icu-libs (67.1-r2)
  73. 9.985 (32/37) Installing icu (67.1-r2)
  74. 10.01 (33/37) Installing icu-dev (67.1-r2)
  75. 10.07 (34/37) Installing postgresql-libs (13.11-r0)
  76. 10.10 (35/37) Installing postgresql-dev (13.11-r0)
  77. 10.22 (36/37) Installing zlib-dev (1.2.12-r3)
  78. 10.25 (37/37) Installing .tmp-build-deps (20230717.214226)
  79. 10.25 Executing busybox-1.32.1-r7.trigger
  80. 10.25 Executing ca-certificates-20191127-r5.trigger
  81. 10.31 OK: 414 MiB in 78 packages
  82. 10.78 Collecting Django<4.0,>=3.2.4 (from -r /tmp/requirements.txt (line 1))
  83. 10.78 Obtaining dependency information for Django<4.0,>=3.2.4 from https://files.pythonhosted.org/packages/84/eb/5329ae72bf26b91844985d0de74e4edf876e3ca409d085820f230eea2eba/Django-3.2.20-py3-none-any.whl.metadata
  84. 10.84 Downloading Django-3.2.20-py3-none-any.whl.metadata (4.1 kB)
  85. 10.91 Collecting djangorestframework<3.14.0,>=3.12.4 (from -r /tmp/requirements.txt (line 2))
  86. 10.93 Downloading djangorestframework-3.13.1-py3-none-any.whl (958 kB)
  87. 11.04 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 958.3/958.3 kB 9.6 MB/s eta 0:00:00
  88. 11.07 Collecting djangorestframework-simplejwt<5.3.0,>=4.8.0 (from -r /tmp/requirements.txt (line 3))
  89. 11.09 Downloading djangorestframework_simplejwt-5.2.2-py3-none-any.whl (85 kB)
  90. 11.11 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 85.4/85.4 kB 7.8 MB/s eta 0:00:00
  91. 11.17 Collecting psycopg2<2.9,>=2.8.6 (from -r /tmp/requirements.txt (line 4))
  92. 11.19 Downloading psycopg2-2.8.6.tar.gz (383 kB)
  93. 11.21 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 383.8/383.8 kB 30.7 MB/s eta 0:00:00
  94. 11.24 Installing build dependencies: started
  95. 12.43 Installing build dependencies: finished with status 'done'
  96. 12.43 Getting requirements to build wheel: started
  97. 12.57 Getting requirements to build wheel: finished with status 'done'
  98. 12.57 Preparing metadata (pyproject.toml): started
  99. 12.69 Preparing metadata (pyproject.toml): finished with status 'done'
  100. 12.74 Collecting drf-spectacular<0.30,>=0.15.1 (from -r /tmp/requirements.txt (line 5))
  101. 12.74 Obtaining dependency information for drf-spectacular<0.30,>=0.15.1 from https://files.pythonhosted.org/packages/e2/3b/29189bbfb2443335ed1d6f0750d14f7ba5e5b89699a58cc87fa82fdb5f49/drf_spectacular-0.26.3-py3-none-any.whl.metadata
  102. 12.76 Downloading drf_spectacular-0.26.3-py3-none-any.whl.metadata (13 kB)
  103. 12.79 Collecting django-allauth<1.0,>0.5 (from -r /tmp/requirements.txt (line 6))
  104. 12.81 Downloading django-allauth-0.54.0.tar.gz (737 kB)
  105. 12.85 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 737.1/737.1 kB 18.6 MB/s eta 0:00:00
  106. 13.04 Installing build dependencies: started
  107. 14.05 Installing build dependencies: finished with status 'done'
  108. 14.05 Getting requirements to build wheel: started
  109. 14.24 Getting requirements to build wheel: finished with status 'done'
  110. 14.25 Preparing metadata (pyproject.toml): started
  111. 14.44 Preparing metadata (pyproject.toml): finished with status 'done'
  112. 14.48 Collecting dj-rest-auth<4.0,>=3.0 (from -r /tmp/requirements.txt (line 7))
  113. 14.50 Downloading dj-rest-auth-3.0.0.tar.gz (100 kB)
  114. 14.51 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.2/100.2 kB 10.6 MB/s eta 0:00:00
  115. 14.54 Installing build dependencies: started
  116. 15.52 Installing build dependencies: finished with status 'done'
  117. 15.52 Getting requirements to build wheel: started
  118. 15.63 Getting requirements to build wheel: finished with status 'done'
  119. 15.63 Preparing metadata (pyproject.toml): started
  120. 15.75 Preparing metadata (pyproject.toml): finished with status 'done'
  121. 15.79 Collecting asgiref<4,>=3.3.2 (from Django<4.0,>=3.2.4->-r /tmp/requirements.txt (line 1))
  122. 15.79 Obtaining dependency information for asgiref<4,>=3.3.2 from https://files.pythonhosted.org/packages/9b/80/b9051a4a07ad231558fcd8ffc89232711b4e618c15cb7a392a17384bbeef/asgiref-3.7.2-py3-none-any.whl.metadata
  123. 15.80 Downloading asgiref-3.7.2-py3-none-any.whl.metadata (9.2 kB)
  124. 15.87 Collecting pytz (from Django<4.0,>=3.2.4->-r /tmp/requirements.txt (line 1))
  125. 15.90 Downloading pytz-2023.3-py2.py3-none-any.whl (502 kB)
  126. 15.93 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 502.3/502.3 kB 20.1 MB/s eta 0:00:00
  127. 15.96 Collecting sqlparse>=0.2.2 (from Django<4.0,>=3.2.4->-r /tmp/requirements.txt (line 1))
  128. 15.98 Downloading sqlparse-0.4.4-py3-none-any.whl (41 kB)
  129. 15.99 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.2/41.2 kB 11.2 MB/s eta 0:00:00
  130. 16.05 Collecting pyjwt<3,>=1.7.1 (from djangorestframework-simplejwt<5.3.0,>=4.8.0->-r /tmp/requirements.txt (line 3))
  131. 16.07 Downloading PyJWT-2.7.0-py3-none-any.whl (22 kB)
  132. 16.11 Collecting uritemplate>=2.0.0 (from drf-spectacular<0.30,>=0.15.1->-r /tmp/requirements.txt (line 5))
  133. 16.13 Downloading uritemplate-4.1.1-py2.py3-none-any.whl (10 kB)
  134. 16.18 Collecting PyYAML>=5.1 (from drf-spectacular<0.30,>=0.15.1->-r /tmp/requirements.txt (line 5))
  135. 16.20 Downloading PyYAML-6.0.tar.gz (124 kB)
  136. 16.21 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 125.0/125.0 kB 16.8 MB/s eta 0:00:00
  137. 16.31 Installing build dependencies: started
  138. 18.33 Installing build dependencies: finished with status 'done'
  139. 18.33 Getting requirements to build wheel: started
  140. 18.48 Getting requirements to build wheel: finished with status 'error'
  141. 18.48 error: subprocess-exited-with-error
  142. 18.48
  143. 18.48 × Getting requirements to build wheel did not run successfully.
  144. 18.48 exit code: 1
  145. 18.48 ╰─> [48 lines of output]
  146. 18.48 running egg_info
  147. 18.48 writing lib/PyYAML.egg-info/PKG-INFO
  148. 18.48 writing dependency_links to lib/PyYAML.egg-info/dependency_links.txt
  149. 18.48 writing top-level names to lib/PyYAML.egg-info/top_level.txt
  150. 18.48 Traceback (most recent call last):
  151. 18.48 File "/py/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
  152. 18.48 main()
  153. 18.48 File "/py/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
  154. 18.48 json_out['return_val'] = hook(**hook_input['kwargs'])
  155. 18.48 File "/py/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
  156. 18.48 return hook(config_settings)
  157. 18.48 File "/tmp/pip-build-env-a_iltcrr/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
  158. 18.48 return self._get_build_requires(config_settings, requirements=['wheel'])
  159. 18.48 File "/tmp/pip-build-env-a_iltcrr/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
  160. 18.48 self.run_setup()
  161. 18.48 File "/tmp/pip-build-env-a_iltcrr/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 338, in run_setup
  162. 18.48 exec(code, locals())
  163. 18.48 File "<string>", line 288, in <module>
  164. 18.48 File "/tmp/pip-build-env-a_iltcrr/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 107, in setup
  165. 18.48 return distutils.core.setup(**attrs)
  166. 18.48 File "/tmp/pip-build-env-a_iltcrr/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup
  167. 18.48 return run_commands(dist)
  168. 18.48 File "/tmp/pip-build-env-a_iltcrr/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
  169. 18.48 dist.run_commands()
  170. 18.48 File "/tmp/pip-build-env-a_iltcrr/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
  171. 18.48 self.run_command(cmd)
  172. 18.48 File "/tmp/pip-build-env-a_iltcrr/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1234, in run_command
  173. 18.48 super().run_command(command)
  174. 18.48 File "/tmp/pip-build-env-a_iltcrr/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
  175. 18.48 cmd_obj.run()
  176. 18.48 File "/tmp/pip-build-env-a_iltcrr/overlay/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 314, in run
  177. 18.48 self.find_sources()
  178. 18.48 File "/tmp/pip-build-env-a_iltcrr/overlay/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 322, in find_sources
  179. 18.48 mm.run()
  180. 18.48 File "/tmp/pip-build-env-a_iltcrr/overlay/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 551, in run
  181. 18.48 self.add_defaults()
  182. 18.48 File "/tmp/pip-build-env-a_iltcrr/overlay/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 589, in add_defaults
  183. 18.48 sdist.add_defaults(self)
  184. 18.48 File "/tmp/pip-build-env-a_iltcrr/overlay/lib/python3.9/site-packages/setuptools/command/sdist.py", line 104, in add_defaults
  185. 18.48 super().add_defaults()
  186. 18.48 File "/tmp/pip-build-env-a_iltcrr/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/sdist.py", line 251, in add_defaults
  187. 18.48 self._add_defaults_ext()
  188. 18.48 File "/tmp/pip-build-env-a_iltcrr/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/sdist.py", line 336, in _add_defaults_ext
  189. 18.48 self.filelist.extend(build_ext.get_source_files())
  190. 18.48 File "<string>", line 204, in get_source_files
  191. 18.48 File "/tmp/pip-build-env-a_iltcrr/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 107, in __getattr__
  192. 18.48 raise AttributeError(attr)
  193. 18.48 AttributeError: cython_sources
  194. 18.48 [end of output]
  195. 18.48
  196. 18.48 note: This error originates from a subprocess, and is likely not a problem with pip.
  197. 18.49 error: subprocess-exited-with-error
  198. 18.49
  199. 18.49 × Getting requirements to build wheel did not run successfully.
  200. 18.49 exit code: 1
  201. 18.49 ╰─> See above for output.
  202. 18.49
  203. 18.49 note: This error originates from a subprocess, and is likely not a problem with pip.

I build this exact image with these dependencies yesterday so I know it's compatible. Yet tried to build today and no longer works.

With the answer from Simeon Borisov, the problem seems to be drf-spectacular in my requirements folder, as removing this fixes the build.

However, I'm still struggling.

  1. Adding pyyaml==5.4.1 above it does not fix the problem.
  2. This is curious, as before these exact versions worked together, but now they do not. Furthermore, older versions I've seem compiled in tutorials in which I first learned docker, which I have used myself, also no longer work for me. What exactly changed?

After adding pyyaml dependency, my error log is as follows:

  1. Collecting Django<4.0,>=3.2.4 (from -r /tmp/requirements.txt (line 1))
  2. 23.17 Obtaining dependency information for Django<4.0,>=3.2.4 from https://files.pythonhosted.org/packages/84/eb/5329ae72bf26b91844985d0de74e4edf876e3ca409d085820f230eea2eba/Django-3.2.20-py3-none-any.whl.metadata
  3. 23.32 Downloading Django-3.2.20-py3-none-any.whl.metadata (4.1 kB)
  4. 23.37 Collecting djangorestframework<3.14.0,>=3.12.4 (from -r /tmp/requirements.txt (line 2))
  5. 23.39 Downloading djangorestframework-3.13.1-py3-none-any.whl (958 kB)
  6. 23.54 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 958.3/958.3 kB 6.8 MB/s eta 0:00:00
  7. 23.57 Collecting djangorestframework-simplejwt<5.3.0,>=4.8.0 (from -r /tmp/requirements.txt (line 3))
  8. 23.60 Downloading djangorestframework_simplejwt-5.2.2-py3-none-any.whl (85 kB)
  9. 23.61 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 85.4/85.4 kB 9.6 MB/s eta 0:00:00
  10. 23.68 Collecting psycopg2<2.9,>=2.8.6 (from -r /tmp/requirements.txt (line 4))
  11. 23.71 Downloading psycopg2-2.8.6.tar.gz (383 kB)
  12. 23.76 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 383.8/383.8 kB 7.9 MB/s eta 0:00:00
  13. 23.80 Installing build dependencies: started
  14. 25.10 Installing build dependencies: finished with status 'done'
  15. 25.10 Getting requirements to build wheel: started
  16. 25.23 Getting requirements to build wheel: finished with status 'done'
  17. 25.23 Preparing metadata (pyproject.toml): started
  18. 25.36 Preparing metadata (pyproject.toml): finished with status 'done'
  19. 25.46 Collecting pyyaml==5.4.1 (from -r /tmp/requirements.txt (line 5))
  20. 25.48 Downloading PyYAML-5.4.1.tar.gz (175 kB)
  21. 25.50 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 175.1/175.1 kB 7.7 MB/s eta 0:00:00
  22. 25.60 Installing build dependencies: started
  23. 27.95 Installing build dependencies: finished with status 'done'
  24. 27.95 Getting requirements to build wheel: started
  25. 28.12 Getting requirements to build wheel: finished with status 'error'
  26. 28.12 error: subprocess-exited-with-error
  27. 28.12
  28. 28.12 × Getting requirements to build wheel did not run successfully.
  29. 28.12 exit code: 1
  30. 28.12 ╰─> [62 lines of output]
  31. 28.12 /tmp/pip-build-env-m9dhhrb5/overlay/lib/python3.9/site-packages/setuptools/config/setupcfg.py:293: _DeprecatedConfig: Deprecated config in `setup.cfg`
  32. 28.12 !!
  33. 28.12
  34. 28.12 ********************************************************************************
  35. 28.12 The license_file parameter is deprecated, use license_files instead.
  36. 28.12
  37. 28.12 By 2023-Oct-30, you need to update your project and remove deprecated calls
  38. 28.12 or your builds will no longer be supported.
  39. 28.12
  40. 28.12 See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
  41. 28.12 ********************************************************************************
  42. 28.12
  43. 28.12 !!
  44. 28.12 parsed = self.parsers.get(option_name, lambda x: x)(value)
  45. 28.12 running egg_info
  46. 28.12 writing lib3/PyYAML.egg-info/PKG-INFO
  47. 28.12 writing dependency_links to lib3/PyYAML.egg-info/dependency_links.txt
  48. 28.12 writing top-level names to lib3/PyYAML.egg-info/top_level.txt
  49. 28.12 Traceback (most recent call last):
  50. 28.12 File "/py/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
  51. 28.12 main()
  52. 28.12 File "/py/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
  53. 28.12 json_out['return_val'] = hook(**hook_input['kwargs'])
  54. 28.12 File "/py/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
  55. 28.12 return hook(config_settings)
  56. 28.12 File "/tmp/pip-build-env-m9dhhrb5/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
  57. 28.12 return self._get_build_requires(config_settings, requirements=['wheel'])
  58. 28.12 File "/tmp/pip-build-env-m9dhhrb5/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
  59. 28.12 self.run_setup()
  60. 28.12 File "/tmp/pip-build-env-m9dhhrb5/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 338, in run_setup
  61. 28.12 exec(code, locals())
  62. 28.12 File "<string>", line 271, in <module>
  63. 28.12 File "/tmp/pip-build-env-m9dhhrb5/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 107, in setup
  64. 28.12 return distutils.core.setup(**attrs)
  65. 28.12 File "/tmp/pip-build-env-m9dhhrb5/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup
  66. 28.12 return run_commands(dist)
  67. 28.12 File "/tmp/pip-build-env-m9dhhrb5/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
  68. 28.12 dist.run_commands()
  69. 28.12 File "/tmp/pip-build-env-m9dhhrb5/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
  70. 28.12 self.run_command(cmd)
  71. 28.12 File "/tmp/pip-build-env-m9dhhrb5/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1234, in run_command
  72. 28.12 super().run_command(command)
  73. 28.12 File "/tmp/pip-build-env-m9dhhrb5/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
  74. 28.12 cmd_obj.run()
  75. 28.12 File "/tmp/pip-build-env-m9dhhrb5/overlay/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 314, in run
  76. 28.12 self.find_sources()
  77. 28.12 File "/tmp/pip-build-env-m9dhhrb5/overlay/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 322, in find_sources
  78. 28.12 mm.run()
  79. 28.12 File "/tmp/pip-build-env-m9dhhrb5/overlay/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 551, in run
  80. 28.12 self.add_defaults()
  81. 28.12 File "/tmp/pip-build-env-m9dhhrb5/overlay/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 589, in add_defaults
  82. 28.12 sdist.add_defaults(self)
  83. 28.12 File "/tmp/pip-build-env-m9dhhrb5/overlay/lib/python3.9/site-packages/setuptools/command/sdist.py", line 104, in add_defaults
  84. 28.12 super().add_defaults()
  85. 28.12 File "/tmp/pip-build-env-m9dhhrb5/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/sdist.py", line 251, in add_defaults
  86. 28.12 self._add_defaults_ext()
  87. 28.12 File "/tmp/pip-build-env-m9dhhrb5/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/sdist.py", line 336, in _add_defaults_ext
  88. 28.12 self.filelist.extend(build_ext.get_source_files())
  89. 28.12 File "<string>", line 201, in get_source_files
  90. 28.12 File "/tmp/pip-build-env-m9dhhrb5/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 107, in __getattr__
  91. 28.12 raise AttributeError(attr)
  92. 28.12 AttributeError: cython_sources
  93. 28.12 [end of output]
  94. 28.12
  95. 28.12 note: This error originates from a subprocess, and is likely not a problem with pip.
  96. 28.13 error: subprocess-exited-with-error
  97. 28.13
  98. 28.13 × Getting requirements to build wheel did not run successfully.
  99. 28.13 exit code: 1
  100. 28.13 ╰─> See above for output.

Solution

With the advice of Simeon I found the exact problem. The problem is not just with drf, but the pyyaml dependency. This was due to an update, and so the recent (as of the time of this post) 5.4.1 is itself broken. I believe it was an update to Cython which caused this. The GitHub issue can be found here.

The solution, as posted there, is to install pyyaml; and downgrade to 5.3.1 for the time being.

答案1

得分: 50

重要的安全声明: 我强烈不建议任何人将 PyYAML 降级到 5.3.1 版本,因为 5.4 之前的版本都存在一个已知的 CVE — CVE-2020-14343。


这个问题是由于 PyYAML<6.0.1Cython>=3.0 版本下编译时的不兼容性引起的,该版本于 2023 年 7 月 17 日发布

现在已经通过 PyYAML 的新版本,标记为 6.0.1 来修复了这个问题。

此版本带来了

没有代码更改;更新 PEP518 构建元数据以要求使用 Cython < 3.0,直到
重新编写了与 Cython 3.0 兼容的打包代码。

可以在 此项目公告 中阅读到。

所以,只要您的库没有严格固定在特定版本的 PyYAML 上,这似乎是您的要求文件中的情况,那么一切都会正常工作。


如果您的库受限于 PyYAML<6.0,修复的方法可以是使用 --no-build-isolation 标志安装该库:

  1. python -m pip install --no-build-isolation \
  2. <依赖于旧版本 PyYAML 的有问题库>
英文:

Important security disclaimer: I would strongly discourage anyone downgrading PyYAML to 5.3.1, as versions before 5.4 all have a known CVE — CVE-2020-14343.


This issue was caused by an incompatibility of PyYAML&lt;6.0.1 compiled under the version of Cython&gt;=3.0, released on July 17, 2023.

This has now been fixed by a new release of PyYAML, tagged 6.0.1.

This release brings

> No code changes; update PEP518 build metadata to require Cython < 3.0 until
packaging code is rewritten for Cython 3.0 compatibility.

<sup>As it can be read in this project announcements</sup>

So, as long as you don't have a strict pinning of PyYAML to a specific version, which seems to be your case in your requirements file, then, everything would be working properly again.


If your library is constrained to PyYAML&lt;6.0, a fix could be to install the said library with the flag --no-build-isolation:

  1. python -m pip install --no-build-isolation \
  2. &lt;problematic-library-depending-on-old-verion-of-PyYAML&gt;

答案2

得分: 8

更新到pyyaml==6.0.1有帮助。

英文:

Update to pyyaml==6.0.1 hepled me

答案3

得分: 5

根据这个线程,似乎是一种回归。PyYAML包可能是您的某个依赖项的依赖项,并且自动更新到一个有问题的版本(很可能是因为drf-spectacular)。您应该能够将pyyaml包添加到您的requirements.txt并指定其版本。也许您应该对drf-spectacular的版本进行更具体的指定,以防出现依赖性兼容性问题。

  1. pyyaml==5.4.1
  2. drf-spectacular=={昨天的版本是什么}

如果您希望将来避免这种情况,可以考虑使用pipenv及其Pipfile和Pipfile.lock版本控制系统,该系统可以让您控制构建中使用的版本。

编辑:我从其他帖子中看到问题已经解决,更新pyyaml到最新版本可能是个好主意。

英文:

It seems like a regression according to this thread. The PyYAML package is probably a dependency of one of your dependencies and autoupdated to a broken version (most likely because of drf-spectacular). You should be able to add the pyyaml package into your reuqirements.txt and specify the version of it. Perhaps you should also be more specific with the versioning of drf-spectacular, in case you get dependency compatibility issues.

  1. pyyaml==5.4.1
  2. drf-spectacular=={whatever the version was yesterday}

If you'd like to avoid this in the future, consider using pipenv and it's Pipfile and Pipfile.lock versioning system, which gives you control over which versions you use in your build.

Edit: I see from other threads the issue has been resolved and it's probably a good idea to update pyyaml to the latest version.

答案4

得分: 5

基本上,是Cython 3.0.0的新版本引起了这个问题。

在我的情况下,问题出现在awscli上。通过在安装awscli之前添加这一行,问题得以解决。

这种方法的好处还在于您不会回到容易受攻击的pyyaml 5.3.1版本。

  1. pip install "cython<3.0.0" wheel && pip install pyyaml==5.4.1 --no-build-isolation
  2. pip install awscli

编辑:对于awscli >= 1.29.4,您现在可以使用pyyaml 6.0.1来修复问题。

  1. pip install pyyaml~=6.0
  2. pip install awscli
英文:

Basically, it's the new release of cython 3.0.0 that create the issue.

In my case, the issue was with awscli. By adding this line before my awscli install, it fixed my issue.

The benefit of this method is also that you don't go back to a vulnerable pyyaml 5.3.1.

  1. pip install &quot;cython&lt;3.0.0&quot; wheel &amp;&amp; pip install pyyaml==5.4.1 --no-build-isolation
  2. pip install awscli

Edit: With awscli >= 1.29.4, you can now use pyyaml 6.0.1 and fix the issue.

  1. pip install pyyaml~=6.0
  2. pip install awscli

答案5

得分: 1

降级到 pyyaml==5.3.1 对我有用,因为我在我的项目中遇到了依赖冲突问题。

英文:

Downgrading to pyyaml==5.3.1 worked for me, couldn't upgrade to the latest version since I was facing dependencies conflicts in my project

答案6

得分: 0

将版本更改为 PyYAML~=6.0,以便获取最新的与6.0兼容的版本。

英文:

Change the version to PyYAML~=6.0 so we get the latest 6.0-compatible release.

答案7

得分: 0

我通过以下方式成功解决了这个问题:

  1. pip install "Cython<3"
  2. pip install pyyaml==5.4.1 --no-cache-dir --no-build-isolation
  3. pip install docker-compose

参考链接:https://github.com/MahmoudAshraf97/whisper-diarization/issues/73#issue-1838985378

英文:

I managed to fix the issue by doing the following:

  1. pip install &quot;Cython&lt;3&quot;
  2. pip install pyyaml==5.4.1 --no-cache-dir --no-build-isolation
  3. pip install docker-compose

Reference: https://github.com/MahmoudAshraf97/whisper-diarization/issues/73#issue-1838985378

huangapple
  • 本文由 发表于 2023年7月18日 05:57:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/76708329.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定