Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pythonPackages.swifter: 0.304 #90046

Closed
wants to merge 1 commit into from

Conversation

moritzschaefer
Copy link
Contributor

Motivation for this change

Python library was absent from nixpkgs

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Both pythonImportLibrary and checkPhase = "nosetests" pass.
  • Tested compilation of all pkgs that depend on this change using `nix-shell -p nixpkgs-review --run "nixpkgs-review wip" <- no dependencies
  • Tested execution of all binary files (usually in ./result/bin/) <- no binaries
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

I added myself as maintainer

Comment on lines +2 to +3
pandas, psutil, dask, tqdm, ipywidgets, numba, bleach, parso, distributed }:
buildPythonPackage rec {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pandas, psutil, dask, tqdm, ipywidgets, numba, bleach, parso, distributed }:
buildPythonPackage rec {
pandas, psutil, dask, tqdm, ipywidgets, numba, bleach, parso, distributed }:
buildPythonPackage rec {


pythonImportsCheck = [ "swifter" ];
checkPhase = ''
nosetests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this use pytestCheckHook?

Comment on lines +22 to +24
# Tests require extra dependencies
doCheck = true;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Tests require extra dependencies
doCheck = true;

@SuperSandro2000
Copy link
Member

@moritzschaefer please fix the merge conflict.

@moritzschaefer
Copy link
Contributor Author

Thanks for your response!

As discussed here (#89213), I refrain now from adding python packages this way. I think NUR is a better destination for it. Sorry for not having colsed this

@Narice
Copy link
Contributor

Narice commented Apr 3, 2021

As it was extremely difficult for me to install swifter, here is how I did it:
flake.nix

{
    description = "Your desc here";
    inputs = {
        nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    };
    outputs = inputs:
        let 
            nixpkgs = inputs.nixpkgs;
            system = "x86_64-linux";
            pkgs = (import nixpkgs { inherit system; }).pkgs;
        in {
            devShell."${system}" = pkgs.mkShell {
                buildInputs = with pkgs; [ python3Full clangStdenv ];
                shellHook = ''
                  source ./.venv/bin/activate
                  export LD_LIBRARY_PATH=${nixpkgs.lib.makeLibraryPath [pkgs.stdenv.cc.cc]}
                '';
            };
        };
}

requirements.txt

#other packages
swifter

then the first time, do:

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

This took me two days as I tried the following things:

  • using the method cited above without this line in the shellHook:
export LD_LIBRARY_PATH=${nixpkgs.lib.makeLibraryPath [pkgs.stdenv.cc.cc]}

this resulted in this error:

Traceback (most recent call last):
  ...
    import pandas._libs.window.aggregations as window_aggregations
ImportError: libstdc++.so.6: cannot open shared object file: No such file or directory
  • then I tried using mach-nix but it has a problem specifically with swifter that causes this error:
collision between `/nix/store/zn4ksalrynlx3iwd4d0ldq7aiqn84ysv-python3.8-opencensus-context-0.1.2/lib/python3.8/site-packages/opencensus/common/__pycache__/__init__.cpython-38.pyc' and `/nix/store/2cfyjnic605mjr5j7zck88gk7bkqwpim-python3.8-opencensus-0.7.12/lib/python3.8/site-packages/opencensus/common/__pycache__/__init__.cpython-38.pyc'

I opened an issue about it.

  • then I tried to build swifter using the things I found on this PR and in this file from the same person
    I however didn't succeed in making a correct overlay for python so that work went down the drain too.
  • finally I came back to my first idea and user the tips that was mentionned in this NixOS Discourse question.

I'm writing this as it might be of use to a future poor soul that wants to install this package.
I lost much more time that this package will never save me but I learned along the way so that's fine ;)
It would be of great use however if this type of info was a bit easier to find in the first place as this is more than frustrating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants