RDFLib / sparqlwrapper

A wrapper for a remote SPARQL endpoint
https://sparqlwrapper.readthedocs.io/
Other
513 stars 121 forks source link

Can't use SPARQLWrapper in nix-shell (somewhat OT) #227

Open ktk opened 1 year ago

ktk commented 1 year ago

I'm a complete Python noob and the only way I started using it recently is via ChatGPT to automate some things that are easy to do via Python. It proposes SPARQLWrapper a lot so I made a nix-config as well as I use nix for separate build environments.

However it looks like this fails really fast, given the following shell.nix file as config

{ pkgs ? import <nixpkgs> {} }:

let
  python = pkgs.python38;
  pkgs_python = python.withPackages(ps: with ps; [
    pandas
    SPARQLWrapper
  ]);
in
pkgs.mkShell {
  name = "my-python-env";
  buildInputs = [
    pkgs_python
  ];
}

and then run a nix-shell, it fails with

py-sparql-wrapper nix-shell
error: Package ‘python3.8-keepalive-0.5’ in /nix/store/qzmzxq7vh5lw5cisiiy1fgy5ifw0gxjp-nixpkgs/nixpkgs/pkgs/development/python-modules/keepalive/default.nix:19 is marked as broken, refusing to evaluate.

       a) To temporarily allow broken packages, you can use an environment variable
          for a single invocation of the nix tools.

            $ export NIXPKGS_ALLOW_BROKEN=1

        Note: For `nix shell`, `nix build`, `nix develop` or any other Nix 2.4+
        (Flake) command, `--impure` must be passed in order to read this
        environment variable.

       b) For `nixos-rebuild` you can set
         { nixpkgs.config.allowBroken = true; }
       in configuration.nix to override this.

       c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
         { allowBroken = true; }
       to ~/.config/nixpkgs/config.nix.
(use '--show-trace' to show detailed location information)

I used requests instead which worked fine as well but it would be nice to have SPARQLWrapper working as well.

Anyone ever saw this issue with keepalive? I could only trigger that with SPARQLWrapper so far.

If this is too offtopic and a pure nix-shell issue, let me know & close it.