FAQ
Hello,

I have a python installation that I built myself using Visual Studio 2005.
I need this version because I need to link Python bindings to a 3rd
party library that uses VS 2005.

I want to get setuptools installed to this Python installation but the
installer won't find my version of Python even if it is on the PATH
and PYTHONHOME is set.
So, I am trying to build setuptools but when I run "python setup.py
install" I get the following error.
Any ideas either on how to get the installer to find my installation
or on how to get this to compile?

F:\pyside\setuptools-0.6c11>python setup.py install
running install
Traceback (most recent call last):
File "setup.py", line 94, in <module>
scripts = scripts,
File "F:\My_Python27\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "F:\My_Python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "F:\My_Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "F:\pyside\setuptools-0.6c11\setuptools\command\install.py",
line 76, in run
self.do_egg_install()
File "F:\pyside\setuptools-0.6c11\setuptools\command\install.py",
line 85, in do_egg_install
easy_install = self.distribution.get_command_class('easy_install')
File "F:\pyside\setuptools-0.6c11\setuptools\dist.py", line 395, in
get_command_class
self.cmdclass[command] = cmdclass = ep.load()
File "F:\pyside\setuptools-0.6c11\pkg_resources.py", line 1954, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "F:\pyside\setuptools-0.6c11\setuptools\command\easy_install.py",
line 21, in <module>
from setuptools.package_index import PackageIndex, parse_bdist_wininst
File "F:\pyside\setuptools-0.6c11\setuptools\package_index.py", line
2, in <module>
import sys, os.path, re, urlparse, urllib2, shutil, random,
socket, cStringIO
File "F:\My_Python27\lib\urllib2.py", line 94, in <module>
import httplib
File "F:\My_Python27\lib\httplib.py", line 71, in <module>
import socket
File "F:\My_Python27\lib\socket.py", line 47, in <module>
import _socket
ImportError: No module named _socket

F:\pyside\setuptools-0.6c11>

Search Discussions

  • Benjamin Kaplan at Apr 18, 2011 at 6:25 pm

    On Apr 18, 2011 12:55 PM, "Eric Frederich" wrote:
    Hello,

    I have a python installation that I built myself using Visual Studio 2005.
    I need this version because I need to link Python bindings to a 3rd
    party library that uses VS 2005.

    I want to get setuptools installed to this Python installation but the
    installer won't find my version of Python even if it is on the PATH
    and PYTHONHOME is set.
    So, I am trying to build setuptools but when I run "python setup.py
    install" I get the following error.
    Any ideas either on how to get the installer to find my installation
    or on how to get this to compile?

    F:\pyside\setuptools-0.6c11>python setup.py install
    running install
    Traceback (most recent call last):
    File "setup.py", line 94, in <module>
    scripts = scripts,
    File "F:\My_Python27\lib\distutils\core.py", line 152, in setup
    dist.run_commands()
    File "F:\My_Python27\lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
    File "F:\My_Python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
    File "F:\pyside\setuptools-0.6c11\setuptools\command\install.py",
    line 76, in run
    self.do_egg_install()
    File "F:\pyside\setuptools-0.6c11\setuptools\command\install.py",
    line 85, in do_egg_install
    easy_install = self.distribution.get_command_class('easy_install')
    File "F:\pyside\setuptools-0.6c11\setuptools\dist.py", line 395, in
    get_command_class
    self.cmdclass[command] = cmdclass = ep.load()
    File "F:\pyside\setuptools-0.6c11\pkg_resources.py", line 1954, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
    File "F:\pyside\setuptools-0.6c11\setuptools\command\easy_install.py",
    line 21, in <module>
    from setuptools.package_index import PackageIndex, parse_bdist_wininst
    File "F:\pyside\setuptools-0.6c11\setuptools\package_index.py", line
    2, in <module>
    import sys, os.path, re, urlparse, urllib2, shutil, random,
    socket, cStringIO
    File "F:\My_Python27\lib\urllib2.py", line 94, in <module>
    import httplib
    File "F:\My_Python27\lib\httplib.py", line 71, in <module>
    import socket
    File "F:\My_Python27\lib\socket.py", line 47, in <module>
    import _socket
    ImportError: No module named _socket
    Like the error says, you don't have socket built. Python is very modular.
    Just because you built the core doesn't mean you've built every module (and
    in fact you cannot build every module in the standard library because some
    of them only build on specific OSes).

    You'll need to rebuild Python with the socket module in order to use
    setuptools. I'm not entirely sure what the Windows dependencies are for
    that, so I'll let someone more familiar with the windows build answer that.
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/python-list/attachments/20110418/330e7775/attachment.html>
  • Wolfgang Rohdewald at Apr 18, 2011 at 6:30 pm

    On Montag 18 April 2011, Eric Frederich wrote:
    File "F:\My_Python27\lib\socket.py", line 47, in <module>
    import _socket
    ImportError: No module named _socket

    F:\pyside\setuptools-0.6c11>
    I have C:\Python27

    and within that, DLLS\_socket.pyd

    this is what import _socket should find

    do you have that?

    --
    Wolfgang
  • Eric Frederich at Apr 19, 2011 at 2:07 pm
    I do not have a DLLs folder.
    I created this installation of Python myself since I needed it built
    with Visual Studio 2005.
    I followed instructions under PC\readme.txt
    This file mentioned nothing about a DLLs folder.
    From PC\readme.txt .........
    The best installation strategy is to put the Python executable (and
    DLL, for Win32 platforms) in some convenient directory such as
    C:/python, and copy all library files and subdirectories (using XCOPY)
    to C:/python/lib.

    I see that there is a _socket project in the Visual Studio solution.
    I built this manually and copied the _socket.pyx file do a manually
    created DLLs folder.
    This seems to have worked but it bothers me that there is no mention
    of this stuff in the readme.txt file.

    The readme file did mention that there is a config.c file that I am to
    edit to enable other modules.
    If I added a call to init_socket() in this file would the socket
    library then be built into the main dll file?
    I'm not sure exactly how to use this config.c file.

    Thanks,
    ~Eric

    On Mon, Apr 18, 2011 at 2:30 PM, Wolfgang Rohdewald
    wrote:
    On Montag 18 April 2011, Eric Frederich wrote:
    ? File "F:\My_Python27\lib\socket.py", line 47, in <module>
    ? ? import _socket
    ImportError: No module named _socket

    F:\pyside\setuptools-0.6c11>
    I have C:\Python27

    and within that, DLLS\_socket.pyd

    this is what import _socket should find

    do you have that?

    --
    Wolfgang

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedApr 18, '11 at 4:53p
activeApr 19, '11 at 2:07p
posts4
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase