Development setup in Windows (WSL)

Hey All,

In the past, I have managed to get things working (Python3.6). Now that we need to use >3.6 things have gone off the rails.

I have followed the dev guide: https://developers.home-assistant.io/docs/en/development_environment.html#developing-on-windows

That doesn’t quite work for me.

I have installed python3.8 by doing the following:

cd /mnt/c/Projects.GitHub/home-assistant
sudo apt update
sudo apt upgrade
sudo apt install python3 python3-venv python3-dev python3-distutils -y
sudo apt install python3.8 python3.8-venv python3.8-dev python3.8-distutils -y
python3.8 -m venv venv
source venv/bin/activate

This has worked, no trouble so far. (It took me a LONG LONG time to get the venv working. I had a lot of trouble with the system python version, until I realised I can do python3.8 -m venv venv and don’t need to do python3 -m venv venv).

Next, when I run

script/setup

I’m greeted by a lovely message about Failed building wheel for nodeend, and also a Failed building wheel for pyyaml (Ignore the Op cancelled, I stopped the install at that point).

Building wheels for collected packages: nodeenv, pyyaml
  Running setup.py bdist_wheel for nodeenv ... error
  Complete output from command /mnt/c/Projects.GitHub/home-assistant-KiLLeRRaT2/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yh2lq2dc/nodeenv/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpag3mbiyapip-wheel- --python-tag cp37:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for nodeenv
  Running setup.py clean for nodeenv
  Running setup.py bdist_wheel for pyyaml ... error
  Complete output from command /mnt/c/Projects.GitHub/home-assistant-KiLLeRRaT2/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yh2lq2dc/pyyaml/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpt1_mx6azpip-wheel- --python-tag cp37:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for pyyaml
  Running setup.py clean for pyyaml
Failed to build nodeenv pyyaml
Installing collected packages: filelock, more-itertools, zipp, importlib-metadata, virtualenv, pyparsing, six, packaging, toml, pluggy, py, tox, colorlog, pyyaml, aspy.yaml, identify, nodeenv, cfgv, pre-commit, typed-ast, mypy-extensions, typing-extensions, mypy
^COperation cancelled by user

I read somewhere that I can try to manually install using pip3.

I did that

pip3 install nodeenv --no-cache-dir

That failed with Security/Operation not allowed.

I then ran that using sudo:

sudo pip3 install nodeenv --no-cache-dir

That installed fine.

I then tried to do the same for pyyaml. That did not work, not even as sudo.

Any ideas guys?

I have deleted the Ubuntu app, tried it using 18.04, tried it with 16.04, no go.

This is so annoying because the feature I want to add is already done, I just cant get the damn environment working…

I haven’t tried dev containers again. I tried those a couple of months ago and couldn’t get that working either.

My last resort is setting up a Hyper-V machine with Ubuntu 18.04 and trying to set up a dev env in there (argghh).

Any help or pointers would be appreciated!

Cheers,

Don’t cancel the installation. Let it run through and things will work out. I get the same messages for a fresh 3.6 install.

EDIT: Just tested it with 3.8 and the commands you used. Let it run through and ignore the errors. Then everything will work out in the end.

Hmm I could have sworn that it errorer again further on preventing me to run HASS.

I have just done it cleanly using python3.8, and it run all the way through without a ‘blocking error’. I could also successfully start it.

Jeez, I’m not sure how I managed to spent so much time trying to get it going, only to actually get it going quite easily in the end…

Thanks for checking it out!

So my question is, what are the implications of those errors going to be? (EDIT: Looks like it fails to load a few components when starting hass, because those errors dissapeared after doing what I mention below).

I have further checked this out, and if you do a pip3 install wheel right after activating the venv, everything works without errors:

python3.8 -m venv venv
source venv/bin/activate
pip3 install wheel
script/setup

Should we look at updating the documentation on https://developers.home-assistant.io/docs/en/development_environment.html#developing-on-windows to include this?

OR is it just me for some reason running into this?

Cheers,