Prepare to move to Python 3.9 venv, build fails ciso8601

So I am preparing to move HA to Python 3.9, setting up a new venv to build everything in.
I’m running Ubuntu Focal, 20.04.

This has never been an issue before but now I’m failing on creating wheel for ciso8601, complete error code:

Building wheels for collected packages: ciso8601
  Building wheel for ciso8601 (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: /srv/homeassistant/bin/python3 /srv/homeassistant/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmp39k1t1uf
       cwd: /tmp/pip-install-kb1ribjl/ciso8601_05bed17d32934649aecf1ba629960f71
  Complete output (17 lines):
  running bdist_wheel
  running build
  running build_py
  package init file 'ciso8601/__init__.py' not found (or not a regular file)
  creating build
  creating build/lib.linux-x86_64-3.9
  creating build/lib.linux-x86_64-3.9/ciso8601
  copying ciso8601/__init__.pyi -> build/lib.linux-x86_64-3.9/ciso8601
  copying ciso8601/py.typed -> build/lib.linux-x86_64-3.9/ciso8601
  running build_ext
  creating build/temp.linux-x86_64-3.9
  x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DCISO8601_VERSION=2.2.0 -DCISO8601_CACHING_ENABLED=1 -I/srv/homeassistant/include -I/usr/include/python3.9 -c module.c -o build/temp.linux-x86_64-3.9/module.o
  module.c:1:10: fatal error: Python.h: No such file or directory
      1 | #include <Python.h>
        |          ^~~~~~~~~~
  compilation terminated.
  error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for ciso8601
Failed to build ciso8601
ERROR: Could not build wheels for ciso8601, which is required to install pyproject.toml-based projects

I’m not sure what I can do as it seems to be a problem with the build/init files?

During this process i f*cked up my 3.8 venv aswell so I’m having issues with my production build aswell, not superbreaking but some components wont run and I cannot check config and restart HA from “Server controls”. But thats something for another thread.

Any pointers to my main 3.9 issue?

2 Likes

Jesus christ. This so basic I’m mad.

Thanks!

(missing dev packages)

I too stumbled upon the same issue. In my case this solved the issue -

apt install python3.9

apt install python3.9-dev

apt install python3.9-venv

3 Likes
sudo pip3 install ciso8601 --no-binary :all:

make sure you have install build essential

sudo apt install build-essential