Issue 31652: make install fails: no module _ctypes (original) (raw)

Issue31652

process

Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Alexander Stohr, Dandan Lee, Mr. Pligin, THRlWiTi, bkline, bryanf, cstratak, dgspahn, dstufft, jwilk, malin, martin.panter, ncoghlan, prabs003, slink, thomasahle, zach.ware
Priority: normal Keywords:

Created on 2017-09-30 23:04 by Dandan Lee, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
query.csv dgspahn,2018-09-08 19:50 error query
Messages (13)
msg303434 - (view) Author: Dandan Lee (Dandan Lee) Date: 2017-09-30 23:04
The make install step fails with this error: Traceback (most recent call last): File "/home/dandan/Downloads/cpython-3.7.0a1/Lib/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/home/dandan/Downloads/cpython-3.7.0a1/Lib/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/dandan/Downloads/cpython-3.7.0a1/Lib/ensurepip/__main__.py", line 4, in ensurepip._main() File "/home/dandan/Downloads/cpython-3.7.0a1/Lib/ensurepip/__init__.py", line 189, in _main default_pip=args.default_pip, File "/home/dandan/Downloads/cpython-3.7.0a1/Lib/ensurepip/__init__.py", line 102, in bootstrap _run_pip(args + [p[0] for p in _PROJECTS], additional_paths) File "/home/dandan/Downloads/cpython-3.7.0a1/Lib/ensurepip/__init__.py", line 27, in _run_pip import pip File "/tmp/tmpcg658x_c/pip-9.0.1-py2.py3-none-any.whl/pip/__init__.py", line 28, in File "/tmp/tmpcg658x_c/pip-9.0.1-py2.py3-none-any.whl/pip/vcs/mercurial.py", line 9, in File "/tmp/tmpcg658x_c/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 36, in File "/tmp/tmpcg658x_c/pip-9.0.1-py2.py3-none-any.whl/pip/utils/glibc.py", line 4, in File "/home/dandan/Downloads/cpython-3.7.0a1/Lib/ctypes/__init__.py", line 7, in from _ctypes import Union, Structure, Array ModuleNotFoundError: No module named '_ctypes' Makefile:1080: recipe for target 'install' failed make: *** [install] Error 1 Am I missing something?
msg303444 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2017-10-01 02:06
I expect that the root cause is missing libffi(-dev[el]) on your system, preventing _ctypes from building, so your quick fix would be to install that and try again. However, not having _ctypes shouldn't cause installation to fail. Donald, is ctypes a hard requirement for pip to install itself? If so, ensurepip as called by `make install` should either gracefully handle a lack of ctypes or be disabled when ctypes is not available.
msg321216 - (view) Author: Bob Kline (bkline) * Date: 2018-07-07 12:08
Confirming that this is still failing with 3.7.0 released.
msg321253 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2018-07-08 03:43
In <https://bugs.python.org/issue32401#msg308926> Chi-Hsuan suggests “configure --without-ensurepip” as a workaround.
msg321260 - (view) Author: Ma Lin (malin) * Date: 2018-07-08 06:33
> I expect that the root cause is missing libffi(-dev[el]) on your system Yes, on my Ubuntu 18.04, `make` failed to compile _ctypes module. After install libffi-dev, it was compiled successfully: One more word, full necessary dependencies on my Ubuntu 18.04: sudo apt-get install build-essential libsqlite3-dev sqlite3 bzip2 libbz2-dev zlib1g-dev libssl-dev openssl libgdbm-dev libgdbm-compat-dev liblzma-dev libreadline-dev libncursesw5-dev libffi-dev uuid-dev
msg321740 - (view) Author: Bryan (bryanf) Date: 2018-07-16 15:44
Similar error on CentOS 7 ModuleNotFoundError: No module named '_ctypes' Install -- yum install libffi-devel Repeat: ./configure --enable-optimizations make altinstall Results: Collecting setuptools Collecting pip Installing collected packages: setuptools, pip Successfully installed pip-10.0.1 setuptools-39.0.1 NOTE: The error did not stop python3.7 from operating as noted on this page. # python3.7 Python 3.7.0 (default, Jul 16 2018, 11:25:12) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> print ("Hello Python") Hello Python >>>
msg324860 - (view) Author: David Spahn (dgspahn) Date: 2018-09-08 19:50
I'm getting the same error File "/usr/src/Python-3.7.0/Lib/ctypes/__init__.py", line 7, in from _ctypes import Union, Structure, Array ModuleNotFoundError: No module named '_ctypes' Makefile:1122: recipe for target 'install' failed make: *** [install] Error 1 Linux Mint 19
msg325746 - (view) Author: Prabhakar (prabs003) Date: 2018-09-19 11:25
Hi All, Iam using centos 7. And as mentioned in this thread, though this error came, Iam able to go to python3.7 interpreter fine. However, when i wanted to install pip, I get the same _ctype error as below. So, I think, this needs to be resolved in order to use python3.7 in centos. File "get-pip.py", line 20651, in main() File "get-pip.py", line 197, in main bootstrap(tmpdir=tmpdir) File "get-pip.py", line 82, in bootstrap import pip._internal File "/tmp/tmpu88jadkc/pip.zip/pip/_internal/__init__.py", line 42, in File "/tmp/tmpu88jadkc/pip.zip/pip/_internal/cmdoptions.py", line 16, in File "/tmp/tmpu88jadkc/pip.zip/pip/_internal/index.py", line 24, in File "/tmp/tmpu88jadkc/pip.zip/pip/_internal/download.py", line 38, in File "/tmp/tmpu88jadkc/pip.zip/pip/_internal/utils/glibc.py", line 3, in File "/usr/local/lib/python3.7/ctypes/__init__.py", line 7, in from _ctypes import Union, Structure, Array ModuleNotFoundError: No module named '_ctypes' Looking for advice.
msg325755 - (view) Author: Charalampos Stratakis (cstratak) * Date: 2018-09-19 12:58
As mentioned before, this is due to missing libffi-devel on a Centos 7 system. Verified it as well on one of my systems. Could you try again, but before just do a 'yum install libffi-devel'? Maybe a warning could be added to the install output when it can't find libffi.
msg337224 - (view) Author: Mr. Pligin (Mr. Pligin) Date: 2019-03-05 16:36
Linux Mint 19.1 sudo make altinstall Traceback (most recent call last): File "/usr/src/Python-3.7.2/Lib/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/src/Python-3.7.2/Lib/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/src/Python-3.7.2/Lib/ensurepip/__main__.py", line 5, in sys.exit(ensurepip._main()) File "/usr/src/Python-3.7.2/Lib/ensurepip/__init__.py", line 204, in _main default_pip=args.default_pip, File "/usr/src/Python-3.7.2/Lib/ensurepip/__init__.py", line 117, in _bootstrap return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths) File "/usr/src/Python-3.7.2/Lib/ensurepip/__init__.py", line 27, in _run_pip import pip._internal File "/tmp/tmpc5nmmwk0/pip-18.1-py2.py3-none-any.whl/pip/_internal/__init__.py", line 40, in File "/tmp/tmpc5nmmwk0/pip-18.1-py2.py3-none-any.whl/pip/_internal/cli/autocompletion.py", line 8, in File "/tmp/tmpc5nmmwk0/pip-18.1-py2.py3-none-any.whl/pip/_internal/cli/main_parser.py", line 12, in File "/tmp/tmpc5nmmwk0/pip-18.1-py2.py3-none-any.whl/pip/_internal/commands/__init__.py", line 6, in File "/tmp/tmpc5nmmwk0/pip-18.1-py2.py3-none-any.whl/pip/_internal/commands/completion.py", line 6, in File "/tmp/tmpc5nmmwk0/pip-18.1-py2.py3-none-any.whl/pip/_internal/cli/base_command.py", line 18, in File "/tmp/tmpc5nmmwk0/pip-18.1-py2.py3-none-any.whl/pip/_internal/download.py", line 38, in File "/tmp/tmpc5nmmwk0/pip-18.1-py2.py3-none-any.whl/pip/_internal/utils/glibc.py", line 3, in File "/usr/src/Python-3.7.2/Lib/ctypes/__init__.py", line 7, in from _ctypes import Union, Structure, Array ModuleNotFoundError: No module named '_ctypes' Makefile:1140: recipe for target 'altinstall' failed make: *** [altinstall] Error 1
msg340492 - (view) Author: Nils Goroll (slink) Date: 2019-04-18 14:49
In case this helps: I noticed this during the build: *** WARNING: renaming "_ssl" since importing it failed: ld.so.1: python: fatal: libssl.so.1.1: open failed: No such file or directory *** WARNING: renaming "_hashlib" since importing it failed: ld.so.1: python: fatal: libssl.so.1.1: open failed: No such file or directory *** WARNING: renaming "_ctypes" since importing it failed: ld.so.1: python: fatal: libffi.so.6: open failed: No such file or directory ... Following modules built successfully but were removed because they could not be imported: _ctypes _hashlib _ssl In my case the reason was that libffi was installed under /opt/local, so the fix was: ./configure LDFLAGS='-L/opt/local/lib -R/opt/local/lib' and rebuild For other users I would recommend to inspect the build output for _ctypes related errors, I am not saying that the cause is the same
msg348527 - (view) Author: Thomas Dybdahl Ahle (thomasahle) * Date: 2019-07-26 21:15
Installing libffi-dev worked for me.
msg363443 - (view) Author: Alexander Stohr (Alexander Stohr) Date: 2020-03-05 16:50
Ubuntu 16.04 in a very bare naked setup. Similar/same problem profile by message and other lines in the log. Installed libffi6 and libffi-dev => worked. Not sure if both were needed (or interdependent, 2nd to 1st).
History
Date User Action Args
2022-04-11 14:58:53 admin set github: 75833
2020-03-05 16:50:16 Alexander Stohr set nosy: + Alexander Stohrmessages: +
2019-07-26 21:15:30 thomasahle set nosy: + thomasahlemessages: +
2019-06-08 19:13:08 jwilk set nosy: + jwilk
2019-04-18 14:49:22 slink set nosy: + slinkmessages: +
2019-03-05 16:36:39 Mr. Pligin set nosy: + Mr. Pliginmessages: +
2019-02-28 12:57:28 methane set status: open -> closedresolution: not a bugstage: resolved
2019-02-28 10:49:39 THRlWiTi set nosy: + THRlWiTi
2018-09-19 12:58:36 cstratak set nosy: + cstratakmessages: +
2018-09-19 11:25:12 prabs003 set nosy: + prabs003messages: +
2018-09-08 19:50:20 dgspahn set files: + query.csvnosy: + dgspahnmessages: +
2018-07-16 15:44:30 bryanf set nosy: + bryanfmessages: +
2018-07-08 06:33:02 malin set nosy: + malinmessages: +
2018-07-08 03:43:20 martin.panter set nosy: + martin.pantermessages: +
2018-07-08 03:40:15 martin.panter link issue34036 superseder
2018-07-08 03:35:10 martin.panter link issue32401 superseder
2018-07-07 12:08:39 bkline set nosy: + bklinemessages: +
2017-11-21 21:01:54 zach.ware link issue32095 superseder
2017-10-01 02:06:05 zach.ware set nosy: + zach.ware, ncoghlan, dstufftmessages: +
2017-09-30 23:04:21 Dandan Lee create