Where can I get libgthread-2.0.so.0

I am trying to run napari from a nix-shell. I’ve pip installed napari inside the shell, and hunted down many libraries which it requires, but now upon trying to run it I’m getting an ImportError

ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory

Does anyone know where this library can be sourced from? On other distros, Google tells me it comes from libglib, but I can’t find this in the NixOS search.

It is glib for NixOS. (edited)

You can check where libgthread-2.0.so.0 comes from with nix-locate from nix-index project.

$ nix-locate "libgthread-2.0.so.0"
...
glib.out                                              0 s /nix/store/1pj0qrswyq0iyfa4xzqwppnfxszvh868-glib-2.70.0/lib/libgthread-2.0.so.0
glib.out                                         15,728 x /nix/store/1pj0qrswyq0iyfa4xzqwppnfxszvh868-glib-2.70.0/lib/libgthread-2.0.so.0.7000.0
...

Thank you - however I added this to my shell.nix:

{ pkgs ? import <nixpkgs> {} }:
(pkgs.buildFHSUserEnv {
  name = "pipzone";
  targetPkgs = pkgs: (with pkgs; [
    ...
    glibc
    ...
]);
  runScript = "bash";
}).env

and am unfortunately still getting this ImportError

Thank you for this. This will save me a tonne of time in the future.

Maybe you can try adding it to LD_LIBRARY_PATH, like:

LD_LIBRARY_PATH = "$LD_LIBRARY_PATH:${pkgs.glibc}/lib";

Thank you. I was using buildFHSUserEnv so I did

{ pkgs ? import <nixpkgs> {} }:
(pkgs.buildFHSUserEnv {
  name = "pipzone";
  targetPkgs = pkgs: (with pkgs; [
    ...
    glibc
    ...
]);
  runScript = "bash";
      profile = ''
       export LD_LIBRARY_PATH=${pkgs.glibc}/lib
     '';
}).env

Now I am missing libstdc++.so.6. I ran nix-locate "libstdc++.so.6", but the output is very long. How do I know where to look for the main library?

A side question: when getting programs to work, is this normal? The run -> error -> find & install library -> run loop?

glib, which contains libgthread is different from glibc.

2 Likes

Same problem here, libgthread-2.0.so.0 is provided by "${pkgs.glib.out}", I found it’s path by nix repl "<nixpkgs>":

› nix repl "<nixpkgs>"
Loading installable ''...
Added 17755 variables.

nix-repl> "${pkgs.glib.out}"
"/nix/store/phpj49r6iglnj5kpln2jrrwd21573q0k-glib-2.74.3"

check the shared library provided by this package:

› ls /nix/store/phpj49r6iglnj5kpln2jrrwd21573q0k-glib-2.74.3/lib
glib-2.0                libglib-2.0.so           libgmodule-2.0.so.0         libgobject-2.0.so.0.7400.3
libgio-2.0.so           libglib-2.0.so.0         libgmodule-2.0.so.0.7400.3  libgthread-2.0.so
libgio-2.0.so.0         libglib-2.0.so.0.7400.3  libgobject-2.0.so           libgthread-2.0.so.0
libgio-2.0.so.0.7400.3  libgmodule-2.0.so        libgobject-2.0.so.0         libgthread-2.0.so.0.7400.3

then fixed the problem temporarily by command:

 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/nix/store/phpj49r6iglnj5kpln2jrrwd21573q0k-glib-2.74.3/lib