3

On my RHEL 7.x system, I have system level python2.7 in /usr/bin and python3.7 in /usr/local/bin. I am trying to install pip for my python3.7 but I get "ModuleNotFoundError: No module named '_ctypes'" error. I did install libffi-devel but the issue still persists.

I installed libffi-devel using yum install libffi-devel I have downloaded the get_pip file from here: sudo wget https://bootstrap.pypa.io/get-pip.py Now when I run sudo /usr/local/bin/python3.7 get-pip.py I get the described error

Also, I tried sudo /usr/local/bin/python3.7 -m ensurepip which gives me the same error.

How can I get pip installed successfully for my python3.7

6
  • 2
    Have you compiled Python yourself? Did you recompile after installing libffi-devel? Commented Jun 25, 2019 at 16:20
  • How can I do that? @phd Commented Jun 25, 2019 at 16:23
  • Same way as you have compiled it for the first time. Commented Jun 25, 2019 at 16:33
  • 1
    I removed the existing python3.7, installed and compiled it again , the issue is resolved. Thanks Commented Jun 25, 2019 at 17:15
  • I had this issue using python 3.7.5, the issue did not happen when I tried with python 3.7.1 Commented Dec 2, 2019 at 20:41

1 Answer 1

2

Install the libffi development package:

sudo apt-get install libffi-dev 

and compile again.

Sign up to request clarification or add additional context in comments.

3 Comments

And if you're on a shared host that doesn't have libffi-dev?
I don't know exactly, but I think you can install a new python On your side and working with that.
@hassanzadeh.sd After installing libffi, provide that package while recompiling the python libs ?