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

Cannot have OpenCV binding for python 2 and python 3 active at the same time #45506

Closed
tolstikh opened this issue Aug 23, 2018 · 1 comment
Closed

Comments

@tolstikh
Copy link

Issue description

I would like to have python bindings accessible to Python 2 and Python3 at the same time.

I can make the bindings work in Python 2 and Python 3 individually, but not at the same time.

Steps to reproduce

expression:

with import <nixpkgs> {};
stdenv.mkDerivation rec {
  name = "env";
  env = buildEnv { name = name; paths = buildInputs; };
  buildInputs = [
    python27
    python27Packages.opencv3
    python36
    python36Packages.opencv3
  ];
}

then run

$ nix-shell
[nix-shell:~/env]$ python2 -c "import cv2"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named cv2
[nix-shell:~/env]$ python3 -c "import cv2"
[nix-shell:~/env]$

Technical details

Please run nix-shell -p nix-info --run "nix-info -m" and paste the
results.

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 4.15.0-32-generic, Ubuntu, 16.04.5 LTS (Xenial Xerus)`
 - multi-user?: `no`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.0.4`
 - channels(user): `"nixpkgs-18.09pre147772.d1ae60cbad7"`
 - nixpkgs: `/home/user/.nix-defexpr/channels/nixpkgs`
@dotlambda
Copy link
Member

Just as the manual tells you, you sould always use python.withPackages.

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

No branches or pull requests

2 participants