custom-components / sensor.avanza_stock

Custom component to get stock data from Avanza for Home Assistant
MIT License
46 stars 10 forks source link

Upgrade to 1.5.0 failed. "Conflicting dependencies" error #170

Closed dennisjenkins75 closed 9 months ago

dennisjenkins75 commented 11 months ago

I run home assistant in docker on Gentoo Linux (host OS should not matter). Today HA notified me that there was an update for Avanza (from 1.4.0 to 1.5.0), so I installed it. Now its failing to load. Sadly, the error message does not make it clear what the dependency problem is.

While attempting to diagnose this, I removed and regenerated my docker container, and the problem persists.

Error (from docker logs):

2023-12-21 13:49:18.563 ERROR (SyncWorker_5) [homeassistant.util.package] Unable to install package pyavanza==0.7.0: ERROR: Cannot install pyavanza==0.7.0 because these package versions have conflicting dependencies.

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

2023-12-21 13:49:20.205 ERROR (SyncWorker_5) [homeassistant.util.package] Unable to install package pyavanza==0.7.0: ERROR: Cannot install pyavanza==0.7.0 because these package versions have conflicting dependencies.

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

2023-12-21 13:49:21.937 ERROR (SyncWorker_5) [homeassistant.util.package] Unable to install package pyavanza==0.7.0: ERROR: Cannot install pyavanza==0.7.0 because these package versions have conflicting dependencies.

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

2023-12-21 13:49:21.937 ERROR (MainThread) [homeassistant.config] Platform error: sensor - Requirements for avanza_stock not found: ['pyavanza==0.7.0'].

My sensor config:

# 2023-11-09
  - platform: avanza_stock
    stock:
      - id: 4457
        name: GOOG
      - id: 3873
        name: MSFT
      - id: 3986
        name: AMZN
      - id: 653458
        name: S&P Global

Files in /config/custom_components/avanza_stock:

home-assistant:/config# ls -l custom_components/avanza_stock/
total 32
-rw-r--r--    1 root     root            40 Dec 21 13:43 __init__.py
-rw-r--r--    1 root     root          4506 Dec 21 13:43 const.py
-rw-r--r--    1 root     root           381 Dec 21 13:43 manifest.json
-rw-r--r--    1 root     root         15405 Dec 21 13:43 sensor.py

manifest.json:

# cat manifest.json 
{
  "domain": "avanza_stock",
  "name": "Avanza Stock",
  "codeowners": [
    "@claha"
  ],
  "dependencies": [],
  "documentation": "https://github.com/custom-components/sensor.avanza_stock",
  "iot_class": "cloud_polling",
  "issue_tracker": "https://github.com/custom-components/sensor.avanza_stock/issues",
  "requirements": [
    "pyavanza==0.7.0"
  ],
  "version": "1.5.0"
}

There are no other avanza related files in this container's file system, so what is "pyavanza 0.7.0" conflicting with?

# find / | grep -i avanza
/config/custom_components/avanza_stock
/config/custom_components/avanza_stock/const.py
/config/custom_components/avanza_stock/__init__.py
/config/custom_components/avanza_stock/sensor.py
/config/custom_components/avanza_stock/manifest.json
dennisjenkins75 commented 11 months ago

Strange. I nuked my entire home assistant docker container a second time, but this time I also removed the cached container image, and when it rebuilt, Avanza is now working, no errors.

claha commented 11 months ago

Nice that it works now, seems some package in pyavanza (probably aiohttp) conflicts with some in your ha. What version of ha are you on?

dennisjenkins75 commented 11 months ago

Core 2023.12.3

Frontend 20231208.2

rasssta commented 10 months ago

Got the same problem today. Tried to upgrade pyavanza manually:

Installing collected packages: aiohttp, pyavanza Attempting uninstall: aiohttp Found existing installation: aiohttp 3.8.5 Uninstalling aiohttp-3.8.5: Successfully uninstalled aiohttp-3.8.5 Attempting uninstall: pyavanza Found existing installation: pyavanza 0.6.0 Uninstalling pyavanza-0.6.0: Successfully uninstalled pyavanza-0.6.0 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. homeassistant 2023.10.5 requires aiohttp==3.8.5, but you have aiohttp 3.9.1 which is incompatible.

claha commented 10 months ago

2023.10.5 requires aiohttp==3.8.5, but you have aiohttp 3.9.1 which is incompatible.

Here the problem is that your homeassistant version needs to be upgraded. I will investigate if there is some way to set minimum required homeassistant version for a specific version of avanza_stock. Would be nice to prevent these errors and show why you can't/should't update. Seems 2023.12 is needed for aiohttp 3.9.1

rasssta commented 10 months ago

I think there is some way to do what you're looking for (but I don't know how), because I've often noticed that I get more available upgrades in HACS after upgrade of HASS.

kedar-1 commented 10 months ago

Yep, happen to me too.

HA Docker version: 2023.11.2 RPi 4B

claha commented 10 months ago

Yep, happen to me too.

HA Docker version: 2023.11.2 RPi 4B

You need at leaat 2023.12 for the latest version

claha commented 9 months ago

Added a minimum version to hacs.json, so will protect those that use hacs