Abhängigkeitshölle mit Python
Im Vigilant Crypto Snatch Projekt nutze ich Python als Programmiersprache und Poetry zum Verwalten der Abhängigkeiten. Dabei hat sich mit der Zeit einiges angesammelt:
[tool.poetry.dependencies] BitstampClient = "^2.2.8" appdirs = "^1.4.4" coloredlogs = "^15.0" python = "^3.7.1,<3.11" pyyaml = "^6.0" requests = "^2.25.1" sqlalchemy = "^1.4.27" urllib3 = "^1.26.3" krakenex = "^2.1.0" python-dateutil = "^2.8.2" click = "^8.0.0" ccxt = "^1.74.11" pandas = { version = "^1.3.4", optional = true } scipy = { version = "^1.7.2", optional = true } streamlit = { version = "^1.2.0", optional = true } altair = { version = "^4.1.0", optional = true } PySide6 = { version = "^6.3.0", optional = true }
Das Problem dabei ist, dass jedes dieser Pakete wieder neue Abhängigkeiten reinzieht. So hängt Streamlit wieder von Click ab, jedoch in einer älteren Version. So hatte Streamlit früher maximal Click 7 unterstützt. Ich musste also erst Streamlit aktualisieren, bevor ich Click 8 nutzen konnte. Poetry löst diese Abhängigkeiten alle auf und erstellt dann eine Liste mit allen Versionen, die passend sind.
Lässt man das durchlaufen, so erhält man alle transitiven Abhängigkeiten. Und das sind aktuell 159 Pakete:
- aiodns
- aiohttp
- aiosignal
- altair
- appdirs
- argon2
- async_timeout
- attr
- attrs
- backcall
- backports
- bitstamp
- black
- black_primer
- blackd
- bleach
- blib2to3
- blinker
- bs4
- cachetools
- ccxt
- certifi
- cffi
- cfgv
- charset_normalizer
- click
- coloredlogs
- coverage
- cryptography
- dateutil
- dateutil-stubs
- debugpy
- decorator.py
- defusedxml
- distlib
- entrypoints.py
- fastjsonschema
- filelock
- frozenlist
- ghp_import.py
- git
- gitdb
- greenlet
- humanfriendly
- identify
- idna
- importlib_metadata
- importlib_resources
- iniconfig
- ipykernel
- ipykernel_launcher
- IPython
- ipython_genutils
- ipywidgets
- jedi
- jinja2
- jsonschema
- jupyter
- jupyter_client
- jupyter_core
- jupyterlab_pygments
- jupyterlab_widgets
- krakenex
- markdown
- markupsafe
- material
- materialx
- matplotlib_inline
- mergedeep
- mistune.py
- mkdocs
- multidict
- mypy
- mypy_extensions
- mypyc
- nbclient
- nbconvert
- nbformat
- nest_asyncio
- nodeenv
- notebook
- numpy
- packaging
- pandas
- pandocfilters
- parso
- pathspec
- pexpect
- pickleshare.py
- PIL
- pip
- piplicenses.py
- pkg_resources
- platformdirs
- pluggy
- pre_commit
- prettytable
- prometheus_client
- prompt_toolkit
- protobuf
- psutil
- ptyprocess
- pvectorc
- py
- pyarrow
- pycares
- pycparser
- pydeck
- pygments
- pymdownx
- pympler
- pyparsing
- pyrsistent
- PySide6
- pytest
- pytz
- pytz_deprecation_shim
- requests
- requests-stubs
- scipy
- semver.py
- send2trash
- setuptools
- shiboken6
- six
- smmap
- soupsieve
- sqlalchemy
- sqlalchemy-stubs
- sqlmypy
- sqltyping
- streamlit
- terminado
- tinycss2
- tlz
- toml
- tomli
- toolz
- tornado
- traitlets
- typing_extensions
- tzdata
- tzlocal
- urllib3
- urllib3-stubs
- validators
- virtualenv
- watchdog
- wcwidth
- webencodings
- wheel
- widgetsnbextension
- yaml
- yaml-stubs
- yaml_env_tag
- yarl
- zipp
- zmq
Das ist der totale Wahnsinn. Also irgendwie ist die Zahl noch klein gegen das, was man so mit JavaScript und NPM in ein Projekt reinzieht, aber ich finde das inzwischen nicht mehr lustig.
Es führt auch zu Problemen. So hat sich beim Streamlit die API etwas geändert. Ich wollte alles aktualisieren. Also habe ich einfach poetry update
ausgeführt. Nach 40 Minuten ist mein Laptop abgestürzt, weil der Abhängigkeitslöser (SAT-Solver) von Poetry die verbleibenden 5 GB Arbeitsspeicher genommen hatte und dann der Arbeitsspeicher ausgegangen ist. Und somit kann ich aktuell einfach keine Aktualisierung der Pakete vornehmen.
Das ist ein echtes Problem und ich kann nicht mehr an dem Projekt entwickeln, ohne dass ich da Pakete rauswerfe. Oder eine andere Methode zur Verwaltung der Abhängigkeiten nehme. Das ist wirklich sehr frustrierend.