ImportError:
python
April 13, 20201 min read

ImportError: cannot import name 'sysconfig' from 'distutils'

The distutils package allows for the building and installation of additional modules into a Python installation. These modules can be written in 100%-pure Python, C, or a combination of both.

ImportError: cannot import name 'sysconfig' from 'distutils'

Are you seeing an error or stacktrace as shown below which says - "ImportError"?

Traceback (most recent call last):
  File "/usr/bin/pip3", line 9, in <module>
    from pip import main
  File "/usr/lib/python3/dist-packages/pip/__init__.py", line 14, in <module>
    from pip.utils import get_installed_distributions, get_prog
  File "/usr/lib/python3/dist-packages/pip/utils/__init__.py", line 23, in <module>
    from pip.locations import (
  File "/usr/lib/python3/dist-packages/pip/locations.py", line 9, in <module>
    from distutils import sysconfig
ImportError: cannot import name 'sysconfig' from 'distutils' (/usr/lib/python3.8/distutils/__init__.py)

Fix the issue of import

You can fix the above error by installing python3-distutils. Try installing the module by running the following command-

$ sudo apt install python3-distutils

The distutils package provides support for building and installing additional modules into a Python installation.

Share this blog
Tagged in :
python
Like what you read?
Subscribe to our Newsletter
Subscribe to our email newsletter and unlock access to members-only content and exclusive updates.
About the Author
Satvik
Satvik
Entrepreneur
Satvik is a passionate developer turned Entrepreneur. He is fascinated by JavaScript, Operating System, Deep Learning, AR/VR. He has published several research papers and applied for patents in the field as well. Satvik is a speaker in conferences, meetups talking about Artificial Intelligence, JavaScript and related subjects. His goal is to solve complex problems that people face with automation. Related projects can be seen at - [Projects](/projects)
View all articles
Previous Article
Next Article