[Python-bugs-list] [ python-Bugs-565710 ] ImportError: No module named _socket

noreply@sourceforge.net noreply@sourceforge.net
Thu, 26 Sep 2002 21:35:53 -0700


Bugs item #565710, was opened at 2002-06-07 04:38
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=565710&group_id=5470

Category: None
>Group: Python 2.2.1
Status: Open
Resolution: None
>Priority: 6
Submitted By: Philipp Kolmann (pkolmann)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: ImportError: No module named _socket

Initial Comment:
Hi,

I just wanted to try out Mailman on a Sun Solaris
machine and compiled therefore Python 2.2.

It did compile ok, but there seems to be a problem with
the socket library:

bash-2.03$ python /opt/PYthon/lib/python2.2/socket.py
Traceback (most recent call last):
  File "/opt/PYthon/lib/python2.2/socket.py", line 41, in ?
    from _socket import *
ImportError: No module named _socket


Could you help me with this problem.

Thanks a lot
Philipp Kolmann

----------------------------------------------------------------------

>Comment By: Barry A. Warsaw (bwarsaw)
Date: 2002-09-27 00:35

Message:
Logged In: YES 
user_id=12800

This is an ld.so problem.  I can reproduce this on the SF
compile farm's Solaris8/Sparc box.  Python 2.2's brain
damaged dynlib build procedure removes any .so it can't
import, which makes it very difficult to tell what the
problem is, if it's not evident in the compilation output.  

In this particular case, rebuilding _socket.so by hand, and
then importing it clearly shows that the dynamic linker
can't find libssl.so.xxx and libcrypto.so.xxx.  On this
Solaris box, these libraries reside in /usr/local/ssl/lib
but that's not on the default ld.so search path and the
build script doesn't use the -R option to compile in the
location of those libraries.

The fix is to add "runtime_library_dirs = ssl_libs," to the
Extension constructor for socketmodule.c in the top level
setup.py.  I've tested this with Python 2.2 maint, but I'll
bet it'll hit Python 2.3 too.

Attached is a patch that ought to fix the problem for
Solaris.  It appears to do no harm on Linux.  Under the same
rationale we came up with for the bsddb module, I think this
should be added, otherwise the socket module will just plain
be busted for (some? all? most?) Solaris systems.

----------------------------------------------------------------------

Comment By: Michael Hudson (mwh)
Date: 2002-06-11 05:14

Message:
Logged In: YES 
user_id=6656

But the usual reason for the _socket module not to build on
solaris is ssl issues.  Without more info it's hard to say
anything more (hint, hint, Philipp).

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-06-10 15:30

Message:
Logged In: YES 
user_id=6380

MWH: I don't see the connection with SSL. More likely
somehow the socket module didn't get built. Quite possibly
his whole installation is hosed. Reducing the priority since
local configuration errors are usually not something that
Python can do anything about.

----------------------------------------------------------------------

Comment By: Michael Hudson (mwh)
Date: 2002-06-07 09:33

Message:
Logged In: YES 
user_id=6656

The problem is probably ssl support.  Try editing
Modules/Setup and uncommenting the line:

#_socket socketmodule.c

If you *need* ssl support, then you'll have to dig deeper...

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=565710&group_id=5470