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

[Docker on Debian 11] Could not build wheels for psutil #2192

Open
wasabipesto opened this issue Jan 15, 2023 · 7 comments
Open

[Docker on Debian 11] Could not build wheels for psutil #2192

wasabipesto opened this issue Jan 15, 2023 · 7 comments

Comments

@wasabipesto
Copy link

Summary

  • OS: Debian GNU/Linux 11 (bullseye)
  • Docker Image OS: Alpine 3
  • Architecture: x86_64
  • Psutil version: 5.9.4
  • Python version: 3.10.9-r1
  • Type: Installation via pip in Dockerfile

Description

In this Dockerfile, I use the latest version of alpine 3, install python 3, and then attempt to install jupyter. The build fails when attempting to install psutil as a dependency.

justin@kalak:/opt/hephaestus/test$ cat Dockerfile 
FROM alpine:3
RUN apk add --update --no-cache python3 python3-dev
RUN python3 -m ensurepip
RUN pip3 install --no-cache-dir --upgrade pip
RUN pip3 install --no-cache-dir jupyterjustin@kalak:/opt/hephaestus/test$ 
justin@kalak:/opt/hephaestus/test$ cat Dockerfile 
FROM alpine:3
RUN apk add --update --no-cache python3 python3-dev
RUN python3 -m ensurepip
RUN pip3 install --no-cache-dir --upgrade pip
RUN pip3 install --no-cache-dir jupyter
justin@kalak:/opt/hephaestus/test$ docker build --no-cache .
Sending build context to Docker daemon  2.048kB
Step 1/5 : FROM alpine:3
 ---> 042a816809aa
Step 2/5 : RUN apk add --update --no-cache python3 python3-dev
 ---> Running in 627b1de47fcd
fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/community/x86_64/APKINDEX.tar.gz
(1/15) Installing libbz2 (1.0.8-r4)
(2/15) Installing libexpat (2.5.0-r0)
(3/15) Installing libffi (3.4.4-r0)
(4/15) Installing gdbm (1.23-r0)
(5/15) Installing xz-libs (5.2.9-r0)
(6/15) Installing libgcc (12.2.1_git20220924-r4)
(7/15) Installing libstdc++ (12.2.1_git20220924-r4)
(8/15) Installing mpdecimal (2.5.1-r1)
(9/15) Installing ncurses-terminfo-base (6.3_p20221119-r0)
(10/15) Installing ncurses-libs (6.3_p20221119-r0)
(11/15) Installing readline (8.2.0-r0)
(12/15) Installing sqlite-libs (3.40.1-r0)
(13/15) Installing python3 (3.10.9-r1)
(14/15) Installing pkgconf (1.9.3-r0)
(15/15) Installing python3-dev (3.10.9-r1)
Executing busybox-1.35.0-r29.trigger
OK: 107 MiB in 30 packages
Removing intermediate container 627b1de47fcd
 ---> 37c22c0d420a
Step 3/5 : RUN python3 -m ensurepip
 ---> Running in da41305318a8
Looking in links: /tmp/tmpi9dqhuph
Processing /tmp/tmpi9dqhuph/setuptools-65.5.0-py3-none-any.whl
Processing /tmp/tmpi9dqhuph/pip-22.3.1-py3-none-any.whl
Installing collected packages: setuptools, pip
Successfully installed pip-22.3.1 setuptools-65.5.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Removing intermediate container da41305318a8
 ---> 79a9aefa5266
Step 4/5 : RUN pip3 install --no-cache-dir --upgrade pip
 ---> Running in 4a284b1fda82
Requirement already satisfied: pip in /usr/lib/python3.10/site-packages (22.3.1)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Removing intermediate container 4a284b1fda82
 ---> 217dac38a4c1
Step 5/5 : RUN pip3 install --no-cache-dir jupyter
 ---> Running in a28cf131228e
Collecting jupyter
  Downloading jupyter-1.0.0-py2.py3-none-any.whl (2.7 kB)
Collecting notebook
  Downloading notebook-6.5.2-py3-none-any.whl (439 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 439.1/439.1 kB 4.9 MB/s eta 0:00:00
Collecting ipywidgets
  Downloading ipywidgets-8.0.4-py3-none-any.whl (137 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 137.8/137.8 kB 84.1 MB/s eta 0:00:00
Collecting nbconvert
  Downloading nbconvert-7.2.7-py3-none-any.whl (273 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 273.2/273.2 kB 49.5 MB/s eta 0:00:00
Collecting jupyter-console
  Downloading jupyter_console-6.4.4-py3-none-any.whl (22 kB)
Collecting ipykernel
  Downloading ipykernel-6.20.1-py3-none-any.whl (149 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 149.2/149.2 kB 81.3 MB/s eta 0:00:00
Collecting qtconsole
  Downloading qtconsole-5.4.0-py3-none-any.whl (121 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.0/121.0 kB 89.5 MB/s eta 0:00:00
Collecting psutil
  Downloading psutil-5.9.4.tar.gz (485 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 485.8/485.8 kB 52.0 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 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Collecting comm>=0.1.1
  Downloading comm-0.1.2-py3-none-any.whl (6.5 kB)
Collecting tornado>=6.1
  Downloading tornado-6.2-cp37-abi3-musllinux_1_1_x86_64.whl (426 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 426.5/426.5 kB 110.0 MB/s eta 0:00:00
Collecting ipython>=7.23.1
  Downloading ipython-8.8.0-py3-none-any.whl (775 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 775.8/775.8 kB 90.0 MB/s eta 0:00:00
Collecting pyzmq>=17
  Downloading pyzmq-25.0.0-cp310-cp310-musllinux_1_1_x86_64.whl (1.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 65.3 MB/s eta 0:00:00
Collecting nest-asyncio
  Downloading nest_asyncio-1.5.6-py3-none-any.whl (5.2 kB)
Collecting traitlets>=5.4.0
  Downloading traitlets-5.8.1-py3-none-any.whl (116 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 116.8/116.8 kB 217.6 MB/s eta 0:00:00
Collecting debugpy>=1.0
  Downloading debugpy-1.6.5-py2.py3-none-any.whl (4.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.9/4.9 MB 80.4 MB/s eta 0:00:00
Collecting packaging
  Downloading packaging-23.0-py3-none-any.whl (42 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 42.7/42.7 kB 194.6 MB/s eta 0:00:00
Collecting matplotlib-inline>=0.1
  Downloading matplotlib_inline-0.1.6-py3-none-any.whl (9.4 kB)
Collecting jupyter-client>=6.1.12
  Downloading jupyter_client-7.4.9-py3-none-any.whl (133 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.5/133.5 kB 142.0 MB/s eta 0:00:00
Collecting widgetsnbextension~=4.0
  Downloading widgetsnbextension-4.0.5-py3-none-any.whl (2.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.0/2.0 MB 107.2 MB/s eta 0:00:00
Collecting jupyterlab-widgets~=3.0
  Downloading jupyterlab_widgets-3.0.5-py3-none-any.whl (384 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 384.3/384.3 kB 109.6 MB/s eta 0:00:00
Collecting pygments
  Downloading Pygments-2.14.0-py3-none-any.whl (1.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 114.7 MB/s eta 0:00:00
Collecting prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0
  Downloading prompt_toolkit-3.0.36-py3-none-any.whl (386 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 386.4/386.4 kB 179.3 MB/s eta 0:00:00
Collecting jupyter-core>=4.7
  Downloading jupyter_core-5.1.3-py3-none-any.whl (93 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 93.5/93.5 kB 59.4 MB/s eta 0:00:00
Collecting nbclient>=0.5.0
  Downloading nbclient-0.7.2-py3-none-any.whl (71 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 72.0/72.0 kB 147.8 MB/s eta 0:00:00
Collecting tinycss2
  Downloading tinycss2-1.2.1-py3-none-any.whl (21 kB)
Collecting markupsafe>=2.0
  Downloading MarkupSafe-2.1.1-cp310-cp310-musllinux_1_1_x86_64.whl (29 kB)
Collecting mistune<3,>=2.0.3
  Downloading mistune-2.0.4-py2.py3-none-any.whl (24 kB)
Collecting nbformat>=5.1
  Downloading nbformat-5.7.3-py3-none-any.whl (78 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.1/78.1 kB 158.5 MB/s eta 0:00:00
Collecting defusedxml
  Downloading defusedxml-0.7.1-py2.py3-none-any.whl (25 kB)
Collecting jupyterlab-pygments
  Downloading jupyterlab_pygments-0.2.2-py2.py3-none-any.whl (21 kB)
Collecting pandocfilters>=1.4.1
  Downloading pandocfilters-1.5.0-py2.py3-none-any.whl (8.7 kB)
Collecting beautifulsoup4
  Downloading beautifulsoup4-4.11.1-py3-none-any.whl (128 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 128.2/128.2 kB 174.9 MB/s eta 0:00:00
Collecting bleach
  Downloading bleach-5.0.1-py3-none-any.whl (160 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 160.9/160.9 kB 141.9 MB/s eta 0:00:00
Collecting jinja2>=3.0
  Downloading Jinja2-3.1.2-py3-none-any.whl (133 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.1/133.1 kB 178.6 MB/s eta 0:00:00
Collecting Send2Trash>=1.8.0
  Downloading Send2Trash-1.8.0-py3-none-any.whl (18 kB)
Collecting ipython-genutils
  Downloading ipython_genutils-0.2.0-py2.py3-none-any.whl (26 kB)
Collecting nbclassic>=0.4.7
  Downloading nbclassic-0.4.8-py3-none-any.whl (9.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.8/9.8 MB 86.9 MB/s eta 0:00:00
Collecting argon2-cffi
  Downloading argon2_cffi-21.3.0-py3-none-any.whl (14 kB)
Collecting terminado>=0.8.3
  Downloading terminado-0.17.1-py3-none-any.whl (17 kB)
Collecting prometheus-client
  Downloading prometheus_client-0.15.0-py3-none-any.whl (60 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.1/60.1 kB 146.8 MB/s eta 0:00:00
Collecting qtpy>=2.0.1
  Downloading QtPy-2.3.0-py3-none-any.whl (83 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 83.6/83.6 kB 158.0 MB/s eta 0:00:00
Collecting pexpect>4.3
  Downloading pexpect-4.8.0-py2.py3-none-any.whl (59 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 59.0/59.0 kB 149.7 MB/s eta 0:00:00
Collecting backcall
  Downloading backcall-0.2.0-py2.py3-none-any.whl (11 kB)
Collecting decorator
  Downloading decorator-5.1.1-py3-none-any.whl (9.1 kB)
Collecting stack-data
  Downloading stack_data-0.6.2-py3-none-any.whl (24 kB)
Collecting pickleshare
  Downloading pickleshare-0.7.5-py2.py3-none-any.whl (6.9 kB)
Collecting jedi>=0.16
  Downloading jedi-0.18.2-py2.py3-none-any.whl (1.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 114.5 MB/s eta 0:00:00
Collecting python-dateutil>=2.8.2
  Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.7/247.7 kB 154.7 MB/s eta 0:00:00
Collecting entrypoints
  Downloading entrypoints-0.4-py3-none-any.whl (5.3 kB)
Collecting platformdirs>=2.5
  Downloading platformdirs-2.6.2-py3-none-any.whl (14 kB)
Collecting jupyter-server>=1.8
  Downloading jupyter_server-2.1.0-py3-none-any.whl (365 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 365.2/365.2 kB 128.0 MB/s eta 0:00:00
Collecting notebook-shim>=0.1.0
  Downloading notebook_shim-0.2.2-py3-none-any.whl (13 kB)
Collecting fastjsonschema
  Downloading fastjsonschema-2.16.2-py3-none-any.whl (22 kB)
Collecting jsonschema>=2.6
  Downloading jsonschema-4.17.3-py3-none-any.whl (90 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 90.4/90.4 kB 179.4 MB/s eta 0:00:00
Collecting wcwidth
  Downloading wcwidth-0.2.6.tar.gz (35 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting ptyprocess
  Downloading ptyprocess-0.7.0-py2.py3-none-any.whl (13 kB)
Collecting argon2-cffi-bindings
  Downloading argon2_cffi_bindings-21.2.0-cp36-abi3-musllinux_1_1_x86_64.whl (88 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.5/88.5 kB 173.7 MB/s eta 0:00:00
Collecting soupsieve>1.2
  Downloading soupsieve-2.3.2.post1-py3-none-any.whl (37 kB)
Collecting six>=1.9.0
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting webencodings
  Downloading webencodings-0.5.1-py2.py3-none-any.whl (11 kB)
Collecting parso<0.9.0,>=0.8.0
  Downloading parso-0.8.3-py2.py3-none-any.whl (100 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.8/100.8 kB 140.1 MB/s eta 0:00:00
Collecting pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0
  Downloading pyrsistent-0.19.3-py3-none-any.whl (57 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.5/57.5 kB 127.6 MB/s eta 0:00:00
Collecting attrs>=17.4.0
  Downloading attrs-22.2.0-py3-none-any.whl (60 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.0/60.0 kB 123.3 MB/s eta 0:00:00
Collecting jupyter-events>=0.4.0
  Downloading jupyter_events-0.6.3-py3-none-any.whl (18 kB)
Collecting jupyter-server-terminals
  Downloading jupyter_server_terminals-0.4.4-py3-none-any.whl (13 kB)
Collecting anyio<4,>=3.1.0
  Downloading anyio-3.6.2-py3-none-any.whl (80 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 80.6/80.6 kB 124.5 MB/s eta 0:00:00
Collecting websocket-client
  Downloading websocket_client-1.4.2-py3-none-any.whl (55 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 55.3/55.3 kB 123.6 MB/s eta 0:00:00
Collecting cffi>=1.0.1
  Downloading cffi-1.15.1-cp310-cp310-musllinux_1_1_x86_64.whl (464 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 464.1/464.1 kB 117.9 MB/s eta 0:00:00
Collecting pure-eval
  Downloading pure_eval-0.2.2-py3-none-any.whl (11 kB)
Collecting asttokens>=2.1.0
  Downloading asttokens-2.2.1-py2.py3-none-any.whl (26 kB)
Collecting executing>=1.2.0
  Downloading executing-1.2.0-py2.py3-none-any.whl (24 kB)
Collecting sniffio>=1.1
  Downloading sniffio-1.3.0-py3-none-any.whl (10 kB)
Collecting idna>=2.8
  Downloading idna-3.4-py3-none-any.whl (61 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.5/61.5 kB 128.4 MB/s eta 0:00:00
Collecting pycparser
  Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.7/118.7 kB 95.1 MB/s eta 0:00:00
Collecting python-json-logger>=2.0.4
  Downloading python_json_logger-2.0.4-py3-none-any.whl (7.8 kB)
Collecting rfc3339-validator
  Downloading rfc3339_validator-0.1.4-py2.py3-none-any.whl (3.5 kB)
Collecting pyyaml>=5.3
  Downloading PyYAML-6.0.tar.gz (124 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 125.0/125.0 kB 122.7 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 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Collecting rfc3986-validator>=0.1.1
  Downloading rfc3986_validator-0.1.1-py2.py3-none-any.whl (4.2 kB)
Collecting isoduration
  Downloading isoduration-20.11.0-py3-none-any.whl (11 kB)
Collecting fqdn
  Downloading fqdn-1.5.1-py3-none-any.whl (9.1 kB)
Collecting jsonpointer>1.13
  Downloading jsonpointer-2.3-py2.py3-none-any.whl (7.8 kB)
Collecting uri-template
  Downloading uri_template-1.2.0-py3-none-any.whl (10 kB)
Collecting webcolors>=1.11
  Downloading webcolors-1.12-py3-none-any.whl (9.9 kB)
Collecting arrow>=0.15.0
  Downloading arrow-1.2.3-py3-none-any.whl (66 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.4/66.4 kB 59.5 MB/s eta 0:00:00
Building wheels for collected packages: psutil, pyyaml
  Building wheel for psutil (pyproject.toml): started
  Building wheel for psutil (pyproject.toml): finished with status 'error'
  error: subprocess-exited-with-error
  
  × Building wheel for psutil (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [41 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-310
      creating build/lib.linux-x86_64-cpython-310/psutil
      copying psutil/_pslinux.py -> build/lib.linux-x86_64-cpython-310/psutil
      copying psutil/_psosx.py -> build/lib.linux-x86_64-cpython-310/psutil
      copying psutil/_pswindows.py -> build/lib.linux-x86_64-cpython-310/psutil
      copying psutil/_compat.py -> build/lib.linux-x86_64-cpython-310/psutil
      copying psutil/_pssunos.py -> build/lib.linux-x86_64-cpython-310/psutil
      copying psutil/_psbsd.py -> build/lib.linux-x86_64-cpython-310/psutil
      copying psutil/__init__.py -> build/lib.linux-x86_64-cpython-310/psutil
      copying psutil/_psposix.py -> build/lib.linux-x86_64-cpython-310/psutil
      copying psutil/_common.py -> build/lib.linux-x86_64-cpython-310/psutil
      copying psutil/_psaix.py -> build/lib.linux-x86_64-cpython-310/psutil
      creating build/lib.linux-x86_64-cpython-310/psutil/tests
      copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-cpython-310/psutil/tests
      copying psutil/tests/test_system.py -> build/lib.linux-x86_64-cpython-310/psutil/tests
      copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-cpython-310/psutil/tests
      copying psutil/tests/__main__.py -> build/lib.linux-x86_64-cpython-310/psutil/tests
      copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-cpython-310/psutil/tests
      copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-cpython-310/psutil/tests
      copying psutil/tests/test_memleaks.py -> build/lib.linux-x86_64-cpython-310/psutil/tests
      copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-cpython-310/psutil/tests
      copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-cpython-310/psutil/tests
      copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-cpython-310/psutil/tests
      copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-cpython-310/psutil/tests
      copying psutil/tests/runner.py -> build/lib.linux-x86_64-cpython-310/psutil/tests
      copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-cpython-310/psutil/tests
      copying psutil/tests/__init__.py -> build/lib.linux-x86_64-cpython-310/psutil/tests
      copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-cpython-310/psutil/tests
      copying psutil/tests/test_testutils.py -> build/lib.linux-x86_64-cpython-310/psutil/tests
      copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-cpython-310/psutil/tests
      copying psutil/tests/test_process.py -> build/lib.linux-x86_64-cpython-310/psutil/tests
      running build_ext
      building 'psutil._psutil_linux' extension
      creating build/temp.linux-x86_64-cpython-310
      creating build/temp.linux-x86_64-cpython-310/psutil
      gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -fomit-frame-pointer -g -O2 -Os -fomit-frame-pointer -g -O2 -Os -fomit-frame-pointer -g -O2 -DTHREAD_STACK_SIZE=0x100000 -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=594 -DPy_LIMITED_API=0x03060000 -DPSUTIL_LINUX=1 -DPSUTIL_ETHTOOL_MISSING_TYPES=1 -I/usr/include/python3.10 -c psutil/_psutil_common.c -o build/temp.linux-x86_64-cpython-310/psutil/_psutil_common.o
      error: command 'gcc' failed: No such file or directory
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for psutil
  Building wheel for pyyaml (pyproject.toml): started
  Building wheel for pyyaml (pyproject.toml): finished with status 'done'
  Created wheel for pyyaml: filename=PyYAML-6.0-cp310-cp310-linux_x86_64.whl size=45330 sha256=530d140ff46eb0876732f00e31cb6c5fa8e121965881c9f0f33bc3e5471ddae5
  Stored in directory: /tmp/pip-ephem-wheel-cache-__y6ht9z/wheels/06/72/f6/3f89f64cf1943a82e42cdd8e59d7b2aa98769fd48b08019fc7
Successfully built pyyaml
Failed to build psutil
ERROR: Could not build wheels for psutil, which is required to install pyproject.toml-based projects
The command '/bin/sh -c pip3 install --no-cache-dir jupyter' returned a non-zero code: 1

Related Issues

I searched for related issues and found the following:

@ben9923
Copy link
Contributor

ben9923 commented Jan 18, 2023

Wheels for musllinux (which Alpine is using, unlike the commonly used glibc [== manylinux]) are not available for psutil, see #2126.
As they are not yet available, you'll need to have all necessary build tools/libraries to install it, rather than a minimal Python installation.

You can see the changes in mentioned PR also include whatever you need to install for a successful build on Alpine:

apk add gcc musl-dev linux-headers python3-dev

IIRC @giampaolo once mentioned he's still not sure whether he'd like to provide musllinux wheels, so until then you'll need to install the system packages mentioned above.

Another option would be using a glibc-based base image, like python:slim.
BTW, for Alpine, consider the python:alpine base image over manually installing python3 on top of the base alpine image.

@basebandit
Copy link

Am just confirming here that installing the following gcc musl-dev linux-headers python3-dev as instructed above worked for me. Thank you @ben9923

@MrMino
Copy link

MrMino commented Aug 2, 2023

IIRC @giampaolo once mentioned he's still not sure whether he'd like to provide musllinux wheels, so until then you'll need to install the system packages mentioned above.

Would be nice to hear from @giampaolo the rationale behind this. For all modern versions of pip the wheel will be built anyway during installation, so unless psutil is planning to explicitly drop support for Musl-based distributions, there is no reason not to put the said wheel on PyPI.

It saves electricity 🥬 😉.

@guidopetri
Copy link

@giampaolo I'm running into this issue as well with Python 3.11, Debian 12, psutil 5.9.6.

@baggiponte
Copy link

Me too, same issue with python:3.10-slim.

sgoggins added a commit to chaoss/augur that referenced this issue Jan 26, 2024
Resolving ps_utils error: 

```
giampaolo/psutil#2192
```

Signed-off-by: Sean P. Goggins <outdoors@acm.org>
sgoggins added a commit to chaoss/augur that referenced this issue Jan 26, 2024
Fixing PS_UTIL issue on python3.10

gcc musl-dev linux-headers python3-dev

giampaolo/psutil#2192

Signed-off-by: Sean P. Goggins <outdoors@acm.org>
@NFeruch
Copy link

NFeruch commented Feb 11, 2024

Can confirm that going from python:3.10-alpine to python:3.10-slim allowed me to install psutil in docker

@ghost
Copy link

ghost commented Apr 29, 2024

Not only alpine, but python:3.12-slim also gave me the error mentioned in the post and for cffi too

adding these lines solved the issue
RUN apk add gcc musl-dev linux-headers python3-dev
RUN apk add libffi-dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants