Error when Installing Pycurl on OS X - python

I am trying to install pycurl on OS X Mavericks. I have downloaded and installed the Xcode dev tools to have some compiler. I went into the Xcode preferences and made sure that I have downloaded all the compliers I would need but still getting this error
When I try to install pycurl I get the following errors. Any help would be much appreciated.
local-mbp:~ $ sudo easy_install pycurl
Password:
Searching for pycurl
Reading http://pypi.python.org/simple/pycurl/
Best match: pycurl 7.19.3.1
Downloading https://pypi.python.org/packages/source/p/pycurl/pycurl-7.19.3.1.tar.gz#md5=6df8fa7fe8b680d93248da1f8d4fcd12
Processing pycurl-7.19.3.1.tar.gz
Running pycurl-7.19.3.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-jKMmtE/pycurl-7.19.3.1/egg-dist-tmp-9z89Ns
Using curl-config (libcurl 7.30.0)
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: Setup script exited with error: command 'cc' failed with exit status 1
local-mbp:~ $ which gcc
/usr/bin/gcc
local-mbp:~$ which cc
/usr/bin/cc
local-mbp:~$

Try this:
brew install python
Double check you are using brewed Python:
which python
(Should return something like /usr/local/bin/python)
Install pycurl with pip.
pip install pycurl
I just tested this on Mavericks.

Try specify the ARCHFLAGS env var:
ARCHFLAGS="-arch x86_64" pip install pycurl

Related

Issue installing python bcrypt in Cygwin

I'm trying to install paramiko in Cygwin and one of the build dependencies is bcrypt.
I have rustc installed and I believe all of the supporting build libraries.
Pip is also updated to the latest.
$ pip --version
pip 22.2.2 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)
I use the following pip command:
pip install bcrypt
And I get the following error output:
error: failed to run custom build command for `pyo3-build-config v0.15.2`
Caused by:
process didn't exit successfully: `C:\Cygwin64\tmp\pip-install-19d9dusl\bcrypt_117761e212a240d8804ceae0beeb39c1\src\_bcrypt\target\release\build\pyo3-build-config-2ef06b5f5d02e46b\build-script-build` (exit code: 1)
--- stdout
cargo:rerun-if-env-changed=PYO3_CONFIG_FILE
cargo:rerun-if-env-changed=PYO3_NO_PYTHON
cargo:rerun-if-env-changed=PYO3_PYTHON
--- stderr
error: failed to run the Python interpreter at /usr/bin/python.exe: The system cannot find the path specified. (os error 3)
warning: build failed, waiting for other jobs to finish...
cargo rustc --lib --message-format=json-render-diagnostics --manifest-path src/_bcrypt/Cargo.toml --release -v --features pyo3/abi3-py36 pyo3/extension-module -- --crate-type cdylib
=============================DEBUG ASSISTANCE=============================
If you are seeing a compilation error please try the following steps to
successfully install bcrypt:
1) Upgrade to the latest pip and try again. This will fix errors for most
users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
2) Ensure you have a recent Rust toolchain installed. bcrypt requires
rustc >= 1.56.0.
Python: 3.8.12
platform: CYGWIN_NT-10.0-19044-3.3.5-341.x86_64-x86_64-64bit-WindowsPE
pip: n/a
setuptools: 65.3.0
setuptools_rust: 1.5.1
rustc: 1.63.0 (4b91a6ea7 2022-08-08)
=============================DEBUG ASSISTANCE=============================
error: `cargo rustc --lib --message-format=json-render-diagnostics --manifest-path src/_bcrypt/Cargo.toml --release -v --features 'pyo3/abi3-py36 pyo3/extension-module' -- --crate-type cdylib` failed with code 101
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for bcrypt Failed to build bcrypt ERROR: Could not build wheels for bcrypt, which is required to install pyproject.toml-based projects
I check my python installation (python.exe) and it is installed at /usr/bin/python.exe.
$ ls /usr/bin/python*
/usr/bin/python.exe /usr/bin/python2.7.exe /usr/bin/python3.8-config
/usr/bin/python2-config /usr/bin/python3 /usr/bin/python3.8.exe
/usr/bin/python2.7-config /usr/bin/python3-config
So I am confused.....what is the issue? Why can't it find my python interpreter? Why is bcrypt not building and installing?
I'm guessing that Cygwin causes some compatibility issues here.
It looks like Cygwin has a package for this purpose, likely to avoid these issues:
https://cygwin.com/packages/summary/python36-bcrypt.html

Can pip install a python egg via a local package tar.gz file

In my dev environment, due to some networking problems, when I run:
(my-virt-env)$ pip install lxml
It always fails due to:
Downloading/unpacking lxml
Downloading lxml-3.1.2.tar.gz (3.3Mb): 1.2Mb downloaded
Exception:
Traceback (most recent call last):
blablabla
error: [Errno 104] Connection reset by peer
Then I downloaded lxml-3.1.2.tar.gz from somewhere else and used an usb key to copy it over. Is there anyway I can tell pip not bother to go to the Internet for this package, just install it via the local tar.gz? So I can do something like:
(my-virt-env)$ pip install ${local_path}/lxml*.tar.gz
tried this command, I get very long error message:
pip install /home/shengjie/Downloads/lxml-3.1.2.tar.gz
Unpacking /home/shengjie/Downloads/lxml-3.1.2.tar.gz
Running setup.py egg_info for package from file:///home/shengjie/Downloads/lxml-3.1.2.tar.gz
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.1.2.
Building without Cython.
ERROR: /bin/sh: 1: xslt-config: not found
** make sure the development packages of libxml2 and libxslt are installed **
......................
bla bla bla
......................
/tmp/pip-Vg13dM-build/src/lxml/includes/etree_defs.h:9:31: fatal error: libxml/xmlversion.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
I am running Ubuntu, I know you can run `apt-get install python-lxml` and get it installed on your box. But that doesn't work for my case as I want install it in my virtual env: `my-virt-env`.
You can do it, the command is:
pip install --no-index --find-links=file:///[absolute path to your tar.gz]
What I'm seeing is that it's complaining that the DEV version of libxml2 and libxslt are missing.
Do an apt-get installation of those 2 packages, libxml2-dev and libxslt-dev, and perform your pip installation again and see how that goes.

Why am I getting the error: command 'llvm-gcc-4.2' failed with exit status 1

I am setting up os X 10.7.
I am using the default install of Python:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
I use a Python based package manager called easy_install.
Easy_install seems to not be able to find the compiler.
EDIT: When I tried to install MySQL-python I got this error:
$ sudo easy_install MySQL-python
Password:
Searching for MySQL-python
Reading http://pypi.python.org/simple/MySQL-python/
Reading http://sourceforge.net/projects/mysql-python/
Reading http://sourceforge.net/projects/mysql-python
Best match: MySQL-python 1.2.3
Downloading http://download.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.3.tar.gz
Processing MySQL-python-1.2.3.tar.gz
Running MySQL-python-1.2.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-P9H9WX/MySQL-python-1.2.3/egg-dist-tmp-rRTfZL
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
unable to execute llvm-gcc-4.2: No such file or directory
error: Setup script exited with error: command 'llvm-gcc-4.2' failed with exit status 1
error: Setup script exited with error: command 'llvm-gcc-4.2' failed with exit status 1
Xcode 4.1 used GCC, but with Xcode 4.2 that seems to have changed.
What compiler does Apple want us to use?
How do I setup the configuration so I can compile OSS?
I had the exact same problem when I upgraded from OSX 10.6 to 10.7. If you upgrade to 10.7 from 10.6, your version of Python may go from 2.6 to 2.7 and a result you may need to re-install most of your python packages.
Here's what worked for me:
Install the latest version of XCode from the App Store
Inside XCode, go to Preferences -> Downloads -> Components
download the Command Line Tools
That's all you need to do. Try to install again in a new shell. The command line tool installation will put llvm-gcc-4.2 into /usr/bin which should be in your default path. The installation also takes care of library paths and stuff that you don't really want to know about unless something breaks.
10.9 edit
If you're running 10.9 or higher, I think you might be able to run this from the command line instead to install the command line tools:
xcode-select --install
I haven't verified that this is an actual fix to the problem.
Alternative to installing Xcode, install GCC and related tools via:
https://github.com/kennethreitz/osx-gcc-installer
Sounds to me you ran into this issue. The thread shows a variety of solutions.
Hope that helps.
The fix is quite simple. Check out the following blogpost.
http://waqasshabbir.tumblr.com/post/19073648382/llvm-gcc-4-2-exe-error-on-mac-osx-lion-when-building
Using OS X 10.7.5 (Lion)
I tried the XCode solution, but my gevent pip installation still wasn't successful. Then, I tried building libevent from source but still no success with gevent installation. However, after I did
brew install libevent
I was able to successfully install gevent with
sudo pip install gevent
(Note: greenlet is also a dependency for gevent, so you may try installing it with pip as well. It was already installed on my machine.)
All of the suggestions here (Xcode command line options, and Kenneth Reitz' stuff) didn't work for me (I am on Mac OS X 10.7.5, Xcode 4.6.3).
What helped in the end was altering the cflags options in the mysql_config file (There were errors about 'unreconized command line options' while trying to 'sudo pip install MySQL-python').
See this post: cc1: error: unrecognized command line option "-Wno-null-conversion" within installing python-mysql on mac 10.7.5

problems with easy_install pycrypto

I'm trying install pycrypto on osx with easy_install and I'm getting the following error:
easy_install pycrypto
Searching for pycrypto
Reading http://pypi.python.org/simple/pycrypto/
Reading http://pycrypto.sourceforge.net
Reading http://www.pycrypto.org/
Reading http://www.amk.ca/python/code/crypto
Best match: pycrypto 2.3
Downloading http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.3.tar.gz
Processing pycrypto-2.3.tar.gz
Running pycrypto-2.3/setup.py -q bdist_egg --dist-dir /var/folders/3D/3D07iptvHZuzuYaeQDMFIU+++TI/-Tmp-/easy_install-00HgRU/pycrypto-2.3/egg-dist-tmp-BWGYsg
warning: GMP library not found; Not building Crypto.PublicKey._fastmath.
/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed
Installed assemblers are:
/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386
src/MD2.c:134: fatal error: error writing to -: Broken pipe
compilation terminated.
lipo: can't open input file: /var/folders/3D/3D07iptvHZuzuYaeQDMFIU+++TI/-Tmp-//ccoXuPRo.out (No such file or directory)
error: Setup script exited with error: command 'gcc-4.2' failed with exit status 1
I have this in my ~/.bash_profile to address this very issue:
# Set compile flags to not try to compile for PPC (no longer supported by xcode 4)
# (this is required for eg building pycrypto)
export ARCHFLAGS="-arch i386 -arch x86_64"
Yes, it's a result of installing Xcode 4. It tries to build for ppc, although Xcode 4 no longer has the relevant bits for that. See this question for ways round it: https://superuser.com/questions/259278/python-2-6-1-pycrypto-2-3-pypi-package-broken-pipe-during-build
xCode 5.1
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install pycrypto
Looks like this got a little more difficult with OSX 10.9. Here's the additional stuff I did:
brew install libffi
If you see the warning about how it's installed "keg-only", that means homebrew did not link it, so you'll need to provide some more info with export PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig. At that point the install blows up because by default OSX now dies on warning flags, so suppress that behavior as well:
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
Then you should be able to install with pip.

Problems installing PyCurl on python2.7.0+

pycurl installs fine on python2.6 but i get the following error when I try to install in on 2.7 via easy_install on maverick
$ sudo easy_install pycurl
install_dir /usr/local/lib/python2.7/dist-packages/
Searching for pycurl
Reading http://pypi.python.org/simple/pycurl/
Reading http://pycurl.sourceforge.net/
Reading http://pycurl.sourceforge.net/download/
Best match: pycurl 7.19.0
Downloading http://pycurl.sourceforge.net/download/pycurl-7.19.0.tar.gz
Processing pycurl-7.19.0.tar.gz
Running pycurl-7.19.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-PFzxzf/pycurl-7.19.0/egg-dist-tmp-oAFjdV
Using curl-config (libcurl 7.21.0)
src/pycurl.c:42: fatal error: Python.h: No such file or directory
compilation terminated.
error: Setup script exited with error: command 'gcc' failed with exit status 1
Is 2.7 not compatible with pycurl?
sudo apt-get install python-dev
This installs the Python development package that is required and fixes the problem of the missing header file.
(Please read the comment by Corey)

Categories