12

I get the following error trying to install Scrapy in a Mavericks OS.

I have command line tools and X11 installed I don't really know whats going on and I haven`t found the same error browsing through the Web. I think it might be related to some change in Xcode 5.1

Thanks for the answers!

this is part of the command output:

$pip install scrapy


. . . . Downloading/unpacking cryptography>=0.2.1 (from pyOpenSSL->scrapy) Downloading cryptography-0.3.tar.gz (208kB): 208kB downloaded Running setup.py egg_info for package cryptography OS/X: confusion between 'cc' versus 'gcc' (see issue 123) will not use '__thread' in the C code 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 Traceback (most recent call last): File "<string>", line 16, in <module> File "/Users/agonzamart/.virtualenvs/Parser/build/cryptography/setup.py", line 156, in <module> "test": PyTest, File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 112, in setup _setup_distribution = dist = klass(attrs) File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/dist.py", line 265, in __init__ self.fetch_build_eggs(attrs.pop('setup_requires')) File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/dist.py", line 289, in fetch_build_eggs parse_requirements(requires), installer=self.fetch_build_egg File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/pkg_resources.py", line 618, in resolve dist = best[req.key] = env.best_match(req, self, installer) File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/pkg_resources.py", line 862, in best_match return self.obtain(req, installer) # try and download/install File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/pkg_resources.py", line 874, in obtain return installer(requirement) File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/dist.py", line 339, in fetch_build_egg return cmd.easy_install(req) File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 623, in easy_install return self.install_item(spec, dist.location, tmpdir, deps) File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 653, in install_item dists = self.install_eggs(spec, download, tmpdir) File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 849, in install_eggs return self.build_and_install(setup_script, setup_base) File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1130, in build_and_install self.run_setup(setup_script, setup_base, args) File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1118, in run_setup raise DistutilsError("Setup script exited with %s" % (v.args[0],)) distutils.errors.DistutilsError: Setup script exited with error: command 'cc' failed with exit status 1 Complete output from command python setup.py egg_info: OS/X: confusion between 'cc' versus 'gcc' (see issue 123) will not use '__thread' in the C code 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 Traceback (most recent call last): File "<string>", line 16, in <module> File "/Users/agonzamart/.virtualenvs/Parser/build/cryptography/setup.py", line 156, in <module> "test": PyTest, File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 112, in setup _setup_distribution = dist = klass(attrs) File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/dist.py", line 265, in __init__ self.fetch_build_eggs(attrs.pop('setup_requires')) File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/dist.py", line 289, in fetch_build_eggs parse_requirements(requires), installer=self.fetch_build_egg File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/pkg_resources.py", line 618, in resolve dist = best[req.key] = env.best_match(req, self, installer) File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/pkg_resources.py", line 862, in best_match return self.obtain(req, installer) # try and download/install File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/pkg_resources.py", line 874, in obtain return installer(requirement) File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/dist.py", line 339, in fetch_build_egg return cmd.easy_install(req) File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 623, in easy_install return self.install_item(spec, dist.location, tmpdir, deps) File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 653, in install_item dists = self.install_eggs(spec, download, tmpdir) File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 849, in install_eggs return self.build_and_install(setup_script, setup_base) File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1130, in build_and_install self.run_setup(setup_script, setup_base, args) File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1118, in run_setup raise DistutilsError("Setup script exited with %s" % (v.args[0],)) distutils.errors.DistutilsError: Setup script exited with error: command 'cc' failed with exit status 1 ---------------------------------------- Cleaning up... Command python setup.py egg_info failed with error code 1 in /Users/agonzamart/.virtualenvs/Parser/build/cryptography 

2 Answers 2

23

It is due to a change in clang defaults in Xcode 5.1 and Apple not noticing that it would break extension module builds using the system Python. One workaround is to define the following environment variables first:

export CFLAGS=-Qunused-arguments export CPPFLAGS=-Qunused-arguments 

UPDATE [2014-05-16]: As expected, Apple has fixed this problem with updated system Pythons (2.7, 2.6, and 2.5) in OS X 10.9.3 so the workaround is no longer necessary when using the latest Mavericks and Xcode 5.1+. However, as of now, the workaround is still required for OS X 10.8.x (Mountain Lion, currently 10.8.5) if you are using Xcode 5.1+ there.

Sign up to request clarification or add additional context in comments.

6 Comments

Thank you Ned. This seems to not be working. I added the variables to my .bash_profile but I still get the same error.
Are you using sudo? If so, environment variable settings may not be getting copied into the sudo environment. Try sudo bash, then entering the export statements, then the pip or python command to install.
Thank you Ned, seems that it worked now! Could you explain or link me to somewhere why exporting those flags make it work? Thank you very much!!
Beginning with OS X 10.8 (IIRC), Apple switched from using gcc to clang to build OS X itself including the system Pythons. But they forgot to remove some gcc-only options in their build scripts. That didn't cause a problem because clang ignored them. With the introduction of Xcode 5.1, clang was changed to cause an error if it is called with any unknown arguments. That doesn't affect existing compiled bits of OS X 10.9. However, when you ask Python to build C extension modules, it tries to use the same compiler options as when Python itself was built. With 5.1, those options no longer work.
So, we can hope that Apple will fix the problem in an update to 10.9 (there are various easy ways for them to do that). It certainly will be fixed by the next release of OS X (10.10?) when all of Python will need to be rebuilt.
|
8

The latest version of clang raised to the level of error what used to be a warning. To switch back you can remove this behavior inline right before running your install command:

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install <your package> 

This should work, but just in case something goes wrong, there is more info here: clang error: unknown argument: '-mno-fused-madd' (python package installation failure)

2 Comments

Thanks. The other solution didn't work for me but this one worked. Thanks a bunch :)
Happy that I could help :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.