this post was submitted on 20 May 2025
39 points (97.6% liked)

Python

7103 readers
21 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

📅 Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
💓 Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 8 points 2 days ago (7 children)

as someone fairly new to larger python projects, working in a team too - why does it seem like I’m always in dependency hell? Sometimes things work with venv until I forget and a notebook needs something else. Or a diff type of proj because mlflow wanted another kind of env manager?

[–] pixelpop3 1 points 1 hour ago

It would be similar hell in for example Matlab or C/C++ if install of external packages were made so easy.

Some systems that are designed more with the concept of maintenance challenges (Windows and others) make it possible to have different versions installed simultaneously.

The need for the whole venv thing fundamentally underscores the problem. How many versions of libc do you have installed simultaneously? (docker users pls don't respond)

[–] onlinepersona 3 points 1 day ago (1 children)

What are you doing to get into dependency hell? Never had that problem. Are you running "pip install" in your venv at will?

Anti Commercial-AI license

[–] [email protected] 3 points 1 day ago* (last edited 1 day ago)

i reckon that’s mostly it - I get an idea, wanna try something and don’t “reset” to a fresh venv. or I do then forget to reinstall the tools I want to use cause I was “just” using them in this same terminal.

it’s me not python. though it’s funny getting a few replies with different solutions. like in PERL, tmtowtdi.

thanks for your reply!

[–] [email protected] 7 points 2 days ago (1 children)

6 years of python and I've never really had that problem, also working on larger projects. Use poetry or uv and you'll probably be fine. Unless you're doing something strange with your dependencies. The only thing I would say is non trivial is updating the dependencies. And if a library has a bug or something you have to downgrade for. You can specify dev dependencies for notebooks and such. I've not heard of mlflow having a problem with a manager. Perhaps you're in a cloud environment and don't have access to poetry for example?

[–] [email protected] 1 points 1 day ago (1 children)

never used poetry. just venv, virtualenv and such. I guess I just don’t know the current era’s idiomatic way of doing things. I’m more familiar with java/mvn, rust, etc. It seems like every manning book on a pythonic tool has a different way the author setup the env. to be expected sure. I just need to grok and settle into my own. :)

just learning is all. :) appreciate the reply!

[–] [email protected] 5 points 1 day ago

Poetry/uv is similar to Rust's cargo. You specify your direct dependencies in a TOML file and their version constraints and the tool takes care of the rest.

[–] somegeek 4 points 1 day ago (1 children)

That's one of the main pain points of Python. Something like poetry or uv can help but the python ecosystem is just unstable. It's very hard to update a dependancy. You project might only run with very specific versions of libraries and the language itself.

I honestly hate that about python and I don't think python is good for developing large software. Even js/ts is a much better ecosystem. (I'm bracing for the hate)

[–] [email protected] 2 points 1 day ago

hrm. yeah. I am “trying on” some basic ml models (just simple classifications) into our workflow and while I can whip one up with scikit, a notebook, and serve it with flask/fast - there is no way I can build a workflow tenable for others who are more “data analytics” than coders. The ecosystems for low/no code model generation (knime etc) with handoff to engineers like me to serve is … young.

[–] rutrum 2 points 1 day ago

If you use conda, I suggest using pixi as a project manager. It has lock files which will fix dependencies, and it can activate your enviroments with scripts and variables defined in your pyproject.toml. It has been so much better than using conda directly: https://pixi.sh/

[–] logging_strict 2 points 1 day ago* (last edited 1 day ago) (1 children)

wreck is a dependencies manager, which is venv aware, BUT is not a venv manager nor does it put dependencies into pyproject.toml. Sticks with good ol' requirement files.

Assumes, for each package, it's normal to be working with several venv.

Syncs the dependencies intended for the same venv.

req fix --venv-relpath='.venv'
req fix --venv-relpath='.doc/.venv'

Across many packages, unfortunately have to resort to manually sync'ing dependencies.

Lessons learned

  • have very recently ceased putting build requirements into requirement files. The build requirements' transitive dependencies should be in the requirement files. wreck does not support this yet. i'm manually removing dependencies like: build wheel setuptools-scm (setuptools and pip already filtered out) and click.

  • syncing across packages is really time consuming. Go thru this pain, then no dependency hell.

Wrote wreck cuz all the other options were combining requirements management with everything including the bathroom sink. build backends ... venv management ... everything goes into pyproject.toml. All these ideas seem to just compound the learning curve.

Less is more especially when it comes to learning curve.

[–] [email protected] 1 points 1 day ago

thanks! I will check it out!

[–] [email protected] 0 points 1 day ago

You'll likely also want to check out ruff for linting and formatting, by the same company that makes uv. It doesn't enable a lot of lints by default, but there's a long list of checks to enable.

They also have a typechecker, ty, which is still in early alpha. If it's as good as their other tools I expect it to become the standard for typechecking Python. Currently you'll likely want to go with pyright for that.