no module name "_ctypes" when trying to pip install

10,462

For those who hit this issue and have root access, you may be able to correct by following the instructions below. Otherwise, you may need to contact your Sys Admin.

The issue is likely a missing installation of libffi-dev which can be installed with:

sudo apt install libffi-dev

Note: You may need to uninstall and re-install python to get this to work. In my case, It would not stick until I re-installed.

Share:
10,462

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    I have no root access.

    I followed this tutorial http://ernie55ernie.github.io/python/2016/11/11/install-python-packages-for-local-user-without-sudo.html to install python without sudo access.

    It worked fine, but then when I try to install a package I get the _ctypes error, which I know is due to the "libffi-dev" package missing (on debian).

    I can't install this package, so I downloaded version 3.3 from their ftp servers and built it in python/libffi.

    I then set env variables like so:

    export LD_LIBRARY_PATH=$HOME/python/libffi/lib64
    export LD_RUN_PATH=/$HOME/python/libffi/lib64
    export PKG_CONFIG_PATH=$HOME/python/libffi/lib/pkgconfig
    

    After coming across this thread: https://www.reddit.com/r/linuxquestions/comments/c5wxh0/help_with_error_on_install_of_python37_from/

    However, my pip install is still not working. How can I get around this? Is there an argument I can specify to pip to use my local version of libffi?

  • nck
    nck almost 3 years
    This worked for me in debian 9
  • charrison
    charrison over 2 years
    OP said he has no root access...
  • Timothy C. Quinn
    Timothy C. Quinn over 2 years
    @charrison - Noted. I added a note at the top to cover this.