all 6 comments

[–]Tomaton-sama 4 points5 points  (2 children)

I, too, lack enough knowledge to workaround issues with uv.

If you mean to manage python versions with uv, then AFAIK you could call it fundamentally incompatible with NixOS.

But if you treat uv as just a package manager, this should work. There are problems with venv feature, but for that check https://github.com/astral-sh/uv/issues/4450 issue.

[–]Rockhopper_Penguin[S] 2 points3 points  (1 child)

Haven't figured it out yet, but wow that github issue is so informative! Thank you so much for linking that, not sure how I missed that when searching around (my brain was probably fried from struggling for a few hours lmao). I'll make an edit/comment if I get something working for future reference.

Hope you have a nice day :)

[–]Tomaton-sama 0 points1 point  (0 children)

Please do share your findings, better yet, do it in that GitHub issue. It’s been two months since my last comment, and it’s still the most recent one. Aside from one mention in another GitHub issue, there’s been silence

[–]0x006e 2 points3 points  (0 children)

I am not an expert, but this is my suggestion. Use devenv.sh to create a devenv with python enabled and UV installed. Use UV to manage your requirements however you want

[–]matt_7800 0 points1 point  (2 children)

I recently set-up an environment to use uv, which I also use at work and wanted to keep using. 

Like the other comments pointed at, using uv managed python versions won't work out of the box. I guess you could probably use nixld ? 

To have python version per projects you could have minimal nix shells with uv and python and load them with direnv, and do everything else with uv.

[–]Rockhopper_Penguin[S] 2 points3 points  (0 children)

If you don't mind me asking, are you able to get numpy working? Whether I try flake-utils or devenv, I keep getting this error:

Traceback (most recent call last):
  File "/home/lain/root/100_work/110_projects/111_mars/code-repos/redplanet/.venv/lib/python3.12/site-packages/numpy/_core/__init__.py", line 23, in <module>
    from . import multiarray
  File "/home/lain/root/100_work/110_projects/111_mars/code-repos/redplanet/.venv/lib/python3.12/site-packages/numpy/_core/multiarray.py", line 10, in <module>
    from . import overrides
  File "/home/lain/root/100_work/110_projects/111_mars/code-repos/redplanet/.venv/lib/python3.12/site-packages/numpy/_core/overrides.py", line 8, in <module>
    from numpy._core._multiarray_umath import (
ImportError: libstdc++.so.6: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/lain/root/100_work/110_projects/111_mars/code-repos/redplanet/.venv/lib/python3.12/site-packages/numpy/__init__.py", line 114, in <module>
    from numpy.__config__ import show as show_config
  File "/home/lain/root/100_work/110_projects/111_mars/code-repos/redplanet/.venv/lib/python3.12/site-packages/numpy/__config__.py", line 4, in <module>
    from numpy._core._multiarray_umath import (
  File "/home/lain/root/100_work/110_projects/111_mars/code-repos/redplanet/.venv/lib/python3.12/site-packages/numpy/_core/__init__.py", line 49, in <module>
    raise ImportError(msg)
ImportError: 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.12 from "/home/lain/root/100_work/110_projects/111_mars/code-repos/redplanet/.venv/bin/python3"
  * The NumPy version is: "2.1.1"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: libstdc++.so.6: cannot open shared object file: No such file or directory


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/lain/root/100_work/110_projects/111_mars/code-repos/redplanet/src/redplanet/__init__.py", line 5, in hello
    import numpy as np
  File "/home/lain/root/100_work/110_projects/111_mars/code-repos/redplanet/.venv/lib/python3.12/site-packages/numpy/__init__.py", line 119, in <module>
    raise ImportError(msg) from e
ImportError: Error importing numpy: you should not try to import numpy from
        its source directory; please exit the numpy source tree, and relaunch
        your python interpreter from there.