Pierre-olivier Gendraud
Pierre-olivier Gendraud

Reputation: 1927

Why can't Mesop find the google package even though I added it to the flake?

My flake:

{
 description = "mesop";

 inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
 inputs.flake-utils.url = "github:numtide/flake-utils";

 outputs = { self, nixpkgs, flake-utils, ... }:
    flake-utils.lib.eachDefaultSystem (system: let
      pkgs = nixpkgs.legacyPackages.${system};
      
      mesop = with pkgs.python3Packages;
        buildPythonPackage rec {
        pname = "mesop";
        version = "0.8.0";
        format = "wheel";
            src = pkgs.python3Packages.fetchPypi rec {
                inherit pname version format;
                sha256 = "f156bf53f672588339b2be461017aecda860b9ffca15c86553f76255dd882670";
                dist = python;
            python = "py3";
            };
        };
   
      pythonEnv = pkgs:
        pkgs.python3.withPackages (ps:
          with ps; [
             mesop
             absl-py 
             flask
             google
          ]);
    in {
      devShells.default = pkgs.mkShell {
        buildInputs = with pkgs; [
          curl
          (pythonEnv pkgs)
        ];
      };
    });
}

I need the google package (https://search.nixos.org/packages?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=google )to use the command mesop. I added it. I ran the flake successfully.

  nix develop

But when I tried to run the command mesop.

   mesop

I got this problem:

Traceback (most recent call last): File "/nix/store/2f1faid63zawdgnmg7hn51mqwndn8gkk-python3.11-mesop-0.8.0/bin/.mesop-wrapped", line 6, in from mesop.bin.bin import run_main File "/nix/store/ywsz5bbhkfgb0lh4xyxhpsc731c8labg-python3-3.11.9-env/lib/python3.11/site-packages/mesop/init.py", line 5, in from mesop.colab.colab_run import colab_run as colab_run File "/nix/store/ywsz5bbhkfgb0lh4xyxhpsc731c8labg-python3-3.11.9-env/lib/python3.11/site-packages/mesop/colab/colab_run.py", line 6, in from mesop.runtime import enable_debug_mode File "/nix/store/ywsz5bbhkfgb0lh4xyxhpsc731c8labg-python3-3.11.9-env/lib/python3.11/site-packages/mesop/runtime/init.py", line 1, in from .runtime import ( File "/nix/store/ywsz5bbhkfgb0lh4xyxhpsc731c8labg-python3-3.11.9-env/lib/python3.11/site-packages/mesop/runtime/runtime.py", line 6, in import mesop.protos.ui_pb2 as pb File "/nix/store/ywsz5bbhkfgb0lh4xyxhpsc731c8labg-python3-3.11.9-env/lib/python3.11/site-packages/mesop/protos/ui_pb2.py", line 5, in from google.protobuf.internal import builder as _builder ModuleNotFoundError: No module named 'google'

Upvotes: 0

Views: 160

Answers (2)

user25009716
user25009716

Reputation: 196

According to the error message ModuleNotFoundError: No module named 'google' and the same issue from importerror-no-module-named-google. Suggest you can try to add the package google-api-python-client that maybe can solve the issue.

{
 description = "mesop";

 inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
 inputs.flake-utils.url = "github:numtide/flake-utils";

 outputs = { self, nixpkgs, flake-utils, ... }:
    flake-utils.lib.eachDefaultSystem (system: let
      pkgs = nixpkgs.legacyPackages.${system};
      
      mesop = with pkgs.python3Packages;
        buildPythonPackage rec {
        pname = "mesop";
        version = "0.8.0";
        format = "wheel";
            src = pkgs.python3Packages.fetchPypi rec {
                inherit pname version format;
                sha256 = "f156bf53f672588339b2be461017aecda860b9ffca15c86553f76255dd882670";
                dist = python;
            python = "py3";
            };
        };
   
      pythonEnv = pkgs:
        pkgs.python3.withPackages (ps:
          with ps; [
             mesop
             absl-py 
             flask
             google
             google-api-python-client
          ]);
    in {
      devShells.default = pkgs.mkShell {
        buildInputs = with pkgs; [
          curl
          (pythonEnv pkgs)
        ];
      };
    });
}

Upvotes: 1

Pierre-olivier Gendraud
Pierre-olivier Gendraud

Reputation: 1927

I needed to added to add the package package google-api-python-client to solve the problem. After that others problems occurs and because I have to add others package. But the error messages said cleary what to install.

The whole final flake who works:

{
 description = "mesop";

 inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
 inputs.flake-utils.url = "github:numtide/flake-utils";

 outputs = { self, nixpkgs, flake-utils, ... }:
    flake-utils.lib.eachDefaultSystem (system: let
      pkgs = nixpkgs.legacyPackages.${system};
      
      mesop = with pkgs.python3Packages;
        buildPythonPackage rec {
        pname = "mesop";
        version = "0.8.0";
        format = "wheel";
            src = pkgs.python3Packages.fetchPypi rec {
                inherit pname version format;
                sha256 = "f156bf53f672588339b2be461017aecda860b9ffca15c86553f76255dd882670";
                dist = python;
            python = "py3";
            };
        };
   
      pythonEnv = pkgs:
        pkgs.python3.withPackages (ps:
          with ps; [
             mesop
             absl-py 
             flask
             google
             google-api-python-client
             deepdiff
             pydantic
             libcst
             markdown
             watchdog
          ]);
    in {
      devShells.default = pkgs.mkShell {
        buildInputs = with pkgs; [
          curl
          (pythonEnv pkgs)
        ];
      };
    });
}

Upvotes: 0

Related Questions