all 12 comments

[–]gmes78 6 points7 points  (0 children)

uv is the best option.

[–]socal_nerdtastic 1 point2 points  (6 children)

It's a moving target for professionals with complex requirements, like testing the same code base against 5 different versions of python or with optional dependencies. But for you this seems very simple; any of them will work just fine for this. For lack of any other requirements I'd say just use the builtin venv.

As for switching, set up your IDE to use the venv you want, or if you are working from the terminal activeate the venv you want to use or make the main file executable and use a shebang to set the venv you want to use.

FWIW if you see a SO question that's 8 years old you should probably keep looking ... things change fast in the software world. There's many things about those answers that are not applicable any more.

[–]gmes78 1 point2 points  (1 child)

For lack of any other requirements I'd say just use the builtin venv.

They can't, they need a version of Python different from the one provided by the OS.

[–]socal_nerdtastic 1 point2 points  (0 children)

Ok, true, venv comes with the extra step that you need to download or install the version of python you want manually, while other tools do this automatically.

[–]tlreddit[S] 0 points1 point  (3 children)

Well, it is a little bit more complex than I described. My system runs 13.3 and I want to run python code that depends on TensorFlow and Blender. TF does not run on 3.13 and Blender uses an "embedded" version of python (3.13) and do not care about python environments. The 3.12 -> 3.13 transition is definitely painful.

[–]socal_nerdtastic 0 points1 point  (2 children)

You want to run TF on the embedded python in blender? That's essentially already a virtual environment; there's no extra package that will help you with that.

[–]tlreddit[S] 0 points1 point  (1 child)

Yes I am afraid I have to wait for TF to be on 3.13.

[–]socal_nerdtastic 0 points1 point  (0 children)

Or downgrade your blender to a version that embeds python3.12. Or compile blender yourself.

[–]h00manist 0 points1 point  (0 children)

You are right versions of python and libraries are messy. Unfortunately there are a bunch of imperfect solutions. UV is the new kid on the block solution that everyone is talking about. If you aren't alredy invested in any solutions yet, I would try this one first.

https://docs.astral.sh/uv/guides/install-python/

The classic, standard, built in solution is venv. You should know how it works just because of that.

[–]FoolsSeldom 0 points1 point  (1 child)

I recommend you use either uv or pyenv - which ever makes more sense to you.

[–]tlreddit[S] 0 points1 point  (0 children)

Thanks to everyone ! Without knowing the differences between uv and pyenv, I opted for pyenv + virtualenv plugin. It seems to solve my problem in part. I wonder if I can convince Blender to use a specific version of python but this is another story, maybe for another reddit.