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

distutils is removed in Python 3.12 #2869

Closed
cclauss opened this issue Jun 13, 2023 · 33 comments · Fixed by #2923
Closed

distutils is removed in Python 3.12 #2869

cclauss opened this issue Jun 13, 2023 · 33 comments · Fixed by #2923

Comments

@cclauss
Copy link
Contributor

cclauss commented Jun 13, 2023

EDIT: This issue was closed via nodejs/gyp-next#214 which is available in node-gyp v10+.


distutils is deprecated with removal planned for Python 3.12. See the What’s New entry for more information.

Our only current use of Python distutils is at:

from distutils.version import StrictVersion

env = {"__builtins__": {}, "v": StrictVersion}

As discussed in https://stackoverflow.com/questions/11887762, we should replace distutils.version.StrictVersion with packaging.version.parse.

@cclauss
Copy link
Contributor Author

cclauss commented Jul 24, 2023

@rzhao271 or @dhruvmanila -- Any interest in fixing this one?

@rzhao271
Copy link
Contributor

I'm interested, though it'll have to be on my own time.

@cclauss
Copy link
Contributor Author

cclauss commented Jul 26, 2023

#2888 Needs help to pass test…

@cclauss
Copy link
Contributor Author

cclauss commented Aug 25, 2023

This is becoming more urgent now that Python 3.12 is a release candidate.

@sibelius
Copy link

this is breaking for me

@cclauss
Copy link
Contributor Author

cclauss commented Aug 31, 2023

Py3.12 is still pre-release. Please try to copy the pylib/gyp/input.py changes from nodejs/gyp-next#201 and let us know if that unblocks you.

@nikolay
Copy link

nikolay commented Oct 2, 2023

@cclauss Python 3.12 got released and now node-gyp works no more!

@rzhao271
Copy link
Contributor

rzhao271 commented Oct 2, 2023

The upstream fix still hasn't been merged nodejs/gyp-next#197

@Steveorevo
Copy link

Steveorevo commented Oct 4, 2023

This is also broken for me. Simply create an electron forge app and then attempt to use something trivial like:

require('deasync').sleep(1000);
console.log('Hello world');

I'm greeted with:

File node_modules\node-gyp\gyp\pylib\gyp\input.py", line 19, in <module>
  from distutils.version import StrictVersion
  ModuleNotFoundError: No module named 'distutils'
  Error: `gyp` failed with exit code: 1
  
An unhandled rejection has occurred inside Forge:
Error: node-gyp failed to rebuild '... \resources\app\node_modules\deasync'

@cclauss
Copy link
Contributor Author

cclauss commented Oct 4, 2023

@rzhao271 @dhruvmanila @zooba Node.js node-gyp is still broken on Python 3.12 on Windows. See these attempts to fix #2869 (comment). I am not a Windows person so I cannot debug.

@jurijsk
Copy link

jurijsk commented Oct 4, 2023

Python 3.12 released on Oct 2nd and got it by default with other tooling and nothing is working now because distutils is removed

@nikolay
Copy link

nikolay commented Oct 4, 2023

@jurijsk It's sad, as we knew Python was removing it and have done nothing about it!

@pplmx
Copy link

pplmx commented Oct 16, 2023

Any progress? On Windows, node-gyp cannot work on Python 3.12 now.

@GorlikItsMe
Copy link

Same issue here (Windows, python 3.12.0)

@birdzai
Copy link

birdzai commented Oct 17, 2023

Doesn't work on Mac either

@iki
Copy link

iki commented Oct 18, 2023

The upstream fix still hasn't been merged nodejs/gyp-next#197

@rzhao271 upstream was merged since that

🤖 Release is at https://github.com/nodejs/gyp-next/releases/tag/v0.15.1 🌻

@cclauss
Copy link
Contributor Author

cclauss commented Oct 18, 2023

I will work on vendoring in packaging today.

@cclauss
Copy link
Contributor Author

cclauss commented Oct 18, 2023

EDIT: This advice was for node-gyp < v10 but is not required for later versions.

If some of you are frustrated then please do python3 -m pip install packaging and report back here if that fixes things.

Other activities blocked vendoring effort today but I will dig in with my first coffee tomorrow.

orgads added a commit to orgads/isolated-vm that referenced this issue Jan 16, 2024
laverdet pushed a commit to laverdet/isolated-vm that referenced this issue Jan 16, 2024
* Fix compilation

Amends commit 7f70d25.

* CI: Workaround node-gyp issue

nodejs/node-gyp#2869
shr-project added a commit to webOS-ports/meta-webos-ports that referenced this issue Jan 19, 2024
* recipes using node-gyp-native fail to build after python3 was updated to 3.12 in:
  https://git.openembedded.org/openembedded-core/commit/?id=716d82352545d3667a658b69d65d6127678dd150

* we need the fix from:
  nodejs/node-gyp#2869

Signed-off-by: Martin Jansa <[email protected]>
shr-project added a commit to webOS-ports/meta-webos-ports that referenced this issue Jan 19, 2024
* recipes using node-gyp-native fail to build after python3 was updated to 3.12 in:
  https://git.openembedded.org/openembedded-core/commit/?id=716d82352545d3667a658b69d65d6127678dd150

* we need the fix from:
  nodejs/node-gyp#2869

Signed-off-by: Martin Jansa <[email protected]>
shr-project added a commit to shr-project/meta-webosose that referenced this issue Jan 19, 2024
:Release Notes:
recipes using node-gyp-native fail to build after python3 was updated to 3.12 in:
https://git.openembedded.org/openembedded-core/commit/?id=716d82352545d3667a658b69d65d6127678dd150

:Detailed Notes:
we need the fix from:
nodejs/node-gyp#2869

Fixes:
nodejs-module-webos-sysbus   http://gecko.lge.com:8000/Errors/Details/763462
nodejs-module-webos-pmlog    http://gecko.lge.com:8000/Errors/Details/763463
nodejs-module-webos-dynaload http://gecko.lge.com:8000/Errors/Details/763464

Traceback (most recent call last):
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
    import gyp  # noqa: E402
    ^^^^^^^^^^
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>
    import gyp.input
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>
    from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils'

:Testing Performed:
Only build tested.

:QA Notes:
No change to image.

:Issues Addressed:
[WRP-29491] Create GPVB with Yocto 5.0 Scarthgap

Change-Id: I5bbcf7246499edfaa6141890c70d0a7a257be36f
shr-project added a commit to webOS-ports/meta-webos-ports that referenced this issue Jan 19, 2024
* recipes using node-gyp-native fail to build after python3 was updated to 3.12 in:
  https://git.openembedded.org/openembedded-core/commit/?id=716d82352545d3667a658b69d65d6127678dd150

* we need the fix from:
  nodejs/node-gyp#2869

Signed-off-by: Martin Jansa <[email protected]>
shr-project added a commit to shr-project/meta-webosose that referenced this issue Jan 24, 2024
:Release Notes:
recipes using node-gyp-native fail to build after python3 was updated to 3.12 in:
https://git.openembedded.org/openembedded-core/commit/?id=716d82352545d3667a658b69d65d6127678dd150

:Detailed Notes:
we need the fix from:
nodejs/node-gyp#2869

Fixes:
nodejs-module-webos-sysbus   http://gecko.lge.com:8000/Errors/Details/763462
nodejs-module-webos-pmlog    http://gecko.lge.com:8000/Errors/Details/763463
nodejs-module-webos-dynaload http://gecko.lge.com:8000/Errors/Details/763464

Traceback (most recent call last):
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
    import gyp  # noqa: E402
    ^^^^^^^^^^
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>
    import gyp.input
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>
    from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils'

:Testing Performed:
Only build tested.

:QA Notes:
No change to image.

:Issues Addressed:
[WRP-29491] Create GPVB with Yocto 5.0 Scarthgap

Change-Id: I5bbcf7246499edfaa6141890c70d0a7a257be36f
@martin-braun
Copy link

EDIT: This advice was for node-gyp < v10 but is not required for later versions.

If some of you are frustrated then please do python3 -m pip install packaging and report back here if that fixes things.

Other activities blocked vendoring effort today but I will dig in with my first coffee tomorrow.

Wasn't working for me in the case of installing @signalapp/better-sqlite3, but doing pip install setuptools solved it for me.

WiseLibs/better-sqlite3#1093

@voidmain443
Copy link

I am using python3.12 for venv and I have a same problem with execute pandas_datareader.

@cclauss
Copy link
Contributor Author

cclauss commented Feb 2, 2024

Please look at your error log and ensure it contains the line gyp info using [email protected].

Some have said that pip install setuptools is a quick fix.


https://github.com/pydata/pandas-datareader has not been released to PyPI since 2021 and is currently failing its Continuous Integration tests so you will need to seek help on that repo...

shr-project added a commit to shr-project/meta-webosose that referenced this issue Feb 3, 2024
:Release Notes:
recipes using node-gyp-native fail to build after python3 was updated to 3.12 in:
https://git.openembedded.org/openembedded-core/commit/?id=716d82352545d3667a658b69d65d6127678dd150

:Detailed Notes:
we need the fix from:
nodejs/node-gyp#2869

Fixes:
nodejs-module-webos-sysbus   http://gecko.lge.com:8000/Errors/Details/763462
nodejs-module-webos-pmlog    http://gecko.lge.com:8000/Errors/Details/763463
nodejs-module-webos-dynaload http://gecko.lge.com:8000/Errors/Details/763464

Traceback (most recent call last):
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
    import gyp  # noqa: E402
    ^^^^^^^^^^
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>
    import gyp.input
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>
    from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils'

:Testing Performed:
Only build tested.

:QA Notes:
No change to image.

:Issues Addressed:
[WRP-29491] Create GPVB with Yocto 5.0 Scarthgap

Change-Id: I5bbcf7246499edfaa6141890c70d0a7a257be36f
shr-project added a commit to shr-project/meta-webosose that referenced this issue Feb 6, 2024
:Release Notes:
recipes using node-gyp-native fail to build after python3 was updated to 3.12 in:
https://git.openembedded.org/openembedded-core/commit/?id=716d82352545d3667a658b69d65d6127678dd150

:Detailed Notes:
we need the fix from:
nodejs/node-gyp#2869

Fixes:
nodejs-module-webos-sysbus   http://gecko.lge.com:8000/Errors/Details/763462
nodejs-module-webos-pmlog    http://gecko.lge.com:8000/Errors/Details/763463
nodejs-module-webos-dynaload http://gecko.lge.com:8000/Errors/Details/763464

Traceback (most recent call last):
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
    import gyp  # noqa: E402
    ^^^^^^^^^^
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>
    import gyp.input
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>
    from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils'

:Testing Performed:
Only build tested.

:QA Notes:
No change to image.

:Issues Addressed:
[WRP-29491] Create GPVB with Yocto 5.0 Scarthgap

Change-Id: I5bbcf7246499edfaa6141890c70d0a7a257be36f
shr-project added a commit to shr-project/meta-webosose that referenced this issue Feb 7, 2024
:Release Notes:
recipes using node-gyp-native fail to build after python3 was updated to 3.12 in:
https://git.openembedded.org/openembedded-core/commit/?id=716d82352545d3667a658b69d65d6127678dd150

:Detailed Notes:
we need the fix from:
nodejs/node-gyp#2869

Fixes:
nodejs-module-webos-sysbus   http://gecko.lge.com:8000/Errors/Details/763462
nodejs-module-webos-pmlog    http://gecko.lge.com:8000/Errors/Details/763463
nodejs-module-webos-dynaload http://gecko.lge.com:8000/Errors/Details/763464

Traceback (most recent call last):
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
    import gyp  # noqa: E402
    ^^^^^^^^^^
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>
    import gyp.input
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>
    from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils'

:Testing Performed:
Only build tested.

:QA Notes:
No change to image.

:Issues Addressed:
[WRP-29491] Create GPVB with Yocto 5.0 Scarthgap

Change-Id: I5bbcf7246499edfaa6141890c70d0a7a257be36f
@federicoWax
Copy link

federicoWax commented Feb 15, 2024

pip install setuptools

Tengo dos semanas buscando el bug porque no podia correr tensorflow/tfjs muchas gracias!

I've been looking for this solution for two weeks because I couldn't run tensorflow/tfjs, thank you very much!

shr-project added a commit to shr-project/meta-webosose that referenced this issue Feb 21, 2024
:Release Notes:
recipes using node-gyp-native fail to build after python3 was updated to 3.12 in:
https://git.openembedded.org/openembedded-core/commit/?id=716d82352545d3667a658b69d65d6127678dd150

:Detailed Notes:
we need the fix from:
nodejs/node-gyp#2869

Fixes:
nodejs-module-webos-sysbus   http://gecko.lge.com:8000/Errors/Details/763462
nodejs-module-webos-pmlog    http://gecko.lge.com:8000/Errors/Details/763463
nodejs-module-webos-dynaload http://gecko.lge.com:8000/Errors/Details/763464

Traceback (most recent call last):
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
    import gyp  # noqa: E402
    ^^^^^^^^^^
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>
    import gyp.input
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>
    from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils'

:Testing Performed:
Only build tested.

:QA Notes:
No change to image.

:Issues Addressed:
[WRP-29491] Create GPVB with Yocto 5.0 Scarthgap

Change-Id: I5bbcf7246499edfaa6141890c70d0a7a257be36f
shr-project added a commit to shr-project/meta-webosose that referenced this issue Feb 22, 2024
:Release Notes:
recipes using node-gyp-native fail to build after python3 was updated to 3.12 in:
https://git.openembedded.org/openembedded-core/commit/?id=716d82352545d3667a658b69d65d6127678dd150

:Detailed Notes:
we need the fix from:
nodejs/node-gyp#2869

Fixes:
nodejs-module-webos-sysbus   http://gecko.lge.com:8000/Errors/Details/763462
nodejs-module-webos-pmlog    http://gecko.lge.com:8000/Errors/Details/763463
nodejs-module-webos-dynaload http://gecko.lge.com:8000/Errors/Details/763464

Traceback (most recent call last):
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
    import gyp  # noqa: E402
    ^^^^^^^^^^
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>
    import gyp.input
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>
    from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils'

:Testing Performed:
Only build tested.

:QA Notes:
No change to image.

:Issues Addressed:
[WRP-29491] Create GPVB with Yocto 5.0 Scarthgap

Change-Id: I5bbcf7246499edfaa6141890c70d0a7a257be36f
shr-project added a commit to shr-project/meta-webosose that referenced this issue Feb 22, 2024
:Release Notes:
recipes using node-gyp-native fail to build after python3 was updated to 3.12 in:
https://git.openembedded.org/openembedded-core/commit/?id=716d82352545d3667a658b69d65d6127678dd150

:Detailed Notes:
we need the fix from:
nodejs/node-gyp#2869

Fixes:
nodejs-module-webos-sysbus   http://gecko.lge.com:8000/Errors/Details/763462
nodejs-module-webos-pmlog    http://gecko.lge.com:8000/Errors/Details/763463
nodejs-module-webos-dynaload http://gecko.lge.com:8000/Errors/Details/763464

Traceback (most recent call last):
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
    import gyp  # noqa: E402
    ^^^^^^^^^^
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>
    import gyp.input
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>
    from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils'

:Testing Performed:
Only build tested.

:QA Notes:
No change to image.

:Issues Addressed:
[WRP-29491] Create GPVB with Yocto 5.0 Scarthgap

Change-Id: I5bbcf7246499edfaa6141890c70d0a7a257be36f
shr-project added a commit to shr-project/meta-webosose that referenced this issue Feb 24, 2024
:Release Notes:
recipes using node-gyp-native fail to build after python3 was updated to 3.12 in:
https://git.openembedded.org/openembedded-core/commit/?id=716d82352545d3667a658b69d65d6127678dd150

:Detailed Notes:
we need the fix from:
nodejs/node-gyp#2869

Fixes:
nodejs-module-webos-sysbus   http://gecko.lge.com:8000/Errors/Details/763462
nodejs-module-webos-pmlog    http://gecko.lge.com:8000/Errors/Details/763463
nodejs-module-webos-dynaload http://gecko.lge.com:8000/Errors/Details/763464

Traceback (most recent call last):
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
    import gyp  # noqa: E402
    ^^^^^^^^^^
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>
    import gyp.input
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>
    from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils'

:Testing Performed:
Only build tested.

:QA Notes:
No change to image.

:Issues Addressed:
[WRP-29491] Create GPVB with Yocto 5.0 Scarthgap

Change-Id: I5bbcf7246499edfaa6141890c70d0a7a257be36f
shr-project added a commit to shr-project/meta-webosose that referenced this issue Feb 26, 2024
:Release Notes:
recipes using node-gyp-native fail to build after python3 was updated to 3.12 in:
https://git.openembedded.org/openembedded-core/commit/?id=716d82352545d3667a658b69d65d6127678dd150

:Detailed Notes:
we need the fix from:
nodejs/node-gyp#2869

Fixes:
nodejs-module-webos-sysbus   http://gecko.lge.com:8000/Errors/Details/763462
nodejs-module-webos-pmlog    http://gecko.lge.com:8000/Errors/Details/763463
nodejs-module-webos-dynaload http://gecko.lge.com:8000/Errors/Details/763464

Traceback (most recent call last):
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
    import gyp  # noqa: E402
    ^^^^^^^^^^
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>
    import gyp.input
  File "nodejs-module-webos-dynaload/3.0.2-4/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>
    from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils'

:Testing Performed:
Only build tested.

:QA Notes:
No change to image.

:Issues Addressed:
[WRP-29491] Create GPVB with Yocto 5.0 Scarthgap

Change-Id: I5bbcf7246499edfaa6141890c70d0a7a257be36f
@RubTalha
Copy link

https://stackoverflow.com/a/76691103/13086128

@nodejs nodejs locked as resolved and limited conversation to collaborators Feb 27, 2024
@cclauss
Copy link
Contributor Author

cclauss commented Feb 27, 2024

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

Successfully merging a pull request may close this issue.