KeyError: '_speedups'

Issue #41 resolved
Brett Cannon
created an issue

I tried to install Sphinx using easy_install -U Sphinx and while trying to install Jinja an exception is thrown::

File "/Users/brett/.local/lib/python2.6/site-packages/distribute-0.6.1-py2.6.egg/setuptools/command/", line 85, in get_ext_filename ext = self.ext_map[fullname] KeyError: '_speedups'

Looks like something about trying to build extensions is failing. This is Python 2.6.2+, non-framework on OS X 10.6 using Distribute 0.6.1.

Comments (6)

  1. Tarek Ziadé repo owner

    That's strange because Jinja provides its own build_ext command in its file, that does the work, by calling distutils's build_ext command and dealing with compile errors.

    I couldn't reproduce that problem (I am on Mac OS X Leopard - py2.6).

    Do you still have the full traceback by any chance ?

  2. Tarek Ziadé repo owner
    • changed status to open

    Ok thanks, I've found the problem.

    Here's the explanation, I hope it's not too complex to understand:

    Distribute (well Setuptools in fact) overrides Distutils 'get_ext_filename' which is suppose to return a path. But in this implementation, it does a lot more and makes the assumption that the provided argument *is* an extension name and *is* a fullname. (if you look at setuptools code, it even changed the argument name to "fullname", when it's called "ext_name" in Distutils)

    Distribute uses in this method self.ext_map which is filled properly *only* when the method is called with an extension fullname.

    Unfortunately, Distutils uses this function since 2.6.2 in another context to get a filename that is not a fullname (yes you can ;) ), so if Distribute is present, it will break.

    The solution is to keep this method returning what it is suppose to return and not making such assumptions. A refactoring is required on Distribute side, to make it work properly

    Unfortunately, starting at 2.6.2, people that compile extensions using the Setuptools project will have this problem.

    A quick fix is:

    $ hg di setuptools/command/
    diff -r 48c7bb55039e setuptools/command/
    --- a/setuptools/command/   Sat Sep 12 09:06:05 2009 +0200
    +++ b/setuptools/command/   Sun Sep 13 00:07:57 2009 +0200
    @@ -82,6 +82,8 @@
         def get_ext_filename(self, fullname):
             filename = _build_ext.get_ext_filename(self,fullname)
    +        if fullname not in self.ext_map:
    +            return filename
             ext = self.ext_map[fullname]
             if isinstance(ext,Library):
                 fn, ext = os.path.splitext(filename)

    I doubt that Setuptools itself will be fixed then released, but this problem will be fixed in Distribute 0.6.2.

  3. Log in to comment