Skip to content

Installing ruff via pip on NixOs does not work #1699

Closed
@heitorPB

Description

@heitorPB

Installing ruff via pip on NixOs systems does not work:

$ cd /tmp
$ python3 -m venv venv
$ source venv/bin/activate
(venv)
$ pip install ruff
Collecting ruff
  Using cached ruff-0.0.212-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.3 MB)
Installing collected packages: ruff
Successfully installed ruff-0.0.212

[notice] A new release of pip available: 22.2.2 -> 22.3.1
[notice] To update, run: pip install --upgrade pip
(venv)
$ ruff
-bash: /tmp/venv/bin/ruff: No such file or directory
(venv)

$ file /tmp/venv/bin/ruff
/tmp/venv/bin/ruff: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=1ec33df614fc5020de42d625366e4684ae45a0b6, for GNU/Linux 2.6.32, stripped
(venv)

The dynamic loader ("ELF interpreter") is not in the path hardcoded in the binary, although ldd shows the right path:

$ ldd /tmp/venv/bin/ruff
        linux-vdso.so.1 (0x00007f8623e51000)
        libgcc_s.so.1 => /nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/libgcc_s.so.1 (0x00007f86233eb000)
        librt.so.1 => /nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/librt.so.1 (0x00007f86233e6000)
        libpthread.so.0 => /nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/libpthread.so.0 (0x00007f86233e1000)
        libm.so.6 => /nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/libm.so.6 (0x00007f8623301000)
        libdl.so.2 => /nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/libdl.so.2 (0x00007f86232fc000)
        libc.so.6 => /nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/libc.so.6 (0x00007f86230f1000)
        /lib64/ld-linux-x86-64.so.2 => /nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib64/ld-linux-x86-64.so.2 (0x00007f8623e53000)
(venv)

I was able to get it working using patchelf, but it is not a good workflow when using a Python package manager (e.g. hatch, pdm, poetry, etc) to handle all the dev dependencies of the project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions