home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.41k stars 30.65k forks source link

coinmarketcap setting fails with AttributeError: module 'pip._vendor.requests.__version__' has no attribute 'split #11493

Closed tomasxvavra closed 6 years ago

tomasxvavra commented 6 years ago

Home Assistant release: 0.60.1

Python release: 3.5.3

Component/platform: coinmarketcap 4.1.1

Modules

(homeassistant) debian@beaglebone:~$ pip3 list
aiohttp (2.3.6)
astral (1.4)
async-timeout (2.0.0)
blockchain (1.4.0)
boto3 (1.5.9)
botocore (1.8.23)
certifi (2017.11.5)
chardet (3.0.4)
coinmarketcap (4.1.1)
colorlog (3.0.1)
distro (1.1.0)
docutils (0.14)
ecdsa (0.13)
enum-compat (0.0.2)
envs (1.2.4)
future (0.16.0)
fuzzywuzzy (0.15.1)
gTTS-token (1.1.1)
homeassistant (0.60.1)
idna (2.6)
Jinja2 (2.10)
jmespath (0.9.3)
MarkupSafe (1.0)
multidict (3.3.2)
mutagen (1.39)
netdisco (1.2.3)
netifaces (0.10.6)
phue (1.0)
pip (9.0.1)
pkg-resources (0.0.0)
pycryptodome (3.3.1)
python-dateutil (2.6.1)
python-jose-cryptodome (1.3.2)
pytz (2017.3)
PyYAML (3.12)
requests (2.18.4)
requests-cache (0.4.13)
s3transfer (0.1.12)
setuptools (32.3.1)
six (1.11.0)
typing (3.6.2)
urllib3 (1.22)
voluptuous (0.10.5)
warrant (0.6.1)
xmltodict (0.11.0)
yarl (0.16.0)
zeroconf (0.19.1)

Description of problem:

Error while setting up platform coinmarketcap.

sensor:
  - platform: coinmarketcap 
    currency: ethereum

Traceback:

Jan 06 20:07:50 beaglebone hass[802]: 2018-01-06 20:07:50 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform coinmarketcap
Jan 06 20:07:50 beaglebone hass[802]: Traceback (most recent call last):
Jan 06 20:07:50 beaglebone hass[802]:   File "/home/debian/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_component.py", line 171, in _async_setup_platform
Jan 06 20:07:50 beaglebone hass[802]:     SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
Jan 06 20:07:50 beaglebone hass[802]:   File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for
Jan 06 20:07:50 beaglebone hass[802]:     return fut.result()
Jan 06 20:07:50 beaglebone hass[802]:   File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
Jan 06 20:07:50 beaglebone hass[802]:     raise self._exception
Jan 06 20:07:50 beaglebone hass[802]:   File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
Jan 06 20:07:50 beaglebone hass[802]:     result = self.fn(*self.args, **self.kwargs)
Jan 06 20:07:50 beaglebone hass[802]:   File "/home/debian/homeassistant/lib/python3.5/site-packages/homeassistant/components/sensor/coinmarketcap.py", line 55, in setup_platform
Jan 06 20:07:50 beaglebone hass[802]:     CoinMarketCapData(currency, display_currency).update()
Jan 06 20:07:50 beaglebone hass[802]:   File "/home/debian/homeassistant/lib/python3.5/site-packages/homeassistant/components/sensor/coinmarketcap.py", line 129, in update
Jan 06 20:07:50 beaglebone hass[802]:     from coinmarketcap import Market
Jan 06 20:07:50 beaglebone hass[802]:   File "/home/debian/homeassistant/lib/python3.5/site-packages/coinmarketcap/__init__.py", line 10, in <module>
Jan 06 20:07:50 beaglebone hass[802]:     from .core import Market
Jan 06 20:07:50 beaglebone hass[802]:   File "/home/debian/homeassistant/lib/python3.5/site-packages/coinmarketcap/core.py", line 6, in <module>
Jan 06 20:07:50 beaglebone hass[802]:     import requests_cache
Jan 06 20:07:50 beaglebone hass[802]:   File "/home/debian/homeassistant/lib/python3.5/site-packages/requests_cache/__init__.py", line 28, in <module>
Jan 06 20:07:50 beaglebone hass[802]:     from .core import(
Jan 06 20:07:50 beaglebone hass[802]:   File "/home/debian/homeassistant/lib/python3.5/site-packages/requests_cache/core.py", line 21, in <module>
Jan 06 20:07:50 beaglebone hass[802]:     ver = tuple(map(int, requests.__version__.split(".")))
Jan 06 20:07:50 beaglebone hass[802]: AttributeError: module 'pip._vendor.requests.__version__' has no attribute 'split
fabaff commented 6 years ago

Duplicate of #9907 -> https://github.com/home-assistant/home-assistant/issues/9907#issuecomment-351356534

tomasxvavra commented 6 years ago

I think this is not a duplicate of #9907 . The error is completely different.

This issue:

File "/home/debian/homeassistant/lib/python3.5/site-packages/requests_cache/core.py", line 21, in <module>
ver = tuple(map(int, requests.__version__.split(".")))
AttributeError: module 'pip._vendor.requests.__version__' has no attribute 'split

9907 Issue

File "/srv/homeassistant/lib/python3.4/site-packages/requests_cache/backends/storage/dbdict.py", line 70, in connection
con = sqlite.connect(self.filename)
sqlite3.OperationalError: unable to open database file

Workaround for #9907 does not work for this issue.

MartinHjelmare commented 6 years ago

I agree with the above post.

tomasxvavra commented 6 years ago

So, funny thing is that if i run it inside a debugger, it won't crash.. and works as it should.

pudb3 ./hass

But I have no idea why.

fabaff commented 6 years ago

Well, the error which I have linked looks exactly the same:

AttributeError: module 'pip._vendor.requests.__version__' has no attribute 'split'
MartinHjelmare commented 6 years ago

@fabaff yes, but that wasn't #9907 original error, just a pollution of that thread.

meetyourlaser commented 6 years ago

I’m experiencing the same as @tomasxvavra

Home Assistant release: 0.60.1

Python release: 3.5.3

Error while setting up platform coinmarketcap

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_component.py", line 171, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
  File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for
    return fut.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/sensor/coinmarketcap.py", line 55, in setup_platform
    CoinMarketCapData(currency, display_currency).update()
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/sensor/coinmarketcap.py", line 129, in update
    from coinmarketcap import Market
  File "/srv/homeassistant/lib/python3.5/site-packages/coinmarketcap/__init__.py", line 10, in <module>
    from .core import Market
  File "/srv/homeassistant/lib/python3.5/site-packages/coinmarketcap/core.py", line 6, in <module>
    import requests_cache
  File "/srv/homeassistant/lib/python3.5/site-packages/requests_cache/__init__.py", line 28, in <module>
    from .core import(
  File "/srv/homeassistant/lib/python3.5/site-packages/requests_cache/core.py", line 21, in <module>
    ver = tuple(map(int, requests.__version__.split(".")))
AttributeError: module 'pip._vendor.requests.__version__' has no attribute 'split'

pip3 list:

aiocoap (0.4a1)
aiohttp (2.3.6)
aiohttp-cors (0.5.3)
aiolifx (0.6.1)
aiolifx-effects (0.1.2)
android-backup (0.1.0)
apcaccess (0.0.13)
asn1crypto (0.23.0)
astral (1.4)
async-timeout (2.0.0)
attrs (17.3.0)
bitstring (3.1.5)
blockchain (1.4.0)
certifi (2017.11.5)
cffi (1.11.2)
chardet (3.0.4)
click (6.7)
coinmarketcap (4.1.1)
colorlog (3.0.1)
construct (2.8.16)
cryptography (2.1.4)
Cython (0.27.2)
distro (1.1.0)
DTLSSocket (0.1.4)
enum-compat (0.0.2)
fuzzywuzzy (0.15.1)
gTTS-token (1.1.1)
home-assistant-frontend (20171216.0)
homeassistant (0.60.1)
idna (2.6)
influxdb (4.1.1)
Jinja2 (2.10)
jsonrpc-async (0.6)
jsonrpc-base (1.0)
jsonrpc-websocket (0.5)
MarkupSafe (1.0)
multidict (3.3.2)
mutagen (1.38)
mysqlclient (1.3.12)
netdisco (1.2.3)
netifaces (0.10.6)
pip (9.0.1)
pkg-resources (0.0.0)
pretty-cron (1.0.2)
pushbullet.py (0.11.0)
py-cpuinfo (3.3.0)
pycparser (2.18)
pycrypto (2.6.1)
PyDispatcher (2.0.5)
PyMySQL (0.7.11)
python-dateutil (2.6.1)
python-magic (0.4.13)
python-miio (0.3.2)
python-mirobo (0.2.0)
python-mpd2 (0.5.5)
python-openzwave (0.4.0.35)
pytradfri (4.1.0)
pytz (2017.3)
PyYAML (3.12)
requests (2.18.4)
requests-cache (0.4.13)
setuptools (36.6.0)
six (1.11.0)
snapcast (2.0.8)
spotipy (2.4.4)
SQLAlchemy (1.1.15)
steamodd (4.21)
tellcore-net (0.4)
tellcore-py (1.1.2)
tinyDTLS (0.0.0)
typing (3.6.2)
ua-parser (0.7.3)
urllib3 (1.22)
user-agents (1.1.0)
voluptuous (0.10.5)
websocket-client (0.44.0)
wheel (0.30.0)
xmltodict (0.11.0)
yarl (0.16.0)
zeroconf (0.19.1)
tomasxvavra commented 6 years ago

Updated to 0.62.0. Same error message.

FrederikBolding commented 6 years ago

Can confirm I've got the same one on 0.63.0.

devtone commented 6 years ago

Can confirm I've got the same one on 0.63.3.

werdnum commented 6 years ago

Found this solution floating around: https://community.home-assistant.io/t/fedex-error-on-device-update/42974 -- looks like at its root there's a Requests version mismatch

FrederikBolding commented 6 years ago

@werdnum Are you sure? It seems like Home Assistant and Coinmarketcap runs the same version of requests? https://github.com/home-assistant/home-assistant/blob/dev/requirements_all.txt https://github.com/barnumbirr/coinmarketcap/blob/master/requirements.txt

werdnum commented 6 years ago

@FrederikBolding maybe! I dunno, just commenting what helped a similar problem for me.

TooSpeedy commented 6 years ago

Is there an update to this? I'm on the latest version of HA but i still get

AttributeError: module 'pip._vendor.requests.version' has no attribute 'split'

I have been through the other posts with no resolution.

FrederikBolding commented 6 years ago

@TooSpeedy I'm getting it sometimes when running tox locally aswell as on my dedicated HA RPi. I'm still unsure of how it occurs.

TooSpeedy commented 6 years ago

i have HA running on a RPi3 was Raspbian, tried a few things but can't work it out.

FrederikBolding commented 6 years ago

I'm not sure what we should do about the issue? Would it be too much to reimplement some of the functionality in a new library? (eliminating extra dependencies and simplifying code) I believe I have some code lying around I could reuse.