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 'distutils' #24

Closed
mceachen opened this issue Oct 24, 2023 · 1 comment
Closed

ModuleNotFoundError: No module named 'distutils' #24

mceachen opened this issue Oct 24, 2023 · 1 comment

Comments

@mceachen
Copy link

@kingjan1999 thanks for taking the time to write these bindings! 🎉 🥇

This library installs and works great on Linux, but Windows (node v18 and v20) seem to have issues due to python missing the "distutils" package:

$ yarn add platform-folders # (or `npm i platform-folders`) 
yarn add v1.22.19
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error C:\Users\matth\AppData\Local\Temp\test\node_modules\platform-folders: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: C:\Users\matth\AppData\Local\Temp\test\node_modules\platform-folders
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info find Python using Python version 3.12.0 found at "C:\Python312\python.exe"
gyp info find VS using VS2022 (17.7.34202.233) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Python312\python.exe
gyp info spawn args [
gyp info spawn args   'C:\\Users\\matth\\AppData\\Local\\Yarn\\Data\\global\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\matth\\AppData\\Local\\Temp\\test\\node_modules\\platform-folders\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\matth\\AppData\\Local\\Yarn\\Data\\global\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\matth\\AppData\\Local\\node-gyp\\Cache\\20.8.1\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\matth\\AppData\\Local\\node-gyp\\Cache\\20.8.1',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\matth\\AppData\\Local\\Yarn\\Data\\global\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\matth\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\20.8.1\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\matth\\AppData\\Local\\Temp\\test\\node_modules\\platform-folders',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\Users\\matth\\AppData\\Local\\Temp\\test\\node_modules\\platform-folders\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
Traceback (most recent call last):
  File "C:\Users\matth\AppData\Local\Yarn\Data\global\node_modules\node-gyp\gyp\gyp_main.py", line 42, in <module>
    import gyp  # noqa: E402
    ^^^^^^^^^^
  File "C:\Users\matth\AppData\Local\Yarn\Data\global\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 9, in <module>
    import gyp.input
  File "C:\Users\matth\AppData\Local\Yarn\Data\global\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 19, in <module>
    from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Users\matth\AppData\Local\Yarn\Data\global\node_modules\node-gyp\lib\configure.js:325:16)
gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
gyp ERR! System Windows_NT 10.0.22621
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\matth\\AppData\\Local\\Yarn\\Data\\global\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\matth\AppData\Local\Temp\test\node_modules\platform-folders
gyp ERR! node -v v20.8.1
gyp ERR! node-gyp -v v9.4.0
gyp ERR! not ok
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

This seems to be a regression from node-gyp. I'll dig into it a bit.

@mceachen
Copy link
Author

mceachen commented Oct 24, 2023

Yup: nodejs/node-gyp#2915

(Solution if anyone else finds this: run pip install setuptools)

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

1 participant