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

Steve D'Aprano steve+python at pearwood.info
Wed Dec 6 20:45:43 EST 2017


On Thu, 7 Dec 2017 07:59 am, Bryan Zimmer 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.

You need to look at the output of compilation. That might mean doing it
again :-(

Unfortunately the default is to output everything including the kitchen sink,
which makes it hard to notice the errors.

Take note of which files failed to compile, and if need be, post the list
here. Chances are you are missing some development library. You may have the
32-bit dev library installed, but not the 64-bit version.


> 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.

Where is that file? On your 64-bit box?

Do you have the 32-bit Python 3.6 already installed on that machine? If so,
make sure you install the 64-bit version in a different location.

If this isn't enough to diagnose the problems, best to go back to basics and
post *each* step you take and any error output. (The config and make steps
tend to send a metric ton of uninformative output to stdout, probably best to
just capture stderr.) Trivial steps that you are sure are correct can be
summarised (e.g. "Downloaded Python3.6.tar.gz, unpacked it, and cd'ed into
the resulting directory") but if you have any doubt that you are doing it
correctly, better to post too much information than not enough.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list