Python version problem? requests_async import error

Hello, I don’t know, maybe it’s a python problem?

    File "/srv/homeassistant/lib/python3.7/site-packages/envoy_reader/", line 8, in <module>
    import requests_async as requests
ModuleNotFoundError: No module named 'requests_async'

I’m trying to use an updated version of a component (envoy_reader) which uses requests-async (this fails: import requests_async as requests) I did have 0.93.1, and I upgraded to 0.94.1 homeassistant. still same issue.

I ran pip3 install requests-async and I think it installed? but I can’t find a requests-async file, and I still get the import error.
$ pip3 install re
Looking in indexes:,
Requirement already satisfied: requests-async in /home/homeassistant/.local/lib/python3.7/site-packa
ges (0.6.0)
Requirement already satisfied: requests==2.* in /usr/lib/python3/dist-packages (from requests-async)
Requirement already satisfied: http3==0.1.* in /home/homeassistant/.local/lib/python3.7/site-package
s (from requests-async) (0.1.1)
Requirement already satisfied: certifi in /usr/lib/python3/dist-packages (from http3==0.1.->request
s-async) (2018.8.24)
Requirement already satisfied: idna==2.
in /usr/lib/python3/dist-packages (from http3==0.1.->reque
sts-async) (2.6)
Requirement already satisfied: chardet==3.
in /usr/lib/python3/dist-packages (from http3==0.1.->re
quests-async) (3.0.4)
Requirement already satisfied: rfc3986==1.
in /home/homeassistant/.local/lib/python3.7/site-package
s (from http3==0.1.->requests-async) (1.3.2)
Requirement already satisfied: h11==0.8.
in /home/homeassistant/.local/lib/python3.7/site-packages
(from http3==0.1.->requests-async) (0.8.1)
Requirement already satisfied: h2==3.
in /home/homeassistant/.local/lib/python3.7/site-packages (fr
om http3==0.1.->requests-async) (3.1.0)
Requirement already satisfied: hyperframe<6,>=5.2.0 in /home/homeassistant/.local/lib/python3.7/site
-packages (from h2==3.
->http3==0.1.->requests-async) (5.2.0)
Requirement already satisfied: hpack<4,>=2.3 in /home/homeassistant/.local/lib/python3.7/site-packag
es (from h2==3.
->http3==0.1.*->requests-async) (3.0.0)

Checking python version, and showing what version of homeassistant (haspbian) I have:
homeassistant@hassbian:~ $ python --version
Python 2.7.16 <<<<<<<< Is THIS ok ???

homeassistant@hassbian:~ $ sudo hassbian-config upgrade python
Generating system information...

  Home Assistant:        0.94.4
  Home Assistant Python: 3.7.3
  hassbian-config:       0.13.1

  Linux hassbian 4.14.98-v7+ #1200 SMP Tue Feb 12 20:27:48 GMT 2019 armv7l GNU/Linux

Suite:     Python
Installed: false
Contributed to the project by Ludeeus <>
Upgrades python3 and virtual environment to the newest stable version.

Checking current python version...
Python is already the highest stable version.

Operation completed...

Were you in the hassbian venv when you installed requests-async?

1 Like

Thanks @nickrout !

What do you mean by being ‘in’ the venv? the venv is /srv/homeassistant directory? There’s more to it than that I think.

I did some searching, this post and this post helped with understanding the venv.

I did the following, and it gets past the import error now, and I see requests_async in the ha site packages directory.

homeassistant@hassbian:~ $ source /srv/homeassistant/bin/activate
(homeassistant) homeassistant@hassbian:~ $ which python
(homeassistant) homeassistant@hassbian:~ $ ha hah!!! 
ha hahwhich python! 
bash: ha: command not found
(homeassistant) homeassistant@hassbian:~ $ pip3 install requests-async
Looking in indexes:,
Collecting requests-async
Requirement already satisfied: requests==2.* in /srv/homeassistant/lib/python3.7/site-packages (from requests-async) (2.22.0)
Collecting http3==0.1.* (from requests-async)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /srv/homeassistant/lib/python3.7/site-packages (from requests==2.*->requests-async) (1.24.3)
Requirement already satisfied: idna<2.9,>=2.5 in /srv/homeassistant/lib/python3.7/site-packages (from requests==2.*->requests-async) (2.8)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /srv/homeassistant/lib/python3.7/site-packages (from requests==2.*->requests-async) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in /srv/homeassistant/lib/python3.7/site-packages (from requests==2.*->requests-async) (2019.6.16)
Collecting h2==3.* (from http3==0.1.*->requests-async)
  Using cached
Collecting h11==0.8.* (from http3==0.1.*->requests-async)
  Using cached
Collecting rfc3986==1.* (from http3==0.1.*->requests-async)
  Using cached
Collecting hyperframe<6,>=5.2.0 (from h2==3.*->http3==0.1.*->requests-async)
  Using cached
Collecting hpack<4,>=2.3 (from h2==3.*->http3==0.1.*->requests-async)
  Using cached
Building wheels for collected packages: requests-async
  Building wheel for requests-async ( ... done
  Stored in directory: /home/homeassistant/.cache/pip/wheels/62/a9/8e/a1f067183c73cadd1d9cdcf6cc7845fe5b150738035b609e0d
Successfully built requests-async
Installing collected packages: hyperframe, hpack, h2, h11, rfc3986, http3, requests-async
Successfully installed h11-0.8.1 h2-3.1.0 hpack-3.0.0 http3-0.1.1 hyperframe-5.2.0 requests-async-0.6.1 rfc3986-1.3.2
(homeassistant) homeassistant@hassbian:~ $

yes that is what I meant. Does that work now?

1 Like

Yes, it did install and work, once the package was installed into ha’s venv.

can this be done in hassio?

No it can’t.