Open tobiasBora opened 2 years ago
You need to use mach-nix.mkPythonShell
:
let
mach-nix = import (builtins.fetchGit {
url = "https://github.com/DavHau/mach-nix/";
# place version number with the latest one from the github releases page
ref = "refs/tags/3.4.0";
}) {};
in
mach-nix.mkPythonShell {
# contents of a requirements.txt (use builtins.readFile ./requirements.txt alternatively)
requirements = ''
camelot-py
'';
}
Oh, sorry, thanks. So I tried to do that, but then I get an error can't import cv2
. However, if I install opencv
manually, then I get another issue here. But, when looking at the doc, pip specifies that we need to install camelot-py[base]
(no idea if base
must be replaced with anything). But if I use:
let
mach-nix = import (builtins.fetchGit {
url = "https://github.com/DavHau/mach-nix/";
# place version number with the latest one from the github releases page
ref = "refs/tags/3.4.0";
}) {};
in
mach-nix.mkPythonShell {
# contents of a requirements.txt (use builtins.readFile ./requirements.txt alternatively)
requirements = ''
camelot-py[base]
'';
ignoreCollisions = true;
}
then the system stays forever in the state pythonImportsCheckPhase
:
Finished executing pythonRemoveTestsDir
pythonCatchConflictsPhase
pythonRemoveBinBytecodePhase
pythonImportsCheckPhase
Executing pythonImportsCheckPhase
I tried to use:
let
mach-nix = import (builtins.fetchGit {
url = "https://github.com/DavHau/mach-nix/";
# place version number with the latest one from the github releases page
ref = "refs/tags/3.4.0";
}) {};
in
mach-nix.mkPythonShell {
# contents of a requirements.txt (use builtins.readFile ./requirements.txt alternatively)
requirements = ''
camelot-py[base]
'';
ignoreCollisions = true;
dontUsePythonImportsCheck = true;
}
to avoid that, but apparently dontUsePythonImportsCheck
can't be used this way…
Interesting, you first shell.nix
worked for me, even without ignoreCollisions = true
.
I finally got a working solution:
let
mach-nix = import (builtins.fetchGit {
url = "https://github.com/DavHau/mach-nix/";
# place version number with the latest one from the github releases page
ref = "refs/tags/3.4.0";
}) {};
in
mach-nix.mkPythonShell {
# contents of a requirements.txt (use builtins.readFile ./requirements.txt alternatively)
requirements = ''
camelot-py[base]
'';
ignoreCollisions = true;
_.pdftopng.dontUsePythonImportsCheck = true;
}
Not sure why dontUsePythonImportsCheck
is required to avoid the freeze…
$ python3
Python 3.9.9 (main, Nov 15 2021, 18:05:17)
[GCC 10.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import camelot
>>>
I tried to use mach-nix to load camelot… but it seems that it's not working as I get an error
ModuleNotFoundError: No module named 'camelot'
. Am I just doing something wrong (in which case it may worth updating the documentation), or is it something else?