Module _socket not found in python3.6 "No module named _socket"

Chris Angelico rosuav at gmail.com
Wed Dec 6 16:48:31 EST 2017


On Thu, Dec 7, 2017 at 7:59 AM, Bryan Zimmer <bazthelinuxguy at gmail.com> wrote:
> I have been getting this message, "No module named '_socket'", since I
> installed python 3.6, about two months ago.
>
> My platform is Slackware Linux (14.2). I compiled python3.6 from source,
> because binary python packages aren't distributed by python.org for Linux.
> I have the same experience on multiple Slackware computers, not just one.
> Actually, this problem hits the 64-bit distribution. I have a 32-bit
> Slackware box that has no trouble with _socket.
>
> I can not 'import socket' into a program, nor can I use 'pip' to install
> modules. These require the _socket module, which doesn't exist. What does
> exist is a shared library object called '_
> socket.cpython-36m-i386-linux-gnu.so'. This looks tantalizingly like the
> missing module, but it is for a 32-bit architecture.
>
> This is not the only missing module for 64-bit Slackware Linux. I can not
> find a trace of the 'math' module, which, again, works fine on my 32-bit
> computer.
>
> I am far from an expert on installing python modules, so I am asking for
> advice on how I should proceed to find these modules.

The 'socket' module (with the '_socket' helper) is part of the
standard library, so it sounds like something failed during
compilation. I don't know Slackware specifically, but my guess is that
you need to install development libraries for something in order to
compile _socket, and you installed the 32-bit but not the 64-bit of
it.

ChrisA



More information about the Python-list mailing list