Pyenv has not worked since upgrading to Big Sur. This is how it started:
❯ pyenv install 3.8.0
python-build: use openssl#1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.0.tar.xz...
-> https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz
Installing Python-3.8.0...
python-build: use readline from homebrew
BUILD FAILED (OS X 11.1 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/_y/vdsjczjj3nvflspjcl8r68zr0000gq/T/python-build.20210131003659.3456
Results logged to /var/folders/_y/vdsjczjj3nvflspjcl8r68zr0000gq/T/python-build.20210131003659.3456.log
Last 10 log lines:
checking for python3.8... python3.8
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... "darwin"
checking for gcc... clang
checking whether the C compiler works... no
configure: error: in `/var/folders/_y/vdsjczjj3nvflspjcl8r68zr0000gq/T/python-build.20210131003659.3456/Python-3.8.0':
configure: error: C compiler cannot create executables
See `config.log' for more details
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
So I ran xcode-select --install. It went through, though I don't see a xrun directory under /Library/Developer/CommandLineTools/usr/bin/.
I read many different github issues' pages, StackOverflow posts, and tried many different things including brew install zlib sqlite bzip2 libiconv libzip. This is where I am right now:
❯ pyenv install 3.8.0
python-build: use openssl#1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.0.tar.xz...
-> https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz
Installing Python-3.8.0...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
BUILD FAILED (OS X 11.1 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/_y/vdsjczjj3nvflspjcl8r68zr0000gq/T/python-build.20210201012936.8553
Results logged to /var/folders/_y/vdsjczjj3nvflspjcl8r68zr0000gq/T/python-build.20210201012936.8553.log
Last 10 log lines:
^
clang -fno-strict-aliasing -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -L /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -L brew --prefix bzip2/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -L /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -L brew --prefix bzip2/include -std=c99 -Werror=implicit-function-declaration -I./Include/internal -I. -I./Include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/rayhanmuktader/.pyenv/versions/3.8.0/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/rayhanmuktader/.pyenv/versions/3.8.0/include -DPy_BUILD_CORE_BUILTIN -c ./Modules/pwdmodule.c -o Modules/pwdmodule.o
clang: warning: argument unused during compilation: '-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-Lbrew' [-Wunused-command-line-argument]
c
lang: warning: argument unused during compilation: '-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-Lbrew' [-Wunused-command-line-argument]
1 error generated.
make: *** [Modules/posixmodule.o] Error 1
make: *** Waiting for unfinished jobs....
1 warning generated.
My .zshrc looks this at the moment:
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
export PATH="$HOME/.poetry/bin:$PATH"
export LDFLAGS="-L $(xcrun --show-sdk-path)/usr/lib -L brew --prefix bzip2/lib"
export CFLAGS="-L $(xcrun --show-sdk-path)/usr/include -L brew --prefix bzip2/include"
I also tried SYSTEM_VERSION_COMPAT=1 pyenv install 3.8.0 but that didn't solve it either. If it helps anything, note that it hangs for an unusually long time at python-build: use zlib from xcode sdk line.
Thank you if read this far. Any help would be greatly appreciated.
This is what worked for me (kind of).
I followed step 1 and step 2 from https://koji-kanao.medium.com/install-python-3-8-0-via-pyenv-on-bigsur-b4246987a548
I upgraded to BigSur 11.2, installed XCode 12.5 beta from https://developer.apple.com/xcode/resources/. I also installed Command Line Tools for Xcode 12.5 beta from https://developer.apple.com/download/more/?=command%20line%20tools (I don't know if this was necessary)
My .zshrc looks like this:
eval "$(pyenv init -)"
fi
export PATH="$HOME/.poetry/bin:$PATH"
Then in order to install python 3.8.0 I ran:
$ CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" pyenv install --patch 3.8.0 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1)
This actually installed it. HOWEVER, when I ran poetry install on an existing project, it started installing the package then it suddenly blew up with the following error:
• Installing pynacl (1.3.0): Failed
ERROR: Failed building wheel for PyNaCl
Failed to build PyNaCl
ERROR: Could not build wheels for PyNaCl which use PEP 517 and cannot be installed directly
WARNING: You are using pip version 20.2.2; however, version 21.0.1 is available.
You should consider upgrading via the '/Users/rayhanmuktader/Library/Caches/pypoetry/virtualenvs/desk-backend-kAA1Wc9W-py3.8/bin/python -m pip install --upgrade pip' command.
at ~/.poetry/lib/poetry/utils/env.py:1074 in _run
1070│ output = subprocess.check_output(
1071│ cmd, stderr=subprocess.STDOUT, **kwargs
1072│ )
1073│ except CalledProcessError as e:
→ 1074│ raise EnvCommandError(e, input=input_)
1075│
1076│ return decode(output)
1077│
1078│ def execute(self, bin, *args, **kwargs):
The solution to this problem was running $ /Users/rayhanmuktader/Library/Caches/pypoetry/virtualenvs/desk-backend-kAA1Wc9W-py3.8/bin/python -m pip install pynacl==1.3.0 to install the pynacl package. Then running poetry install again to continue the installation process. Rinse and repeat for every package it fails to install through poetry install.
Related
pyenv seems to have issues on a Macbook with intel-chip and Big Sur.
Here's my system information:
$ brew --version
3.2.2
$ brew list
==> Formulae
autoconf gdbm mpdecimal pkg-config python#3.9 sqlite xz
bzip2 m4 openssl#1.1 pyenv readline tcl-tk zlib
$ xcodebuild -version
Xcode 12.5.1
Build version 12E507
$ xcode-select -version
xcode-select version 2384.
$ sw_vers
ProductName: macOS
ProductVersion: 11.4
BuildVersion: 20F71
Here's what happens when I try to install various pyenv versions:
$ pyenv install 3.9.6 # Success
$ pyenv install 3.8.11 # Success
$ pyenv install 3.7.11 # Success
$ pyenv install 3.6.14 # Error
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
BUILD FAILED (OS X 11.4 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/qr/wfhlfnfs62g7lf56wpk1ffp80000gp/T/python-build.20210715170801.48468
Results logged to /var/folders/qr/wfhlfnfs62g7lf56wpk1ffp80000gp/T/python-build.20210715170801.48468.log
Last 10 log lines:
ret = sendfile(in, out, offset, &sbytes, &sf, flags);
^
./Modules/posixmodule.c:10432:5: warning: code will never be executed [-Wunreachable-code]
Py_FatalError("abort() called from Python code didn't abort!");
^~~~~~~~~~~~~
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -I. -I./Include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl#1.1/include -I/Users/ranjan.lamichhane/.pyenv/versions/3.6.14/include -I/usr/local/opt/zlib/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl#1.1/include -I/Users/ranjan.lamichhane/.pyenv/versions/3.6.14/include -I/usr/local/opt/zlib/include -DPy_BUILD_CORE -c ./Modules/pwdmodule.c -o Modules/pwdmodule.o
1 warning and 1 error generated.
make: *** [Modules/posixmodule.o] Error 1
make: *** Waiting for unfinished jobs....
1 warning generated.
I have tried to fix it with suggestion found in some github issue threads but nothing seems to work.
I had same problem while installing python 3.7.6 both with brew and pyenv.
Running the following command fixed the problem:
CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" pyenv install --patch 3.7.6 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1)
I need to install sndfile. I'm on a Jupyter notebook, Python interpreter on IBM Watson studio.
I already installed the library libsndfile with !conda install -c conda-forge libsndfile.
When I call pip install sndfile, I get as error:
...
gcc -pthread -shared -B /home/spark/conda/envs/python3.6/compiler_compat -L/home/spark/conda/envs/python3.6/lib -Wl,-rpath=/home/spark/conda/envs/python3.6/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6/sndfile._sndfile.o -lsndfile -o build/lib.linux-x86_64-3.6/sndfile/_sndfile.abi3.so
/home/spark/conda/envs/python3.6/compiler_compat/ld: cannot find -lsndfile
...
But if I check the folder /home/spark/conda/envs/python3.6/lib for the library, actually it's there:
!ls /home/spark/conda/envs/python3.6/lib/libsnd*
/home/spark/conda/envs/python3.6/lib/libsndfile.a
/home/spark/conda/envs/python3.6/lib/libsndfile.so
/home/spark/conda/envs/python3.6/lib/libsndfile.so.1
/home/spark/conda/envs/python3.6/lib/libsndfile.so.1.0.28
What am I missing?
I am trying to install python-igraph using pip3 on Mac OS X 10.14, but the installation fails with the following error message:
$ pip3 install python-igraph
...snip...
gcc -bundle -undefined dynamic_lookup -L/Users/charles/.pyenv/versions/miniconda3-4.3.30/lib -arch x86_64 -L/Users/charles/.pyenv/versions/miniconda3-4.3.30/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.7-x86_64-3.6/src/edgeobject.o build/temp.macosx-10.7-x86_64-3.6/src/common.o build/temp.macosx-10.7-x86_64-3.6/src/py2compat.o build/temp.macosx-10.7-x86_64-3.6/src/graphobject.o build/temp.macosx-10.7-x86_64-3.6/src/indexing.o build/temp.macosx-10.7-x86_64-3.6/src/igraphmodule.o build/temp.macosx-10.7-x86_64-3.6/src/bfsiter.o build/temp.macosx-10.7-x86_64-3.6/src/convert.o build/temp.macosx-10.7-x86_64-3.6/src/vertexobject.o build/temp.macosx-10.7-x86_64-3.6/src/random.o build/temp.macosx-10.7-x86_64-3.6/src/edgeseqobject.o build/temp.macosx-10.7-x86_64-3.6/src/error.o build/temp.macosx-10.7-x86_64-3.6/src/vertexseqobject.o build/temp.macosx-10.7-x86_64-3.6/src/arpackobject.o build/temp.macosx-10.7-x86_64-3.6/src/attributes.o build/temp.macosx-10.7-x86_64-3.6/src/filehandle.o build/temp.macosx-10.7-x86_64-3.6/src/pyhelpers.o igraphcore/lib/libigraph.a -Ligraphcore/lib -L/usr/local/lib -L/usr/lib -lxml2 -lz -lm -lstdc++ -o build/lib.macosx-10.7-x86_64-3.6/igraph/_igraph.cpython-36m-darwin.so
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1
gcc version:
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
python version:
$ python3 --version
Python 3.6.7
(Side note, python and python3 point to the same python, and pip and pip3 point to the same (corresponding) pip.)
I also tried running xcode-select --install but this told me 'command line tools are already installed, use "Software Update" to install updates' (Xcode is up to date).
Run
export MACOSX_DEPLOYMENT_TARGET=10.9
before running pip install python-igraph. Then you should see it install successfully:
$ pip install python-igraph
Collecting python-igraph
Using cached https://files.pythonhosted.org/packages/0f/a0/4e7134f803737aa6eebb4e5250565ace0e2599659e22be7f7eba520ff017/python-igraph-0.7.1.post6.tar.gz
Building wheels for collected packages: python-igraph
Running setup.py bdist_wheel for python-igraph ... done
Stored in directory: /Users/charles/Library/Caches/pip/wheels/41/d6/02/34eebae97e25f5b87d60f4c0687e00523e3f244fa41bc3f4a7
Successfully built python-igraph
Installing collected packages: python-igraph
Successfully installed python-igraph-0.7.1.post6
Python library gevent, version 0.13.6 (the current version on PyPI) will not pip install on OS X Lion, Python 2.7 (and probably others.) It works fine on Snow Leopard.
How can I get this library installed?
Bonus points if it can be done using pip install, rather than a manual or custom process, because then it will play nicely with automated builds.
Here is my pip install output:
pip install gevent
Downloading/unpacking gevent
Running setup.py egg_info for package gevent
Requirement already satisfied (use --upgrade to upgrade): greenlet in ./tl_env/lib/python2.7/site-packages (from gevent)
Installing collected packages: gevent
Running setup.py install for gevent
building 'gevent.core' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c gevent/core.c -o build/temp.macosx-10.6-intel-2.7/gevent/core.o
In file included from gevent/core.c:225:
gevent/libevent.h:9:19: error: event.h: No such file or directory
gevent/libevent.h:38:20: error: evhttp.h: No such file or directory
gevent/libevent.h:39:19: error: evdns.h: No such file or directory
gevent/core.c:361: error: field ‘ev’ has incomplete type
gevent/core.c:741: warning: parameter names (without types) in function declaration
gevent/core.c: In function ‘__pyx_f_6gevent_4core___event_handler’:
gevent/core.c:1619: error: ‘EV_READ’ undeclared (first use in this function)
gevent/core.c:1619: error: (Each undeclared identifier is reported only once
gevent/core.c:15376: warning: assignment makes pointer from integer without a cast
[... about 1000 more lines of compiler errors...]
gevent/core.c:15385: error: dereferencing pointer to incomplete type
gevent/core.c: In function ‘__pyx_pf_6gevent_4core_4http___init__’:
gevent/core.c:15559: warning: assignment makes pointer from integer without a cast
gevent/core.c: At top level:
gevent/core.c:21272: error: expected ‘)’ before ‘val’
lipo: can't figure out the architecture type of: /var/folders/s5/t94kn0p10hdgxzx9_9sprpg40000gq/T//cczk54q7.out
error: command 'gcc-4.2' failed with exit status 1
Complete output from command /Users/jacob/code/toplevel/tl_env/bin/python -c "import setuptools;__file__='/Users/jacob/code/toplevel/tl_env/build/gevent/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /var/folders/s5/t94kn0p10hdgxzx9_9sprpg40000gq/T/pip-s2hPd3-record/install-record.txt --install-headers /Users/jacob/code/toplevel/tl_env/bin/../include/site/python2.7:
running install
running build
running build_py
running build_ext
building 'gevent.core' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c gevent/core.c -o build/temp.macosx-10.6-intel-2.7/gevent/core.o
Don't post the entire thing! That's too much! 90% of the time, the first error is enough...
gevent/libevent.h:9:19: error: event.h: No such file or directory
This means that the library which provides the event.h header is not installed. The library is called libevent (website).
In general, compilation errors like these are a flaw in the build scripts. The build script should give an error message that libevent is not installed, and it is a bug that it did not do so.
To get libevent from MacPorts and then manually tell compiler with CFLAGS environment variable where to find event.h and libevent while running pip.
sudo port install libevent
CFLAGS="-I /opt/local/include -L /opt/local/lib" pip install gevent
You can also use homebrew for installing libevent : brew install libevent
(from David Wolever's comment)
CFLAGS='-std=c99' pip install gevent
See in: Can't install gevent OSX 10.11
on OS X 10.11, clang uses c11 as the default, so just turn it back to c99.
After a while, I realized that the paths for the CFLAGS variable mentioned above works when installing libevent from port, but not from brew. The following worked for me (on OSX Mavericks):
$ brew install libevent
$ export CFLAGS="-I /usr/local/Cellar/libevent/2.0.21/include -L /usr/local/Cellar/libevent/2.0.21/lib"
$ pip install gevent
This is the way I found the easiest:
install libevent using homebrew
$ brew install libevent
install gevent
$ pip install gevent
This was the only way I could get it to work.
Found this answer when looking for help installing on Snow Leopard, posting this in case someone else comes this way with the same problem.
I had libevent installed via macports.
export CFLAGS=-I/opt/local/include
export LDFLAGS=-L/opt/local/lib
sudo pip install gevent
I had libevent installed via brew and it failed too, what worked was similar to what Stephen done, but pointing to brew default install:
CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib pip install gevent
In case you install all from sources and use csh the following works on mac os 10.9
download latest stable http://libevent.org/ libevent-2.0.21-stable
./configure
make
sudo make install
virtualenv env
source env/bin/activate.csh
setenv CFLAGS "-I /usr/local/include -L /usr/local/lib"
pip install gevent
I use virtualenv and virtualenv wrapper, and so I wanted this to be self contained. I got gevent working like so:
Assuming you have virtual env setup, then:
workon {my_virtual_env}
Then download libevent and install it against the virtualenv.
curl -L -O https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar -xzf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix="$VIRTUAL_ENV"
make && make install
I'm assuming you've got gcc 5+ installed (I use brew)
Hope this helps.
sudo pip install cython git+git://github.com/gevent/gevent.git#egg=gevent
I am using MacOs High Sierra (10.13.3)
First I did :
brew install libevent
I upgraded my pip version to pip-18.0.
then tried installing again with following :-
pip install gevent
it worked.
Python library gevent, version 0.13.6 (the current version on PyPI) will not pip install on OS X Lion, Python 2.7 (and probably others.) It works fine on Snow Leopard.
How can I get this library installed?
Bonus points if it can be done using pip install, rather than a manual or custom process, because then it will play nicely with automated builds.
Here is my pip install output:
pip install gevent
Downloading/unpacking gevent
Running setup.py egg_info for package gevent
Requirement already satisfied (use --upgrade to upgrade): greenlet in ./tl_env/lib/python2.7/site-packages (from gevent)
Installing collected packages: gevent
Running setup.py install for gevent
building 'gevent.core' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c gevent/core.c -o build/temp.macosx-10.6-intel-2.7/gevent/core.o
In file included from gevent/core.c:225:
gevent/libevent.h:9:19: error: event.h: No such file or directory
gevent/libevent.h:38:20: error: evhttp.h: No such file or directory
gevent/libevent.h:39:19: error: evdns.h: No such file or directory
gevent/core.c:361: error: field ‘ev’ has incomplete type
gevent/core.c:741: warning: parameter names (without types) in function declaration
gevent/core.c: In function ‘__pyx_f_6gevent_4core___event_handler’:
gevent/core.c:1619: error: ‘EV_READ’ undeclared (first use in this function)
gevent/core.c:1619: error: (Each undeclared identifier is reported only once
gevent/core.c:15376: warning: assignment makes pointer from integer without a cast
[... about 1000 more lines of compiler errors...]
gevent/core.c:15385: error: dereferencing pointer to incomplete type
gevent/core.c: In function ‘__pyx_pf_6gevent_4core_4http___init__’:
gevent/core.c:15559: warning: assignment makes pointer from integer without a cast
gevent/core.c: At top level:
gevent/core.c:21272: error: expected ‘)’ before ‘val’
lipo: can't figure out the architecture type of: /var/folders/s5/t94kn0p10hdgxzx9_9sprpg40000gq/T//cczk54q7.out
error: command 'gcc-4.2' failed with exit status 1
Complete output from command /Users/jacob/code/toplevel/tl_env/bin/python -c "import setuptools;__file__='/Users/jacob/code/toplevel/tl_env/build/gevent/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /var/folders/s5/t94kn0p10hdgxzx9_9sprpg40000gq/T/pip-s2hPd3-record/install-record.txt --install-headers /Users/jacob/code/toplevel/tl_env/bin/../include/site/python2.7:
running install
running build
running build_py
running build_ext
building 'gevent.core' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c gevent/core.c -o build/temp.macosx-10.6-intel-2.7/gevent/core.o
Don't post the entire thing! That's too much! 90% of the time, the first error is enough...
gevent/libevent.h:9:19: error: event.h: No such file or directory
This means that the library which provides the event.h header is not installed. The library is called libevent (website).
In general, compilation errors like these are a flaw in the build scripts. The build script should give an error message that libevent is not installed, and it is a bug that it did not do so.
To get libevent from MacPorts and then manually tell compiler with CFLAGS environment variable where to find event.h and libevent while running pip.
sudo port install libevent
CFLAGS="-I /opt/local/include -L /opt/local/lib" pip install gevent
You can also use homebrew for installing libevent : brew install libevent
(from David Wolever's comment)
CFLAGS='-std=c99' pip install gevent
See in: Can't install gevent OSX 10.11
on OS X 10.11, clang uses c11 as the default, so just turn it back to c99.
After a while, I realized that the paths for the CFLAGS variable mentioned above works when installing libevent from port, but not from brew. The following worked for me (on OSX Mavericks):
$ brew install libevent
$ export CFLAGS="-I /usr/local/Cellar/libevent/2.0.21/include -L /usr/local/Cellar/libevent/2.0.21/lib"
$ pip install gevent
This is the way I found the easiest:
install libevent using homebrew
$ brew install libevent
install gevent
$ pip install gevent
This was the only way I could get it to work.
Found this answer when looking for help installing on Snow Leopard, posting this in case someone else comes this way with the same problem.
I had libevent installed via macports.
export CFLAGS=-I/opt/local/include
export LDFLAGS=-L/opt/local/lib
sudo pip install gevent
I had libevent installed via brew and it failed too, what worked was similar to what Stephen done, but pointing to brew default install:
CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib pip install gevent
In case you install all from sources and use csh the following works on mac os 10.9
download latest stable http://libevent.org/ libevent-2.0.21-stable
./configure
make
sudo make install
virtualenv env
source env/bin/activate.csh
setenv CFLAGS "-I /usr/local/include -L /usr/local/lib"
pip install gevent
I use virtualenv and virtualenv wrapper, and so I wanted this to be self contained. I got gevent working like so:
Assuming you have virtual env setup, then:
workon {my_virtual_env}
Then download libevent and install it against the virtualenv.
curl -L -O https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar -xzf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix="$VIRTUAL_ENV"
make && make install
I'm assuming you've got gcc 5+ installed (I use brew)
Hope this helps.
sudo pip install cython git+git://github.com/gevent/gevent.git#egg=gevent
I am using MacOs High Sierra (10.13.3)
First I did :
brew install libevent
I upgraded my pip version to pip-18.0.
then tried installing again with following :-
pip install gevent
it worked.