Recibo el siguiente error al intentar instalar psycopg2
través de pip en Mavericks 10.9:
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
No estoy seguro de cómo proceder y he buscado aquí y en otros lugares por este error en particular. ¡Cualquier ayuda es muy apreciada!
Aquí está la salida completa de pip:
$ pip install psycopg2 Downloading/unpacking psycopg2 Downloading psycopg2-2.5.2.tar.gz (685kB): 685kB downloaded Running setup.py (path:/private/var/folders/0z/ljjwsjmn4v9_zwm81vhxj69m0000gn/T/pip_build_tino/psycopg2/setup.py) egg_info for package psycopg2 Installing collected packages: psycopg2 Running setup.py install for psycopg2 building 'psycopg2._psycopg' extension cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090303 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.3.3/include -I/usr/local/Cellar/postgresql/9.3.3/include/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.9-intel-2.7/psycopg/psycopgmodule.o clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future] clang: note: this will be a hard error (cannot be downgraded to a warning) in the future error: command 'cc' failed with exit status 1 Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/0z/ljjwsjmn4v9_zwm81vhxj69m0000gn/T/pip_build_tino/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/0z/ljjwsjmn4v9_zwm81vhxj69m0000gn/T/pip-bnWiwB-record/install-record.txt --single-version-externally-managed --compile: running install running build running build_py creating build creating build/lib.macosx-10.9-intel-2.7 creating build/lib.macosx-10.9-intel-2.7/psycopg2 copying lib/__init__.py -> build/lib.macosx-10.9-intel-2.7/psycopg2 copying lib/_json.py -> build/lib.macosx-10.9-intel-2.7/psycopg2 copying lib/_range.py -> build/lib.macosx-10.9-intel-2.7/psycopg2 copying lib/errorcodes.py -> build/lib.macosx-10.9-intel-2.7/psycopg2 copying lib/extensions.py -> build/lib.macosx-10.9-intel-2.7/psycopg2 copying lib/extras.py -> build/lib.macosx-10.9-intel-2.7/psycopg2 copying lib/pool.py -> build/lib.macosx-10.9-intel-2.7/psycopg2 copying lib/psycopg1.py -> build/lib.macosx-10.9-intel-2.7/psycopg2 copying lib/tz.py -> build/lib.macosx-10.9-intel-2.7/psycopg2 creating build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/__init__.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/dbapi20.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/dbapi20_tpc.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/test_async.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/test_bug_gc.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/test_bugX000.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/test_cancel.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/test_connection.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/test_copy.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/test_cursor.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/test_dates.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/test_extras_dictcursor.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/test_green.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/test_lobject.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/test_module.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/test_notify.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/test_psycopg2_dbapi20.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/test_quote.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/test_transaction.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/test_types_basic.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/test_types_extras.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/test_with.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/testconfig.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests copying tests/testutils.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests running build_ext building 'psycopg2._psycopg' extension creating build/temp.macosx-10.9-intel-2.7 creating build/temp.macosx-10.9-intel-2.7/psycopg cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090303 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.3.3/include -I/usr/local/Cellar/postgresql/9.3.3/include/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.9-intel-2.7/psycopg/psycopgmodule.o clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future] clang: note: this will be a hard error (cannot be downgraded to a warning) in the future error: command 'cc' failed with exit status 1 ---------------------------------------- Cleaning up... Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/0z/ljjwsjmn4v9_zwm81vhxj69m0000gn/T/pip_build_tino/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/0z/ljjwsjmn4v9_zwm81vhxj69m0000gn/T/pip-bnWiwB-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/0z/ljjwsjmn4v9_zwm81vhxj69m0000gn/T/pip_build_tino/psycopg2
Puede indicar a clang que no genere esto como un error configurando las siguientes variables de entorno antes de la comstackción:
export CFLAGS=-Qunused-arguments export CPPFLAGS=-Qunused-arguments
Entonces pip install psycopg2
debería funcionar.
Tuve lo mismo cuando intentaba pip install lxml
.
Edición: si está instalando como superusuario (que probablemente será el caso si está tratando de adjuntar a /Library/Python/2.7/site-packages
, la distribución Python de Apple instalada de fábrica que se envía con OS X, en lugar de alguna otra distribución de Python que usted mismo haya instalado posteriormente, entonces deberá hacerlo, como lo describe @Thijs Kuipers en los comentarios a continuación:
sudo -E pip install psycopg2
o el equivalente, para cualquier otro nombre de paquete que pueda estar sustituyendo en lugar de psycopg2
.
ACTUALIZACIÓN [2014-05-16]: Apple solucionó este problema con el sistema actualizado Pythons (2.7, 2.6 y 2.5) en OS X 10.9.3
por lo que la solución ya no es necesaria cuando se utilizan los últimos Mavericks y Xcode 5.1+
. Sin embargo, a partir de ahora, aún se requiere una solución para OS X 10.8.x
(Mountain Lion, actualmente 10.8.5) si está usando Xcode 5.1+
allí.
Actualización: 10.9.3 resuelve el problema con el sistema CPython.
Esto se debe a la última actualización de Clang de Apple que vino con Xcode 5.1 hoy y afecta a muchas, muchas personas, así que espero que pronto aparezca una solución.
Actualización: no esperaba que esto le prestara tanta atención, pero aquí hay más detalles: el clang 3.4 Apple está enviando por defecto errores en banderas desconocidas, pero CPython construye módulos utilizando el mismo conjunto de banderas con las que fue comstackdo originalmente. El sistema CPython se compiló con varias marcas que el clang desconoce, lo que causa este problema. Los siguientes son los indicadores de comstackción actuales de Mavericks (10.9.2) CPython:
-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE
Para resolver este problema tienes algunas opciones:
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future
a sus banderas de comstackción. CFLAGS=""
xCode 5.1
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install psycopg2
Aquí hay una solución alternativa que consiste en eliminar la bandera de la instalación de python.
En /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_sysconfigdata.py
hay varios lugares donde se establece el -mfused-madd
/ -mno-fused-madd
.
Edite este archivo y elimine todas las referencias a esa marca en la que debería funcionar su comstackción:
sudo sed -i '.old' 's/ -m\(no-\)\{0,1\}fused-madd //g' /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_sysconfigdata.py
También debe eliminar los _sysconfigdata.pyc
correspondientes _sysconfigdata.pyc
y _sysconfigdata.pyo
: al menos en mi sistema, estos archivos no se reconstruyeron automáticamente:
cd /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ sudo rm _sysconfigdata.pyo _sysconfigdata.pyc
Tenga en cuenta que tiene que usar el acceso de root para hacer esos cambios.
También edité la noción del sistema python de sus banderas de comstackción originales (como lo hizo @ user3405479). En lugar de un editor, utilicé herramientas de línea de comandos para editar el archivo “en su lugar” (el inodo cambia). También compilé nuevos archivos pyo y pyc en lugar de dejarlos borrados.
Los siguientes comandos se ejecutan como root, por ejemplo, bajo sudo -i
pushd /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
sed 's/-mno-fused-madd//g' _sysconfigdata.py \ | diff -p _sysconfigdata.py - | patch -b
python -m py_compile _sysconfigdata.py
python -OO -m py_compile _sysconfigdata.py
popd
Usé homebrew para instalar postgresql, y luego quise instalar psycopg2 en el python 2.7 provisto por el sistema en Mavericks. Para que eso funcionara terminé ejecutando esto:
sudo ARCHFLAGS="-arch x86_64" CFLAGS=-Wunused-command-line-argument-hard-error-in-future pip install psycopg2
Al menos Apple es consciente de esto, ya que este problema se trata en las Notas de la versión de Xcode 5.1 (sección del comstackdor). Espere una actualización de Python y Ruby en la próxima actualización del sistema operativo (¡con los dedos cruzados!). También tenga en cuenta que el -Wno-error=unused-command-line-argument-hard-error-in-future
está destinado a ser una solución temporal y desaparecerá en el futuro (¡espero que después de que el sistema Python esté arreglado!).
Si eres un mantenedor de paquetes de Python como yo y quieres ahorrarles a tus usuarios la molestia de solucionar esto, aquí hay una solución (además de proporcionar ruedas / huevos binarios) que se setup.py
en tu archivo setup.py
:
from distutils.command.build_ext import build_ext import subprocess import sys # Workaround for OS X 10.9.2 and Xcode 5.1+ # The latest clang treats unrecognized command-line options as errors and the # Python CFLAGS variable contains unrecognized ones (eg -mno-fused-madd). # See Xcode 5.1 Release Notes (Compiler section) and # http://stackoverflow.com/questions/22313407 for more details. This workaround # follows the approach suggested in http://stackoverflow.com/questions/724664. class build_ext_subclass(build_ext): def build_extensions(self): if sys.platform == 'darwin': # Test the compiler that will actually be used to see if it likes flags proc = subprocess.Popen(self.compiler.compiler + ['-v'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) stdout, stderr = proc.communicate() clang_mesg = "clang: error: unknown argument: '-mno-fused-madd'" if proc.returncode and stderr.splitlines()[0].startswith(clang_mesg): for ext in self.extensions: # Use temporary workaround to ignore invalid compiler option # Hopefully -mno-fused-madd goes away before this workaround! ext.extra_compile_args += ['-Wno-error=unused-command-line-argument-hard-error-in-future'] build_ext.build_extensions(self) setup( name="mypackage", ... cmdclass={'build_ext' : build_ext_subclass}, ... )
Ninguna de las soluciones anteriores funcionó para mí. Mi situación es ligeramente diferente. Estaba intentando instalar rdiff-backup a través de homebrew cuando recibí este mensaje de error.
Aparentemente tengo el python predeterminado de Apple (2.7.5 @ / usr / bin / python) y el python de Homebrew (2.7.6 @ /usr/local/Cellar/python/2.7.6/bin/python), pero el error venía de la python de Apple.
Para solucionar el problema, básicamente cambié los binarios de python.
Hice esto a través de sudo:
Entonces, ‘brew install rdiff-backup’ tuvo éxito sin ningún error.
Finalmente, hice “mv / usr / bin / python_orig / usr / bin / python” para revertir todo.
Probablemente estés en Python 2.7.5
$ python Python 2.7.5 (default, Aug 25 2013, 00:04:04) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
La solución más fácil, vaya a http://www.python.org e instale Python 2.7.6 que es compatible con LLVM 5.1.
Luego rmvirtualenv {virtual_env_name}
su antiguo entorno virtual, rmvirtualenv {virtual_env_name}
.
Entonces haz un nuevo env virtual.
mkvirtualenv --no-site-packages -p/Library/Frameworks/Python.framework/Versions/2.7/bin/python {virtual_env_name}
pip debería funcionar bien después de esto.
Intentar pip install paramiko
en Amazon Linux AMI release 2016.09
me dio un error que incluía un enlace a esta publicación SO. Entonces, aunque no se ajuste al título de OP, voy a compartir la respuesta.
yum install libffi-devel yum install gcc yum install openssl-devel pip install paramiko
Usé el paquete homebrew de python. Funciona bien después de volver a comstackr.
Variación en la corrección _sysconfigdata.py: usar un entorno virtual
cp /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_sysconfigdata.py ${VIRTUAL_ENV}/lib/python2.7/_sysconfigdata.py
Luego edita tu copia en $ {VIRTUAL_ENV} /lib/python2.7/_sysconfigdata.py
Eliminé todas las apariciones de ‘-mno-fused-madd’ y luego las comstackciones funcionaron en ese virtualenv.
¡No se necesita raíz!
Para mí, las malas banderas se dieron explícitamente en el archivo Makefile del paquete. Así que tuve que editar el makefile para eliminar la marca no reconocida del paquete de errores.
Actualizar Homebrew e instalar unixodbc lo resolvió por mí
brew upgrade brew install unixodbc