I do not have a subscription to the RHEL repos at this time. I am using EPEL for packages that are needed.

Goal: I am attempting to setup multiple virtualenv folders for testing purposes. I have one setup with python 2.7 and would like to create another with python 3.7. I will then install Ansible through pip.

What I am doing:

I am attempting to install Python 3.7 on RHEL 6.8 while leaving the system python 2.7 in place. I do not have a lot of experience with doing this, and am open to suggestions and other solutions.

I have run the following commands to install Python 3.7.0

wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
./configure --prefix=$HOME/python3.7 
make install

This completes with the message: 'ModuleNotFoundError: No module named '_ctypes'

I am able to access python 3.7 through ~/python3.7/bin/python3

bin]$ ./python3
Python 3.7.0 (default, Oct  5 2018, 11:09:23)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-23)] on linux
Type "help", "copyright", "credits" or "license" for more information.

I run into issues when attempting to install pip however.

wget https://bootstrap.pypa.io/get-pip.py
./python3 get-pip.py
Traceback (most recent call last):
File "get-pip.py", line 20890, in <module>
File "get-pip.py", line 197, in main
File "get-pip.py", line 82, in bootstrap
import pip._internal
File "/tmp/tmp4d087g4p/pip.zip/pip/_internal/__init__.py", line 40, in <module>
File "/tmp/tmp4d087g4p/pip.zip/pip/_internal/cli/autocompletion.py", line 8, in <module>
File "/tmp/tmp4d087g4p/pip.zip/pip/_internal/cli/main_parser.py", line 12, in <module>
File "/tmp/tmp4d087g4p/pip.zip/pip/_internal/commands/__init__.py", line 6, in <module>
File "/tmp/tmp4d087g4p/pip.zip/pip/_internal/commands/completion.py", line 6, in <module>
File "/tmp/tmp4d087g4p/pip.zip/pip/_internal/cli/base_command.py", line 18, in <module>
File "/tmp/tmp4d087g4p/pip.zip/pip/_internal/download.py", line 38, in <module>
File "/tmp/tmp4d087g4p/pip.zip/pip/_internal/utils/glibc.py", line 3, in <module>
File "/home/jmossman/python3.7/lib/python3.7/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'

Through online research, it seemed that this issue had been run into before. Many of the resolutions I have seen indicate that I am missing something that is required by the _ctypes module.

https://bugs.python.org/issue31652 https://stackoverflow.com/questions/27022373/python3-importerror-no-module-named-ctypes-when-using-value-from-module-mul

The common package was the libffi-dev.

I thought that i might be missing this or other packages. I reviewed my system and found that while I do have libffi, I do not have libffi-devel or libffi-dev. I was able to verify that I have zlib-devel installed. I could not find libncursesw5-dev, libgdbm-dev, libc6-dev, zlib1g-dev, libsqlite3-dev, or tk-dev for RHEL 6.8. I am not sure if they are needed.

At this point, I am uncertain what is the actual issue. Am i missing a package that I need? Did I cause issues with its ability to identify needed packages, because I installed python using ./configure --prefix and make?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.