Struggling with Tox

I have a custom component working and mostly linted to the strict standards required. I can’t get Tox to run to save my life though. I initially thought this might be something weird about the way my venv was setup on my mac but after rebuilding my dev environment in Ubuntu I’m encountering the same.

When running Tox I am recieving:
ERROR: invocation failed (exit code 1), logfile: /home/ubuntu/home-assistant/.tox/py36/log/py36-1.log
ERROR: actionid: py36
msg: getenv
cmdargs: [’/usr/bin/env’, ‘LANG=C.UTF-8’, ‘pip’, ‘install’, ‘-r/home/ubuntu/home-assistant/requirements_test_all.txt’, ‘-c/home/ubuntu/home-assistant/homeassistant/package_constraints.txt’]

followed by a list of every requirement its trying to install…

then:

ERROR: py36: could not install deps [-r/home/ubuntu/home-assistant/requirements_test_all.txt, -c/home/ubuntu/home-assistant/homeassistant/package_constraints.txt]; v = InvocationError(’/usr/bin/env LANG=C.UTF-8 pip install -r/home/ubuntu/home-assistant/requirements_test_all.txt -c/home/ubuntu/home-assistant/homeassistant/package_constraints.txt (see /home/ubuntu/home-assistant/.tox/py36/log/py36-1.log)’, 1)

Any ideas? I’ve been stuck on this all afternoon.

2 Likes

Did you ever figure this out? I’m getting the same error.

Did you properly follow the development docs to setup the dev-environment? The script/setup command has to be issued to manually, which installs some required dependencies.

I am finding similar problems with tox (under OSX). I have followed the instructions in the development docs above (for OSX), from here onwards and am able to successfully make hass run.

On then following the development testing instructions and running tox, python3.5 and python3.6 are skipped as expected, before erroring during the setup for python3.7.

The first errors output are as follows:

Building wheels for collected packages: DTLSSocket
  Running setup.py bdist_wheel for DTLSSocket: started
  Running setup.py bdist_wheel for DTLSSocket: finished with status 'error'
  Complete output from command /Users/neilcrosby/Documents/git-projects.nosync/home-assistant/.tox/py37/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/ff/cznjkq5j3pv2brvw2nwt9y_40000gn/T/pip-install-jgs_bmt6/DTLSSocket/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 /private/var/folders/ff/cznjkq5j3pv2brvw2nwt9y_40000gn/T/pip-wheel-7sl8lsey --python-tag cp37:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.13-x86_64-3.7
  creating build/lib.macosx-10.13-x86_64-3.7/DTLSSocket
  copying DTLSSocket/__init__.py -> build/lib.macosx-10.13-x86_64-3.7/DTLSSocket
  copying DTLSSocket/DTLSSocket.py -> build/lib.macosx-10.13-x86_64-3.7/DTLSSocket
  running build_ext
  Running: autoconf
  error: [Errno 2] No such file or directory: 'autoconf': 'autoconf'
  
  ----------------------------------------
  Failed building wheel for DTLSSocket
  Running setup.py clean for DTLSSocket
Failed to build DTLSSocket
1 Like

I’ve just nuked my dev environment and started again, ensuring that I followed the instructions to the letter. I got the same errors.

On this occasion I did not upgrade pip after running script/setup, as the docs did not state to do this. So I have run tox with pip at versions 10.0.1 and 18 with the same results.

I’ve managed to get the tests running by manually installing autoconf in OSX with the command brew install autoconf.

2 Likes

Hello !

I am experiencing the same error, can’t test my code locally because of tox isn’t working.

I am on macOS 10.14.6 Mojave (almost fresh install).

I’ve run tox in the venv and having python (3.7.4_1) in my host machine.

Previously launched :

  • brew install python3 autoconf
  • brew install ffmpeg
  • script/setup
  • pip3 install -r requirements_test_all.txt -c homeassistant/package_constraints.txt
  • pip install tox-venv

final logs :

    running build_ext
    running config
    pkg-config is required for building PyAV
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/pollet/dev/home-assistant/.tox/pylint/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/9g/3vtyd8sd2wl0rw5p7dj9sgs00000gn/T/pip-install-t88xt8mr/av/setup.py'"'"'; __file__='"'"'/private/var/folders/9g/3vtyd8sd2wl0rw5p7dj9sgs00000gn/T/pip-install-t88xt8mr/av/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/9g/3vtyd8sd2wl0rw5p7dj9sgs00000gn/T/pip-record-kdd_la1c/install-record.txt --single-version-externally-managed --compile --install-headers /Users/pollet/dev/home-assistant/.tox/pylint/bin/../include/site/python3.7/av Check the logs for full command output.
WARNING: You are using pip version 19.2.2, however version 19.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

========================================================================================== log end ===========================================================================================
ERROR: could not install deps [-r/Users/pollet/dev/home-assistant/requirements_all.txt, -r/Users/pollet/dev/home-assistant/requirements_test.txt, -c/Users/pollet/dev/home-assistant/homeassistant/package_constraints.txt]; v = InvocationError('/Users/pollet/dev/home-assistant/.tox/pylint/bin/python -m pip install -r/Users/pollet/dev/home-assistant/requirements_all.txt -r/Users/pollet/dev/home-assistant/requirements_test.txt -c/Users/pollet/dev/home-assistant/homeassistant/package_constraints.txt', 1)
typing inst-nodeps: /Users/pollet/dev/home-assistant/.tox/.tmp/package/1/homeassistant-0.101.0.dev0.zip
typing installed: abodepy==0.16.5,acme==0.38.0,adb-homeassistant==1.3.2,adb-shell==0.0.7,adguardhome==0.2.1,aio-geojson-client==0.10,aio-geojson-geonetnz-quakes==0.10,aioambient==0.3.2,aioasuswrt==1.1.21,aioautomatic==0.6.5,aiobotocore==0.10.2,aiocache==0.11.1,aioesphomeapi==2.2.0,aiofreepybox==0.0.8,aiohttp==3.6.2,aiohttp-cors==0.7.0,aiohue==1.9.2,aionotion==1.1.0,aionursery==0.3.0,aioswitcher==2019.4.26,aiounifi==11,aiowwlln==2.0.2,airly==0.0.2,Ambiclimate==0.2.1,androidtv==0.0.32,apns2==0.3.0,appdirs==1.4.3,apprise==0.8.1,aprslib==0.6.46,arcam-fmj==0.4.3,asn1crypto==0.24.0,aspy.yaml==1.3.0,astral==1.10.1,astroid==2.3.1,async-generator==1.10,async-timeout==3.0.1,async-upnp-client==0.14.11,asyncio==3.4.3,asyncssh==1.15.0,asynctest==0.13.0,atomicwrites==1.3.0,attrs==19.2.0,bcrypt==3.1.7,beautifulsoup4==4.8.0,bitstring==3.1.6,black==19.3b0,boto3==1.9.220,botocore==1.12.91,certifi==2019.9.11,cffi==1.12.3,cfgv==2.0.1,chardet==3.0.4,click==6.7,codecov==2.0.15,colorlog==4.0.2,coverage==4.5.4,cryptography==2.7,curve25519-donna==1.3,Cython==0.29.13,defusedxml==0.6.0,distro==1.4.0,docutils==0.15.2,DTLSSocket==0.1.10,ecdsa==0.13.2,ed25519==1.5,entrypoints==0.3,envs==1.3,fake-useragent==0.1.11,filelock==3.0.12,flake8==3.7.8,flake8-docstrings==1.5.0,flake8-polyfill==1.0.2,future==0.17.1,geojson==2.5.0,h2==2.6.2,HAP-python==2.6.0,hass-nabucasa==0.22,haversine==2.1.2,home-assistant-frontend==20191014.0,-e git+https://github.com/Quentame/home-assistant.git@016e0bc17fbfa3de2c9ca1a4f1ae2bdbed066e59#egg=homeassistant,hpack==3.0.0,hyper==0.7.0,hyperframe==3.2.0,identify==1.4.7,idna==2.8,ifaddr==0.1.6,importlib-metadata==0.23,isort==4.3.21,Jinja2==2.10.1,jmespath==0.9.4,josepy==1.2.0,keyring==8.7,keyrings.alt==1.3,lazy-object-proxy==1.4.2,libusb1==1.7.1,lomond==0.3.3,lxml==4.4.1,Markdown==3.1.1,MarkupSafe==1.1.1,mccabe==0.6.1,meteofrance==0.3.7,mock==3.0.5,mock-open==1.3.1,more-itertools==7.2.0,msgpack==0.6.1,multidict==4.5.2,mypy==0.730,mypy-extensions==0.4.1,netdisco==2.6.0,nodeenv==1.3.3,oauthlib==3.1.0,packaging==19.1,PlexAPI==3.0.6,pluggy==0.12.0,pre-commit==1.18.3,protobuf==3.6.1,pure-python-adb-homeassistant==0.1.7.dev0,py==1.8.0,pyasn1==0.4.7,pycodestyle==2.5.0,pycparser==2.19,pycryptodome==3.9.0,pydocstyle==4.0.1,pyflakes==2.1.1,pyicloud==0.9.1,PyJWT==1.7.1,pylinky==0.4.0,pylint==2.4.2,PyNaCl==1.3.0,pyOpenSSL==19.0.0,pyotp==2.3.0,pyparsing==2.4.2,PyQRCode==1.2.1,pyRFC3339==1.1,PyRMVtransport==0.2.9,pytest==5.2.1,pytest-aiohttp==0.3.0,pytest-cov==2.8.1,pytest-sugar==0.9.2,pytest-timeout==1.3.3,python-dateutil==2.8.0,python-didl-lite==1.2.4,python-engineio==3.9.3,python-jose-cryptodome==1.3.2,python-slugify==3.0.6,python-socketio==4.3.1,PyTransportNSW==0.1.1,pytz==2019.3,PyYAML==5.1.2,requests==2.22.0,requests-mock==1.7.0,requests-oauthlib==1.2.0,requests-toolbelt==0.9.1,rsa==4.0,RtmAPI==0.7.2,ruamel.yaml==0.15.100,s3transfer==0.2.1,simplejson==3.16.0,six==1.12.0,snitun==0.20,snowballstemmer==1.9.0,soupsieve==1.9.3,SQLAlchemy==1.3.10,termcolor==1.1.0,text-unidecode==1.3,tlslite-ng==0.7.5,toml==0.10.0,tox==3.13.2,tqdm==4.35.0,typed-ast==1.4.0,typing-extensions==3.7.4,tzlocal==2.0.0,ujson==1.35,urllib3==1.24.1,vigilancemeteo==3.0.0,virtualenv==16.7.4,voluptuous==0.11.7,voluptuous-serialize==2.3.0,warrant==0.6.1,wcwidth==0.1.7,websocket-client==0.56.0,websockets==8.0.2,wrapt==1.11.2,yarl==1.3.0,YesssSMS==0.4.1,zeroconf==0.23.0,zipp==0.6.0
typing run-test-pre: PYTHONHASHSEED='309419675'
typing run-test: commands[0] | mypy homeassistant
homeassistant/helpers/deprecation.py:64: error: Statement is unreachable
homeassistant/util/logging.py:140: error: Statement is unreachable
homeassistant/util/logging.py:196: error: Statement is unreachable
homeassistant/util/async_.py:17: error: unused 'type: ignore' comment
homeassistant/util/location.py:162: error: Redundant cast to "float"
homeassistant/components/http/static.py:45: error: Argument "headers" to "FileResponse" has incompatible type "Dict[istr, str]"; expected "Union[Mapping[Union[str, istr], str], CIMultiDict[str], CIMultiDictProxy[str], None]"
homeassistant/components/http/static.py:49: error: unused 'type: ignore' comment
homeassistant/core.py:144: error: Argument 3 to "error" of "Logger" has incompatible type "**Dict[str, Tuple[Type[Any], Any, Any]]"; expected "bool"
homeassistant/core.py:144: error: Argument 3 to "error" of "Logger" has incompatible type "**Dict[str, Tuple[Type[Any], Any, Any]]"; expected "Optional[Dict[str, Any]]"
homeassistant/core.py:145: error: unused 'type: ignore' comment
homeassistant/helpers/config_validation.py:607: error: Statement is unreachable
homeassistant/components/websocket_api/http.py:118: error: unused 'type: ignore' comment
homeassistant/util/ruamel_yaml.py:93: error: Incompatible types in assignment (expression has type "bool", variable has type "None")
homeassistant/auth/mfa_modules/totp.py:218: error: Argument 1 to "async_add_executor_job" of "HomeAssistant" has incompatible type "Callable[[str], Tuple[str, str, str]]"; expected "Callable[..., Tuple[Optional[str], None, None]]"
homeassistant/auth/mfa_modules/totp.py:219: error: unused 'type: ignore' comment
homeassistant/auth/mfa_modules/notify.py:254: error: Argument 2 to "async_notify" of "NotifyAuthModule" has incompatible type "Optional[str]"; expected "str"
homeassistant/auth/mfa_modules/notify.py:256: error: unused 'type: ignore' comment
ERROR: InvocationError for command /Users/pollet/dev/home-assistant/.tox/typing/bin/mypy homeassistant (exited with code 1)
cov create: /Users/pollet/dev/home-assistant/.tox/cov
ERROR: invocation failed (exit code 2), logfile: /Users/pollet/dev/home-assistant/.tox/cov/log/cov-0.log
========================================================================================= log start ==========================================================================================

========================================================================================== log end ===========================================================================================
ERROR: InvocationError for command /Users/pollet/dev/home-assistant/venv/bin/python3 -m virtualenv --no-download --python /Users/pollet/dev/home-assistant/venv/bin/python3 cov (exited with code 2)
__________________________________________________________________________________________ summary ___________________________________________________________________________________________
ERROR:   py36: could not install deps [-r/Users/pollet/dev/home-assistant/requirements_test_all.txt, -c/Users/pollet/dev/home-assistant/homeassistant/package_constraints.txt]; v = InvocationError('/Users/pollet/dev/home-assistant/.tox/py36/bin/python -m pip install -r/Users/pollet/dev/home-assistant/requirements_test_all.txt -c/Users/pollet/dev/home-assistant/homeassistant/package_constraints.txt', 1)
ERROR:   py37: could not install deps [-r/Users/pollet/dev/home-assistant/requirements_test_all.txt, -c/Users/pollet/dev/home-assistant/homeassistant/package_constraints.txt]; v = InvocationError('/Users/pollet/dev/home-assistant/.tox/py37/bin/python -m pip install -r/Users/pollet/dev/home-assistant/requirements_test_all.txt -c/Users/pollet/dev/home-assistant/homeassistant/package_constraints.txt', 1)
ERROR:   py38: could not install deps [-r/Users/pollet/dev/home-assistant/requirements_test_all.txt, -c/Users/pollet/dev/home-assistant/homeassistant/package_constraints.txt]; v = InvocationError('/Users/pollet/dev/home-assistant/.tox/py38/bin/python -m pip install -r/Users/pollet/dev/home-assistant/requirements_test_all.txt -c/Users/pollet/dev/home-assistant/homeassistant/package_constraints.txt', 1)
  lint: commands succeeded
ERROR:   pylint: could not install deps [-r/Users/pollet/dev/home-assistant/requirements_all.txt, -r/Users/pollet/dev/home-assistant/requirements_test.txt, -c/Users/pollet/dev/home-assistant/homeassistant/package_constraints.txt]; v = InvocationError('/Users/pollet/dev/home-assistant/.tox/pylint/bin/python -m pip install -r/Users/pollet/dev/home-assistant/requirements_all.txt -r/Users/pollet/dev/home-assistant/requirements_test.txt -c/Users/pollet/dev/home-assistant/homeassistant/package_constraints.txt', 1)
ERROR:   typing: commands failed
ERROR:   cov: InvocationError for command /Users/pollet/dev/home-assistant/venv/bin/python3 -m virtualenv --no-download --python /Users/pollet/dev/home-assistant/venv/bin/python3 cov (exited with code 2)

Can anyone help me here ?

Thanks.

I was having issues with tox as well until I installed Xcode command line tools. Might give that a shot.

Already installed, I saw this : Starting development - problem with tox, gonna try