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

Devenv doesn't seem to copy or link my opengl libraries #1617

Closed
CapedBojji opened this issue Nov 26, 2024 · 9 comments
Closed

Devenv doesn't seem to copy or link my opengl libraries #1617

CapedBojji opened this issue Nov 26, 2024 · 9 comments
Labels
question Further information is requested

Comments

@CapedBojji
Copy link

Describe the bug
A clear and concise description of what the bug is.

To reproduce
Please provide an Short, Self Contained, Correct (Compilable), Example by creating a gist using devenv.nix, devenv.yaml, and optionally devenv.lock.

Make sure to include full logs and what you expected to happen.

devenv.nix

  languages.python = {
    enable = true;
    version = "3.12.7"; 
    venv.enable = false;
    venv.requirements = ./requirements.txt;
  };

devenv.yaml

inputs:
  nixpkgs:
    url: github:cachix/devenv-nixpkgs/rolling
  nixpkgs-python:
    url: github:cachix/nixpkgs-python
    inputs:
      nixpkgs:
        follows: nixpkgs
inputs:
  nixpkgs:
    url: github:cachix/devenv-nixpkgs/rolling
  nixpkgs-python:
    url: github:cachix/nixpkgs-python
    inputs:
      nixpkgs:
        follows: nixpkgs

devenv.lock


{
  "nodes": {
    "devenv": {
      "locked": {
        "dir": "src/modules",
        "lastModified": 1732460433,
        "owner": "cachix",
        "repo": "devenv",
        "rev": "6f9f633c50265c836aa685feefe15ea2a8865d28",
        "type": "github"
      },
      "original": {
        "dir": "src/modules",
        "owner": "cachix",
        "repo": "devenv",
        "type": "github"
      }
    },
    "flake-compat": {
      "flake": false,
      "locked": {
        "lastModified": 1696426674,
        "owner": "edolstra",
        "repo": "flake-compat",
        "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
        "type": "github"
      },
      "original": {
        "owner": "edolstra",
        "repo": "flake-compat",
        "type": "github"
      }
    },
    "flake-compat_2": {
      "flake": false,
      "locked": {
        "lastModified": 1696426674,
        "owner": "edolstra",
        "repo": "flake-compat",
        "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
        "type": "github"
      },
      "original": {
        "owner": "edolstra",
        "repo": "flake-compat",
        "type": "github"
      }
    },
    "gitignore": {
      "inputs": {
        "nixpkgs": [
          "pre-commit-hooks",
          "nixpkgs"
        ]
      },
      "locked": {
        "lastModified": 1709087332,
        "owner": "hercules-ci",
        "repo": "gitignore.nix",
        "rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
        "type": "github"
      },
      "original": {
        "owner": "hercules-ci",
        "repo": "gitignore.nix",
        "type": "github"
      }
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1716977621,
        "owner": "cachix",
        "repo": "devenv-nixpkgs",
        "rev": "4267e705586473d3e5c8d50299e71503f16a6fb6",
        "type": "github"
      },
      "original": {
        "owner": "cachix",
        "ref": "rolling",
        "repo": "devenv-nixpkgs",
        "type": "github"
      }
    },
    "nixpkgs-python": {
      "inputs": {
        "flake-compat": "flake-compat",
        "nixpkgs": [
          "nixpkgs"
        ]
      },
      "locked": {
        "lastModified": 1730716553,
        "owner": "cachix",
        "repo": "nixpkgs-python",
        "rev": "8fcdb8ec34a1c2bae3f5326873a41b310e948ccc",
        "type": "github"
      },
      "original": {
        "owner": "cachix",
        "repo": "nixpkgs-python",
        "type": "github"
      }
    },
    "nixpkgs-stable": {
      "locked": {
        "lastModified": 1731797254,
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "e8c38b73aeb218e27163376a2d617e61a2ad9b59",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "nixos-24.05",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "pre-commit-hooks": {
      "inputs": {
        "flake-compat": "flake-compat_2",
        "gitignore": "gitignore",
        "nixpkgs": [
          "nixpkgs"
        ],
        "nixpkgs-stable": "nixpkgs-stable"
      },
      "locked": {
        "lastModified": 1732021966,
        "owner": "cachix",
        "repo": "pre-commit-hooks.nix",
        "rev": "3308484d1a443fc5bc92012435d79e80458fe43c",
        "type": "github"
      },
      "original": {
        "owner": "cachix",
        "repo": "pre-commit-hooks.nix",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "devenv": "devenv",
        "nixpkgs": "nixpkgs",
        "nixpkgs-python": "nixpkgs-python",
        "pre-commit-hooks": "pre-commit-hooks"
      }
    }
  },
  "root": "root",
  "version": 7
}

requirements.txt

imgui==2.0.0




**Version**
 devenv 1.3.1 (x86_64-linux)
Paste the output of `$ devenv version` here or tell us if you're using flakes.

@CapedBojji CapedBojji added the bug Something isn't working label Nov 26, 2024
@sandydoo
Copy link
Member

@CapedBojji, could you describe your issue in a bit more detail?

  • what are you trying to do?
  • what do you expect to happen?
  • which libraries? copy or link to where?

@sandydoo sandydoo added question Further information is requested and removed bug Something isn't working labels Nov 27, 2024
@CapedBojji
Copy link
Author

CapedBojji commented Nov 27, 2024

@sandydoo im trying to use imgui with devenv python, but since devenv isnt linking the libgl.so files it doesnt work. i tried adding the necessary pkgs but it still doesn't work

  packages = [ pkgs.git pkgs.glfw pkgs.glew pkgs.mesa pkgs.libGL pkgs.wayland pkgs.libcxx pkgs.libxkbcommon];

im basically forced to use nixGL if i want to work with python gui. Doesn't make sense that devenv won't by default link the necessary files

@sandydoo
Copy link
Member

Do you have a sample project or repro you can share?

With packages = [ pkgs.libGL ]; and imgui in requirements, I can import imgui and can successfully:

$ python -c "from ctypes.util import find_library;print(find_library('GL'))"
libGL.so.1

What am I looking for?

@CapedBojji
Copy link
Author

https://github.com/CapedBojji/amazon-vet-bot
@sandydoo here you go simply just run the main.py

@CapedBojji
Copy link
Author

@sandydoo yeah i forgot to update you. It says they exist now but now i get

/home/freren/projects/devenv-python/.devenv/state/venv/lib/python3.11/site-packages/glfw/__init__.py:917: GLFWError: (65542) b'EGL: Failed to get EGL display: Success'
  warnings.warn(message, GLFWError)

@CapedBojji
Copy link
Author

also to note getting ride of venv = trueand using my own system venv fixes the issue but thats because the venv on my system can see the files i suppose.

@sandydoo
Copy link
Member

Changing pkgs.libGLU -> pkgs.libGL, I get to the point where glfw fails to initialize the EGL display. But I'm running in a VM, so I have zero trust in glfw launching at all.

also to note getting ride of venv = trueand using my own system venv fixes the issue but thats because the venv on my system can see the files i suppose.

I'm not really sure why the venv would be the issue. You could try diffing your two venvs, maybe with printenv, and see what's different between the two.

This does seem more like an issue with finding the right driver. If it were about libGL, you wouldn't be able to import OpenGL.GL. If nixGL works for you, then you could try adding /run/opengl-drivers/lib to your LD_LIBRARY_PATH: LD_LIBRARY_PATH=/run/opengl-drivers/lib python main.py. Then double-check it was set in python: print(os.environ["LD_LIBRARY_PATH"]).

@CapedBojji
Copy link
Author

i noticed i didnt have /run/opengl but that isnt neccessary as it was working in any non devenv direcotry

@CapedBojji CapedBojji reopened this Dec 1, 2024
@CapedBojji
Copy link
Author

Reopened to say the error was vscode not devenv it seems. At least on nixos. On nix you have to use nix gl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants