osx - Macports refuses to install python 2.7.6.0

07
2014-04
  • tbodt

    I'm trying to upgrade various programs I have installed with MacPorts. Unfortunately, python refuses to upgrade:

    --->  Computing dependencies for python27
    --->  Configuring python27
    Error: Failed to configure python27, consult /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_python27/python27/work/Python-2.7.6/config.log
    Error: org.macports.configure for port python27 returned: configure failure: command execution failed
    Please see the log file for port python27 for details:
        /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_python27/python27/main.log
    Error: Unable to upgrade port: 1
    To report a bug, follow the instructions in the guide:
        http://guide.macports.org/#project.tickets
    

    The main.log file just has the output from ./configure, which isn't of any help, except it says that IPV6 support was not found. However, the config.log has this bit:

    configure:11358: checking for getaddrinfo
    configure:11376: /usr/bin/clang -o conftest -arch x86_64 -arch i386 -pipe -Os -fwrapv -arch x86_64 -arch i386 -I/opt/local/include -I/opt/local/include/db46 -arch x86_64 -arch i386 -isysroot / -L/opt/local/lib -Wl,-headerpad_max_install_names -L/opt/local/lib/db46 -arch x86_64 -arch i386 conftest.c -ldl  >&5
    conftest.c:221:10: fatal error: 'sys/types.h' file not found
    #include <sys/types.h>
             ^
    1 error generated.
    

    The failed program is:

    #include <sys/types.h>
    #include <sys/socket.h>
    #include <netdb.h>
    #include <stdio.h>
    
    int
    main ()
    {
    getaddrinfo(NULL, NULL, NULL, NULL);
      ;
      return 0;
    }
    

    And this failed to compile because sys/types.h wasn't found, instead of getaddrinfo not existing. And when I pasted this program into a file, the C compiler succeeded in compiling it.

    What is happening? What can I do about it?

  • Answers
  • miken32

    Are you using a current version of MacPorts? They've been providing binary packages for quite some time now. I'd start by upgrading, then uninstalling python27 and then re-installing.

    sudo port selfupdate
    sudo port -f uninstall python27
    sudo port clean python
    sudo port install python
    sudo port -uc upgrade outdated
    

    I just did this on my install, and it installed the binary package, no compilation needed.

    As to the actual error you're getting, I'd check that the XCode CLI tools are all installed; ls -lah /usr/include/sys/types.h should give you a file. If not, try xcode-select --install.


  • Related Question

    osx - Install Python Gtk using Mac Ports
  • brianegge

    I'm attempting to install the Gimp using Mac Ports on OSX 10.5. The Gimp won't build because it requires Python 2.5 gtk. I'm getting the following error when installing Python GTK:

    $ sudo port install py25-gtk
    Password:
    --->  Computing dependencies for py25-gtk
    --->  Staging py25-setuptools into destroot
    Error: Target org.macports.destroot returned: shell command " cd     "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py25-setuptools/work/setuptools-0.6c11" && /opt/local/bin/python2.5 setup.py --no-user-cfg install --prefix=/opt/local --root=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py25-setuptools/work/destroot " returned error 1
    Command output: sh: line 0: cd:     /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py25-setuptools/work/setuptools-0.6c11: No such file or directory
    
    Error: The following dependencies failed to build: py25-cairo py25-numpy py25-nose py25-setuptools
    Error: Status 1 encountered during processing.
    

    I'm thinking this might be related to the fact that I also have Python 2.6 installed, which I needed to do to get mercurial+svn working.


  • Related Answers
  • fideli

    Your problem may be similar to this one on the MacPorts trac site. The conclusion was that it was a corrupt Python 2.5 installation and removing and reinstalling python2.5 and all py25- ports solved the problem.

    Also, the macports-users mailing list is much more active than MacPorts-related posts here at superuser.com and your problem may be better solved there (or already solved, search first).