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

Build: No module named 'distutils.spawn' #30189

Closed
guybedford opened this issue Oct 31, 2019 · 8 comments
Closed

Build: No module named 'distutils.spawn' #30189

guybedford opened this issue Oct 31, 2019 · 8 comments
Labels
python PRs and issues that require attention from people who are familiar with Python. wsl Issues and PRs related to the Windows Subsystem for Linux.

Comments

@guybedford
Copy link
Contributor

guybedford commented Oct 31, 2019

  • Version: master
  • Platform: WSL Ubuntu
  • Subsystem:

I know Node.js doesn't officially support Windows Subsystem for Linux, but I've been quite happily using this to develop on Windows for a while now.

Some recent change in the last week or two on master seems to be causing a build issue though as I now get the following output when running ./configure -

Traceback (most recent call last):
  File "./configure", line 20, in <module>
    from distutils.spawn import find_executable
ModuleNotFoundError: No module named 'distutils.spawn'

I have tried running git clean -fdx.

Any suggestions as to how to fix this would be a huge help to get going again here.

@richardlau
Copy link
Member

* **Version**: master

* **Platform**: WSL Ubuntu

* **Subsystem**:

I know Node.js doesn't officially support Windows Subsystem for Linux, but I've been quite happily using this to develop on Windows for a while now.

Some recent change in the last week or two on master seems to be causing a build issue though as I now get the following output when running ./configure -

Traceback (most recent call last):
  File "./configure", line 20, in <module>
    from distutils.spawn import find_executable
ModuleNotFoundError: No module named 'distutils.spawn'

I have tried running git clean -fdx.

Any suggestions as to how to fix this would be a huge help to get going again here.

The recent change is most likely #30091 which now prefers Python 3 for configure. pypa/pipenv#2922 (comment) suggests a bug in Ubuntu's version of Python.

A workaround would be to specify the version of Python used to run configure: python2 configure.py or python2.7 configure.py

@richardlau richardlau added python PRs and issues that require attention from people who are familiar with Python. wsl Issues and PRs related to the Windows Subsystem for Linux. labels Oct 31, 2019
@gengjiawen
Copy link
Member

Another workaround

sudo apt install python3-distutils -y

@sam-github
Copy link
Contributor

@gengjiawen If python3-distutils is a required dep of our built for py3, it'd be really helpful if you could PR that to BUILDING.md, if you have time.

@guybedford
Copy link
Contributor Author

I can confirm sudo apt install python3-distutils -y fixed the issue here. Thanks so much for the quick responses. Shall I keep this open to track the documentation change?

@gengjiawen
Copy link
Member

gengjiawen commented Nov 1, 2019

@guybedford @sam-github I will try to add this to documentation, leave this open for now :)

@cclauss
Copy link
Contributor

cclauss commented Nov 2, 2019

The other solution seems to be python3 -m pip install setuptools.

@cclauss cclauss changed the title Build issue on WSL Build: No module named 'distutils.spawn' Nov 2, 2019
@cclauss cclauss closed this as completed in ed2c3ca Nov 4, 2019
targos pushed a commit that referenced this issue Nov 5, 2019
Signed-off-by: gengjiawen <technicalcute@gmail.com>

PR-URL: #30221
Fixes: #30189
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
targos pushed a commit that referenced this issue Nov 8, 2019
Signed-off-by: gengjiawen <technicalcute@gmail.com>

PR-URL: #30221
Fixes: #30189
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
targos pushed a commit that referenced this issue Nov 10, 2019
Signed-off-by: gengjiawen <technicalcute@gmail.com>

PR-URL: #30221
Fixes: #30189
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
targos pushed a commit that referenced this issue Nov 10, 2019
Signed-off-by: gengjiawen <technicalcute@gmail.com>

PR-URL: #30221
Fixes: #30189
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
targos pushed a commit that referenced this issue Nov 11, 2019
Signed-off-by: gengjiawen <technicalcute@gmail.com>

PR-URL: #30221
Fixes: #30189
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
addaleax pushed a commit that referenced this issue May 7, 2020
Ran into #30189, solved by this comment:
#30189 (comment)

Refs: #30189
PR-URL: #33174
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
codebytere pushed a commit that referenced this issue May 11, 2020
Ran into #30189, solved by this comment:
#30189 (comment)

Refs: #30189
PR-URL: #33174
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
codebytere pushed a commit that referenced this issue Jun 7, 2020
Ran into #30189, solved by this comment:
#30189 (comment)

Refs: #30189
PR-URL: #33174
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
@saladgg
Copy link

saladgg commented Nov 26, 2020

Linux users

If;
sudo apt install python3-distutils -y;
didn't work for you, ensure you have installed venv globally that corresponds to your python version i.e

your_com:$sudo apt install python3.9-venv
your_comp:
/Desktop/your_prj$virtualenv venv --python=python3.9

@cclauss
Copy link
Contributor

cclauss commented Nov 26, 2020

distutils is being phased out as explained at https://docs.python.org/3/installing

Python 3.3 and later has a builtin venv module https://docs.python.org/3/library/venv.html so virtualenv is not required and you can:

python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
[ ... ]
deactivate

richardlau added a commit to richardlau/node-1 that referenced this issue May 10, 2021
Debian based packages of Python 3 do not include `distutils.spawn` and
require an additional apt package to be installed (`python3-distutils`).
Replace use of `distutils.spawn` with `shutil.which`, available in all
versions of Python currently allowed by our configure scripts.

For the `configure` script only, fall back to `distutils.spawn` to allow
friendlier error messages when run on older unsupported versions of
Python (e.g. 2.7).

`configure.py` also uses `distutils.version` -- this appears to be
available in Debian packaged Python 3 without installing
`python3-distutils` so has been left as-is.

PR-URL: nodejs#38600
Refs: nodejs#30189
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
moander pushed a commit to moander/node that referenced this issue May 11, 2021
Debian based packages of Python 3 do not include `distutils.spawn` and
require an additional apt package to be installed (`python3-distutils`).
Replace use of `distutils.spawn` with `shutil.which`, available in all
versions of Python currently allowed by our configure scripts.

For the `configure` script only, fall back to `distutils.spawn` to allow
friendlier error messages when run on older unsupported versions of
Python (e.g. 2.7).

`configure.py` also uses `distutils.version` -- this appears to be
available in Debian packaged Python 3 without installing
`python3-distutils` so has been left as-is.

PR-URL: nodejs#38600
Refs: nodejs#30189
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
moander pushed a commit to moander/node that referenced this issue May 11, 2021
Debian based packages of Python 3 do not include `distutils.spawn` and
require an additional apt package to be installed (`python3-distutils`).
Replace use of `distutils.spawn` with `shutil.which`, available in all
versions of Python currently allowed by our configure scripts.

For the `configure` script only, fall back to `distutils.spawn` to allow
friendlier error messages when run on older unsupported versions of
Python (e.g. 2.7).

`configure.py` also uses `distutils.version` -- this appears to be
available in Debian packaged Python 3 without installing
`python3-distutils` so has been left as-is.

PR-URL: nodejs#38600
Refs: nodejs#30189
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this issue May 17, 2021
Debian based packages of Python 3 do not include `distutils.spawn` and
require an additional apt package to be installed (`python3-distutils`).
Replace use of `distutils.spawn` with `shutil.which`, available in all
versions of Python currently allowed by our configure scripts.

For the `configure` script only, fall back to `distutils.spawn` to allow
friendlier error messages when run on older unsupported versions of
Python (e.g. 2.7).

`configure.py` also uses `distutils.version` -- this appears to be
available in Debian packaged Python 3 without installing
`python3-distutils` so has been left as-is.

PR-URL: #38600
Refs: #30189
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this issue May 30, 2021
Debian based packages of Python 3 do not include `distutils.spawn` and
require an additional apt package to be installed (`python3-distutils`).
Replace use of `distutils.spawn` with `shutil.which`, available in all
versions of Python currently allowed by our configure scripts.

For the `configure` script only, fall back to `distutils.spawn` to allow
friendlier error messages when run on older unsupported versions of
Python (e.g. 2.7).

`configure.py` also uses `distutils.version` -- this appears to be
available in Debian packaged Python 3 without installing
`python3-distutils` so has been left as-is.

PR-URL: #38600
Refs: #30189
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this issue Jun 5, 2021
Debian based packages of Python 3 do not include `distutils.spawn` and
require an additional apt package to be installed (`python3-distutils`).
Replace use of `distutils.spawn` with `shutil.which`, available in all
versions of Python currently allowed by our configure scripts.

For the `configure` script only, fall back to `distutils.spawn` to allow
friendlier error messages when run on older unsupported versions of
Python (e.g. 2.7).

`configure.py` also uses `distutils.version` -- this appears to be
available in Debian packaged Python 3 without installing
`python3-distutils` so has been left as-is.

PR-URL: #38600
Refs: #30189
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this issue Jun 5, 2021
Debian based packages of Python 3 do not include `distutils.spawn` and
require an additional apt package to be installed (`python3-distutils`).
Replace use of `distutils.spawn` with `shutil.which`, available in all
versions of Python currently allowed by our configure scripts.

For the `configure` script only, fall back to `distutils.spawn` to allow
friendlier error messages when run on older unsupported versions of
Python (e.g. 2.7).

`configure.py` also uses `distutils.version` -- this appears to be
available in Debian packaged Python 3 without installing
`python3-distutils` so has been left as-is.

PR-URL: #38600
Refs: #30189
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this issue Jun 11, 2021
Debian based packages of Python 3 do not include `distutils.spawn` and
require an additional apt package to be installed (`python3-distutils`).
Replace use of `distutils.spawn` with `shutil.which`, available in all
versions of Python currently allowed by our configure scripts.

For the `configure` script only, fall back to `distutils.spawn` to allow
friendlier error messages when run on older unsupported versions of
Python (e.g. 2.7).

`configure.py` also uses `distutils.version` -- this appears to be
available in Debian packaged Python 3 without installing
`python3-distutils` so has been left as-is.

PR-URL: #38600
Refs: #30189
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python PRs and issues that require attention from people who are familiar with Python. wsl Issues and PRs related to the Windows Subsystem for Linux.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants
@sam-github @guybedford @cclauss @gengjiawen @richardlau @saladgg and others