astropy: The C compiler used to compile Python gcc-4.2, and which is normally used to compile C extensions, is not available.

Running pip install --upgrade astropy throws:

The C compiler used to compile Python gcc-4.2, and
which is normally used to compile C extensions, is not
available. You can explicitly specify which compiler to
use by setting the CC environment variable, for example:
    
    CC=gcc python setup.py <command>
    
or if you are using MacOS X, you can try:
    
    CC=clang python setup.py <command>
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-mwnzXX/astropy/

I found a workaround by linking gcc-4.2 to clang: sudo ln -s /usr/bin/clang /usr/bin/gcc-4.2 I was wondering why the installer is trying to compile with a c compiler that is no longer supported on OS X and is pretty outdated on other systems.

Successful and unsuccessful logs attached. astropy-install-successful.txt astropy-install-unsuccessful.txt

My suggestion to solve this issue would be to use the environment c compiler by default rather than running a workaround to do so when the install fails. The original c compiler for python is clearly not needed to compile and run astropy properly, so the environment c compiler will do just fine.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 18 (10 by maintainers)

Most upvoted comments

@bsmith18 - did you try the suggested workaround? I think it might work with pip too, so:

CC=clang pip install astropy --upgrade

Any luck?

Unless someone has an idea how to fix this, I propose we mark this as “won’t fix” and move on. Since @mdboom and @embray couldn’t figure it out all those years ago, I am not very optimistic.