nix-shell -p opencv4 python3, then opening a Python shell and trying to import
cv2, but to no avail.
I’m not sure I understand. So the bindings inside OpenCV itself aren’t Python 3.7 compatible. But https://pypi.org/project/opencv-python/ seems to be. That, however, isn’t included in
Edit: Got it,
nix-shell -p python3Packages.opencv4 seems to work.
pkgs/development/python-modules/baselines/default.nix: # in nixos anyways. Since opencv-python is not currently packaged, we pkgs/development/python-modules/baselines/default.nix: sed -ie '/opencv-python/d' setup.py pkgs/development/python-modules/imgaug/default.nix: broken = true; # opencv-python bindings aren't available yet, and look non-trivial
However, this command doesn’t fail:
$ nix-shell --packages python3Packages.opencv4 --run 'python -c "import cv2"'
What’s so confusing is that
python3Packages.opencv4 has nothing to do with the pypi package
opencv-python, these are too different packages and the later isn’t packaged yet. In a
python3Packages.opencv4 you can see by looking at the values of
$PYTHONPATH that it includes:
And inside this folder you can find a file:
This file can be imported to Python directly through
import cv2 and it comes out of the
opencv4 package. See: