pmjoe
December 5, 2020, 12:08am
1
I want to lock the version of a python tool called paconn
, it’s not available at nix repositories. I did this:
paconn = pkgs.python3Packages.buildPythonApplication rec {
pname = "paconn";
version = "0.0.15";
src = pkgs.python38.pkgs.fetchPypi {
inherit pname version;
sha256 = "0m2d4amjlyv4kdkxchkfqnyb0h8d289fwv1zgfxyyrwc953n2zfi";
};
};
But it complains that it doesn’t have the dependencies that it’s expecting and here that starts the problem, some dependencies are also not available at nix repositories and this becomes a recursive problem, I followed 3 layers of these dependencies and I simply gave up. Is this normal? There is any other way of doing this? I’m almost simply adding to the readme of the project pip3 install paconn
because with nix is becoming so damn hard
brogos
December 5, 2020, 1:39am
2
I recommend you to use mach-nix .
pmjoe
December 7, 2020, 11:03am
3
Thanks. It’s a really nice tool, it improved a ton but I’m still getting errors. Do you know how to solve this problem?
mach-nix = import (builtins.fetchGit {
url = "https://github.com/DavHau/mach-nix/";
ref = "refs/tags/3.1.1";
}) { python = "python38"; };
paconn = mach-nix.buildPythonApplication rec {
pname = "paconn";
version = "0.0.15";
src = mach-nix.nixpkgs.python3Packages.fetchPypi {
inherit pname version;
sha256 = "0m2d4amjlyv4kdkxchkfqnyb0h8d289fwv1zgfxyyrwc953n2zfi";
};
};
This is the result:
Processing ./paconn-0.0.15-py3-none-any.whl
Requirement already satisfied: pytest in /nix/store/6jin8avpsajzxzv58b30nz978v54nnd0-python3.8-pytest-6.1.2/lib/python3.8/site-packages (from paconn==0.0.15) (6.1.2)
Requirement already satisfied: flake8 in /nix/store/ajbg3c4jjwbz8dgn7p3nq5b56akbkiak-python3.8-flake8-3.8.4/lib/python3.8/site-packages (from paconn==0.0.15) (3.8.4)
Requirement already satisfied: knack~=0.5.1 in /nix/store/7yhgsn7fj0lcjc8s50dmww8if8lwi58g-python3.8-knack-0.5.4/lib/python3.8/site-packages (from paconn==0.0.15) (0.5.4)
Requirement already satisfied: adal in /nix/store/6jqijy09h13shgkc7gc4w4psxiq5zrlh-python3.8-adal-1.2.5/lib/python3.8/site-packages (from paconn==0.0.15) (1.2.5)
Requirement already satisfied: future in /nix/store/jn8g7yn6gc0w1an8qf5j6n68f225qgp2-python3.8-future-0.18.2/lib/python3.8/site-packages (from paconn==0.0.15) (0.18.2)
Requirement already satisfied: virtualenv in /nix/store/yayrkgqgjddg9ap3vf53nvj1r4mmifml-python3.8-virtualenv-20.2.1/lib/python3.8/site-packages (from paconn==0.0.15) (20.2.1)
Requirement already satisfied: azure-storage-blob<12.0,>=2.1 in /nix/store/73hyiy92cwdfhr4qx2n4zz94b6f1h75v-python3.8-azure-storage-blob-2.1.0/lib/python3.8/site-packages (from paconn==0.0.15) (2.1.0)
Requirement already satisfied: requests in /nix/store/xm2xq38f1q2ncy3ilra6ddppdswmvwsb-python3.8-requests-2.25.0/lib/python3.8/site-packages (from paconn==0.0.15) (2.25.0)
Requirement already satisfied: msrestazure in /nix/store/s2kc05clcf6sias5s02hmawlind5qi2j-python3.8-msrestazure-0.6.4/lib/python3.8/site-packages (from paconn==0.0.15) (0.6.4)
ERROR: Could not find a version that satisfies the requirement pylint~=2.0.0; python_version >= "3.0" (from paconn==0.0.15) (from versions: none)
ERROR: No matching distribution found for pylint~=2.0.0; python_version >= "3.0" (from paconn==0.0.15)
builder for '/nix/store/vidfc9rjpspa1jp5kyglh393j4xpq76g-python3.8-paconn-0.0.15.drv' failed with exit code 1
error: build of '/nix/store/vidfc9rjpspa1jp5kyglh393j4xpq76g-python3.8-paconn-0.0.15.drv' failed
And this is the setup.py
:
install_requires=[
'docutils',
'flake8',
'future',
'knack~=0.5.1',
'pytest',
'pytest-xdist',
'virtualenv',
'requests',
'adal',
'msrestazure',
'azure-storage-blob>=2.1,<12.0'
],
extras_require={
":python_version<'3.0'": ['pylint~=1.9.2'],
":python_version>='3.0'": ['pylint~=2.0.0']
}
All the install_requirements
were installed successfully byt the pylint
at the extra_requirements
is failing. To be honest, I don’t need that file because I want the application. There is any way to solve this problem or ignore/remove that package from the install process?
brogos
December 7, 2020, 5:05pm
4
Hi @pmjoe , I don’t know if it’s the right way to remove pylint from requirements, but I did this way:
pacon = mach-nix.buildPythonApplication rec {
pname = "paconn";
version = "0.0.15";
src = mach-nix.nixpkgs.python3Packages.fetchPypi {
inherit pname version;
sha256 = "0m2d4amjlyv4kdkxchkfqnyb0h8d289fwv1zgfxyyrwc953n2zfi";
};
postUnpack = ''
substituteInPlace paconn*/setup.py --replace 'pylint~=2.0.0' ' '
'';
};
I just added the postUnpack
replacing pylint~=2.0.0
with ' '
. Maybe @DavHau know a better way to do that.
DavHau
December 7, 2020, 5:35pm
5
Mach-nix does not yet interpret extras with environment markers inside their key like :python_version>='3.0'
.
But you can just add the missing requirement by using requirementsExtra
.
Also you can omit pname
, version
and use mach-nix.fetchPypiSdist
:
mach-nix.buildPythonApplication rec {
src = mach-nix.fetchPypiSdist "paconn" "0.0.15";
requirementsExtra = "pylint~=2.0.0";
}
1 Like