Setting up local dev env - "no such option --config-settings"

I am trying to follow the instructions for setting up a development environment (on Linux, Ubuntu 22.04), and I am encountering multiple issues:

  1. When setting up the core dependencies, the package libavresample-dev does not exist. Based on comments in other threads, I replaced it with libswresample-dev - but I was unable to confirm that this is the correct solution.
  2. When running script/setup, the script exits with an error:
Requirement already satisfied: h11<0.15,>=0.13 in ./venv/lib/python3.10/site-packages (from httpcore<0.19.0,>=0.18.0->httpx>=0.21.0->respx==0.20.2->-r requirements_test.txt (line 33)) (0.14.0)
pre-commit installed at .git/hooks/pre-commit

Usage:   
  /home/bogd/hass-core/venv/bin/python3 -m pip install [options] <requirement specifier> [package-index-options] ...
  /home/bogd/hass-core/venv/bin/python3 -m pip install [options] -r <requirements file> [package-index-options] ...
  /home/bogd/hass-core/venv/bin/python3 -m pip install [options] [-e] <vcs project url> ...
  /home/bogd/hass-core/venv/bin/python3 -m pip install [options] [-e] <local project path> ...
  /home/bogd/hass-core/venv/bin/python3 -m pip install [options] <archive url/path> ...

no such option: --config-settings

As far as I can tell, this is caused by line 27 of the script:

python3 -m pip install -e . --config-settings editable_mode=compat --constraint homeassistant/package_constraints.txt
  1. When trying to set up the integration scaffold, the script.scaffold module exits with:
(venv) bogd@dev-hass:~/hass-core$ python3 -m script.scaffold integration
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/bogd/hass-core/script/scaffold/__main__.py", line 7, in <module>
    from . import docs, error, gather_info, generate
  File "/home/bogd/hass-core/script/scaffold/gather_info.py", line 4, in <module>
    from homeassistant.util import slugify
  File "/home/bogd/hass-core/homeassistant/util/__init__.py", line 16, in <module>
    from .dt import as_local, utcnow
  File "/home/bogd/hass-core/homeassistant/util/dt.py", line 17, in <module>
    UTC = dt.UTC
AttributeError: module 'datetime' has no attribute 'UTC'
  1. (possibly as a result of 2?) - there is no hass command in my venv:
(venv) bogd@dev-hass:~/hass-core$ hass
Command 'hass' not found, did you mean:
  command 'cass' from snap cass (0.17.2)
  command 'sass' from deb ruby-sass (3.7.4-5)
  command 'pass' from deb pass (1.7.4-5)
  command 'ass' from deb irpas (0.10-9)
See 'snap info <snapname>' for additional versions.

This is on a fresh install of Ubuntu 22.04, with Python 3.10.12 .

Can anyone point me in the right direction?

Thank you!

After looking more carefully through the docs, I found this easily-overlooked line: Make sure your Python version is 3.11

And, unfortunately, the default Python version on Ubuntu is 3.10 (also, it is the latest one available in the official APT repos).

sudo add-apt-repository -y ppa:deadsnakes/ppa
sudo apt update
sudo apt install -y python3.12 python3.12-venv python3.12-dev
sudo rm /usr/bin/python3
sudo ln -s /usr/bin/python3.12 /usr/bin/python3

I also had to install some additional prerequisites (used during building the wheels):

sudo apt install -y cmake

With this change, script/setup runs successfully to the end, and I do have a hass command in the venv.

The script.scaffold module starts, but crashes with another error, due to another missing requirement (numpy).

# From within the venv
pip3 install numpy

And with this, the scaffold runs successfully, fixing (almost) all the problems I mentioned. There is still the problem of libavresample-dev, but hopefully the replacement suggested by others will work.

I will leave this thread here, in case others are running into the same issue.

6 Likes

@bogd I cannot thank you enough for posting your findings. This saved me hours of work!

With the testing I did, I ultimately found it easier to use python3.11 instead. Here are the issues I encountered with 3.12. Note the second item below mentions ’ If you can downgrade to Python 3.11 then you will probably not face any issue.’


issue:

python3.12
# pip install <some package>
[ ... ]
ModuleNotFoundError: No module named 'distutils.util'

solution:

python - ModuleNotFoundError: No module named 'distutils.util' - Ask Ubuntu


issue:

python3.12
# pip list
[ ... ]
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?

solution:

python - AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'? - Stack Overflow

Thank you @bogd - I had the same issue on current Linux Mint!

1 Like

Glad to help! Even though my foray into HAss development didn’t really work (writing a full fledged integration is definitely above my dev skill level :slight_smile: ), I am glad to hear my findings helped others!

1 Like

I had the same issue. In addition to installing python3.11, I also had to update pip - my installed version was 22, which did not have the --config-settings flag.
pip install pip --upgrade did the trick.

1 Like