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

ModuleNotFoundError: No module named 'setuptools' #2

Closed
Kukkerem opened this issue Sep 4, 2023 · 2 comments
Closed

ModuleNotFoundError: No module named 'setuptools' #2

Kukkerem opened this issue Sep 4, 2023 · 2 comments

Comments

@Kukkerem
Copy link

Kukkerem commented Sep 4, 2023

Hello,

I'm impressed by your project and wanted to try it out on an existing tool to have a more stable docker image build, which sometimes fails for some reason. I have tried using your example and this very fresh repo to move on, but I need to figure out how to solve a persistent error.

After the project creation, I can use nix develop to add dependencies to poetry on the command line and run poetry build without a problem. Still, after I'm trying to rerun nix develop or use nix build, I'm getting this error:

$ nix build
error: builder for '/nix/store/rx8kcm1qm64i49ndavicpb6n9pm7c227-python3.11-webdriver-manager-4.0.0.drv' failed with exit code 2;
       last 10 log lines:
       >   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
       >   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
       >   File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
       >   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
       >   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
       >   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
       >   File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
       > ModuleNotFoundError: No module named 'setuptools'

The current modifications are on this branch:
https://github.com/Kukkerem/lightnovel-crawler/tree/nix-cde

I have tried to install setuptools with dev_commandsa and dev_apps and modified the build-system requirements in the pyproject.toml file. I don't have any other ideas/leads.

Could you please help me with this issue?

@takeda
Copy link
Owner

takeda commented Sep 4, 2023

So this is somewhat common issue with nix and it is due to build dependencies needing to be specified.

To get yourself unblocked you can add override:

  python = {
    enable = true;
    ...
    overrides = self: super: {
      webdriver-manager = super.webdriver-manager.overridePythonAttrs (old: {
        nativeBuildInputs = (old.nativeBuildInputs or []) ++ [
          self.setuptools
        ];
      });
    };
  }

Long term fix would be to make a PR and modify: https://github.com/nix-community/poetry2nix/blob/master/overrides/build-systems.json

Once I bump versions in flake.lock (or you have your branch updated) then above override won't be needed anymore.

If you don't want to create own branch. You could also add to flake.nix:

{
    inputs = {
      ...
      poetry2nix.url = "github:nix-community/poetry2nix";
      nix-cde.inputs.poetry2nix.follows = "poetry2nix";
    };
};

@Kukkerem
Copy link
Author

Kukkerem commented Sep 5, 2023

It's working with overrides, and I will probably contribute it to poetry2nix. Thank you very much!

@takeda takeda closed this as completed Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants