Skip to content
Advertisement

ModuleNotFoundError: No module named ‘_ctypes’ while installing libraries

I have not found any useful answers elsewhere, so I want to ask for help here.

I’m trying to set up a VPS and I need some libraries (like datetime and random), however, when I type pip3.10 install datetime, it just gives me a bunch of errors:

WARNING: Discarding https://files.pythonhosted.org/packages/e5/4f/86e90a34419df9c32a6e88b06f18233cffe93a236f7d2690f707c816fbe6/zope.interface-5.1.2.tar.gz#sha256=c9c8e53a5472b77f6a391b515c771105011f4b40740ce53af8428d1c8ca20004 (from https://pypi.org/simple/zope-interface/) (requires-python:>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached zope.interface-5.1.1.tar.gz (228 kB)
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python3.10 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-f5fedo38/zope-interface_a42655eef45a4ad1a0d08ba394ed5e01/setup.py'"'"'; __file__='"'"'/tmp/pip-install-f5fedo38/zope-interface_a42655eef45a4ad1a0d08ba394ed5e01/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-pc68spm2
       cwd: /tmp/pip-install-f5fedo38/zope-interface_a42655eef45a4ad1a0d08ba394ed5e01/
  Complete output (11 lines):
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/usr/local/lib/python3.10/site-packages/setuptools/__init__.py", line 18, in <module>
      from setuptools.dist import Distribution
    File "/usr/local/lib/python3.10/site-packages/setuptools/dist.py", line 38, in <module>
      from setuptools import windows_support
    File "/usr/local/lib/python3.10/site-packages/setuptools/windows_support.py", line 2, in <module>
      import ctypes
    File "/usr/local/lib/python3.10/ctypes/__init__.py", line 8, in <module>
      from _ctypes import Union, Structure, Array
  ModuleNotFoundError: No module named '_ctypes'
  ----------------------------------------

What should I do?

Advertisement

Answer

As it seems, you are trying to install all built-in modules.

You don’t have to reinstall them at all

Advertisement