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

No module named 'distutils' on Python 3.12 #732

Open
SyberiaK opened this issue Jan 31, 2024 · 4 comments
Open

No module named 'distutils' on Python 3.12 #732

SyberiaK opened this issue Jan 31, 2024 · 4 comments
Assignees

Comments

@SyberiaK
Copy link

Steps to reproduce

  1. Install Python 3.12
  2. Install speech_recognition and pyaudio with pip (pip install SpeechRecognition and pip install pyaudio)
  3. Create a Python script with this code:
import speech_recognition as sr

mic = sr.Microphone()
print('hello')
  1. Launch the script.

Expected behaviour

hello printed in the console

Actual behaviour

Because distutils was removed in Python 3.12, we get ModuleNotFoundError: module named 'distutils'

System information

My Python version is 3.12.

@sapozhkov
Copy link

try
pip install setuptools

found on https://stackoverflow.com/questions/77931666/modulenotfounderror-no-module-named-distutils-how-to-solve-this-in-macos

@Paulprojects8711
Copy link

try pip install setuptools

found on https://stackoverflow.com/questions/77931666/modulenotfounderror-no-module-named-distutils-how-to-solve-this-in-macos

i had the same issue and that actually fixed it thank you

@ftnext
Copy link
Collaborator

ftnext commented Mar 17, 2024

Thank you for reporting this issue, finding a solution, trying and sharing a result.

ref: https://docs.python.org/3/whatsnew/3.12.html#summary-release-highlights

gh-95299: Do not pre-install setuptools in virtual environments created with venv. This means that distutils, setuptools, pkg_resources, and easy_install will no longer available by default; to access these run pip install setuptools in the activated virtual environment.

I wonder adding pip install setuptools to README.

@ftnext ftnext self-assigned this Mar 17, 2024
@tphollis
Copy link

I'm trying to use the pip install setuptools but I still get the error "ModuleNotFoundError: No module named 'distutils'". Actually, any time I try to use a pip command, that's the result. any ideas on how to get around this? I'm running on Ubuntu if that helps

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

5 participants