Installing gevent on Mavericks (Enthought Canopy python) - python-2.7

Has anyone had any luck building gevent 1.0 in Mavericks?
I've tried the following:
pip (as recommended on the gevent package index)
easy_install
compiling from source
I keep getting the same error when building 'gevent.core':
...
building 'gevent.core' extension
creating build/temp.macosx-10.6-i386-2.7/gevent
Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/MacOSX10.6.sdk
Please check your Xcode installation
gcc -DNDEBUG -g -O3 -arch i386 -isysroot /Developer/SDKs/MacOSX10.6.sdk -U__llvm__ -
DLIBEV_EMBED=1 -DEV_COMMON= -DEV_CHECK_ENABLE=0 -DEV_CLEANUP_ENABLE=0 -DEV_EMBED_ENABLE=0
-DEV_PERIODIC_ENABLE=0 -Ibuild/temp.macosx-10.6-i386-2.7/libev -Ilibev -
I/Applications/Canopy.app/appdata/canopy-1.2.0.1610.macosx-
x86/Canopy.app/Contents/include/python2.7 -c gevent/gevent.core.c -o build/temp.macosx-
10.6-i386-2.7/gevent/gevent.core.o
clang: warning: no such sysroot directory: '/Developer/SDKs/MacOSX10.6.sdk'
In file included from gevent/gevent.core.c:17:
/Applications/Canopy.app/appdata/canopy-1.2.0.1610.macosx-
x86/Canopy.app/Contents/include/python2.7/Python.h:33:10: fatal error:
'stdio.h' file not found
#include <stdio.h>
^
1 error generated.
error: command 'gcc' failed with exit status 1
Seems to be a problem with XCode. I made sure I have the XCode (v. 5.0.2) command line tools installed with:
xcode-select --install
But that didn't seem to change anything. Apparently I'm not alone with this problem (a missing /Developer/SDKs/MacOSX10.6.sdk), but I'd like to stick with Enthought's Canopy version of python if I can (and have already spent too much time combing the Apple Developer site to try download MacOSX10.6.sdk directly).
Any suggestions that don't involve starting over with a macport'ed python? Thanks!

IIUC, Apple pulled a fast one on the latest XCode, such that gcc is no longer actually gcc, but is symlinked to clang, which is not compatible with standard Pythons, including Canopy's.
It should work better if you install Xcode 3.2.1 Developer Tools from https://developer.apple.com/downloads/index.action

For me the hint on gevent website helped:
pip install cython git+git://github.com/gevent/gevent.git#egg=gevent

Related

fatal error: 'openssl/evp.h' file not found cmake + make

Operating system: macOS Catalina
I have a project that has a file called CMakeLists.txt. I ran cmake and then make, but the make command failed:
/Users/blablabla/Downloads/myproject/src/main.cpp:10:10: fatal error:
'openssl/evp.h' file not found
#include <openssl/evp.h>
I tried reinstalling OpenSSL via homebrew, linking the libraries but it still gave this error.
What am I could be doing wrong?
Any help would be highly appreciated
either openssl's dev library is not installed, or the g++ command that cmake generates probably is missing a -I.
try sudo apt-get install libssl-dev first and if that doesn't work, make sure the openssl include dir is provided to g++.
according to https://cmake.org/cmake/help/v3.6/module/FindOpenSSL.html, it creates an env var of OPENSSL_INCLUDE_DIR
edit: just noticed you're on OSX. you can install the the dev libssl package with brew install openssl

Linking not working in homebrew's cmake since Mojave

I've reproduced this symptom on two computers now, cmake seems to no longer look in /usr/local/lib (or more properly, $(brew --prefix)/lib) for Homebrew-provided libraries since upgrading my machine to macOS Mojave.
Although there are ways to circumvent this (e.g. search for homebrew prefix using EXECUTE_PROCESS; add the result to LINK_LIBRARIES(...) command) none are ideal. What changed in Mojave to break this behavior?
The temporary workaround is to add the following to CMakeLists.txt:
# WARNING: Don't hard-code this path
LINK_DIRECTORIES(/usr/local/lib)
I've already tried brew doctor and updated all homebrew packages to no avail.
The specific error that cmake (make) shows is:
ld: library not found for -l<somelib>
I've asked the question on the Homebrew forums and the Apple developer forums.
Ran into a related (?) issue while trying to pip install psycopg2 in a Django app under OS X Mojave (10.14). I was getting the following errors:
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
The short explanation: « As of High Sierra, /usr/local is no longer
chown-able... »
The solution: change permissions for /usr/local to allow Homebrew to
create links.
I adapted the solution to my needs. Then I was finally able to run pip install psycopg2. Here is the sequence of commands (update: inside your project root i.e. where you see manage.py).
First
sudo chown -R $(whoami) $(brew --prefix)/*
Then
brew reinstall openssl
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
pip install psycopg2
I've isolated this to the following change in the VERBOSE=1 make logs...
High Sierra (<=10.13) and below did NOT use the -isysroot command.
Mojave (>=10.14) DOES use the -isysroot command.
From gnu.org:
-isysroot <dir>
This option is like the --sysroot option, but applies only to header files (except for Darwin targets, where it applies to both header files and libraries). See the --sysroot option for more information.
So this flag specifically clobbers the lib search path only on Apple. This results in the compilation never looking in the standard ld locations, which can be seen by typing ld -v dummy.
Library search paths:
/usr/lib
/usr/local/lib
Why does cmake do this? My thought is it was to fix the /usr/local/include issues introduced with the new Mojave SDK behavior.
Unfortunately, I can't find a cmake compile flag to add the default library search paths back in. For now the only solution I've found is to add the following to my project:
IF(APPLE)
# Fix linking on 10.14+. See https://stackoverflow.com/questions/54068035
LINK_DIRECTORIES(/usr/local/lib)
ENDIF()
I'm not sure if this is a behavior that warrants an upstream cmake patch. If there is a better solution, please provide it.

luarocks 'gcc-plugin.h' build error

I am trying to use torch together with the hdf5 package. I am trying to install it via luarocks install hdf5 but during the build phase I get an error regarding the gcc-plugin header. (gcc relies on clang backend). The complete error message is:
luarocks install --local hdf5
Installing https://luarocks.org/hdf5-2.0.0-1.src.rock...
Using https://luarocks.org/hdf5-2.0.0-1.src.rock... switching to 'build' mode
Warning: variable CFLAGS was not passed in build_variables
gcclua-config.h:1:10: fatal error: 'gcc-plugin.h' file not found
#include "gcc-plugin.h"
^
1 error generated.
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -c -o gcclua.o -Iplugin/include -fPIC -O2 -Wall -Wformat-security -I/usr/local/Cellar/lua/5.2.4_3/include gcclua.c
gcclua.c:7:10: fatal error: 'gcc-plugin.h' file not found
#include "gcc-plugin.h"
^
1 error generated.
make[2]: *** [gcclua.o] Error 1
make[1]: *** [gcc] Error 2
make: *** [gcc-lua] Error 2
Just to give more information, I am relying on
gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
xcrun: error: couldn't stat toolchain: '/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.11.xctoolchain' (errno=No such file or directory)
Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Does anybody has maybe a hint how to fix this issue?
Every help is greatly appreciated!!!
In addition to gcc, you need the headers, which on Linux you can get with sudo apt-get install gcc-4.8-plugin-dev. If you're on a different OS or version of gcc, just substitute the appropriate package manager / gcc version number.
gcc-plugin.h is a part of GCC, so I think you'll really need to install gcc to get that. Clang provides a gcc-compatible front-end script but that merely presents a command-line driver with compatible flags.
You should be able to install GCC using Homebrew: https://apple.stackexchange.com/a/86588
I bet you tried to work on a CS287-16 class :). I have contacted the developer of this library who wasn't that easy to do something to solve the problem. Apparently he has no friends who have a Mac PC... As a workaround I could suggest you to use a Docker container with Linux in it to run Lua scripts. That's what I have ended up with...
Here's the Docker image I was talking about: https://github.com/aoboturov/cs287-16-lua. You could build it yourself and the just run as a Docker container :)

Python pip can't seem to find Python.h despite python-dev installed

I am currently trying to install getch, a simple python package and have run into quite a bit of difficulty. I recently installed pypy in a kind of messy way (I wanted to get numpy with pypy working, which was a considerable pain) so that might have to do with the problem I'm having.
Okay, so I try to run
sudo pip install getch
and I get the error...
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
and as a bonus, a character encoding error.
This is the error that folks get when they don't have python-dev installed. However, I do. I attempted to work around this issue, by downloading the package and installing it manually.
sudo python setup.py install
also gave me the gcc error from above. I have gcc installed, and x86_64-linux-gnu-gcc works in terminal fine. I made a simple hello world program in c that simply includes Python.h. That worked fine as well. After remove --purging pypy, python, and python-dev from my system, I re-installed just python and python-dev and I still have the same silly issue.
Anyone have any thoughts?
Here's a pastebin of the exact error I'm getting. pastebin.com/mjRdADZx
You need to manually download the Python 2 version and install it. The version downloaded by pip is for Python 3.
The clue is this line:
Downloading/unpacking getch
Downloading getch-1.0.tar.gz # This is the Python 3 package
Running setup.py egg_info for package getch
Installing collected packages: getch
Running setup.py install for getch
building 'getch' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -I/usr/include -I/usr/include/python2.7 -c getchmodule.c -o build/temp.linux-i686-2.7/getchmodule.o
getchmodule.c: In function ‘getch_getche’:
getchmodule.c:36:6: warning: unused variable ‘ok’ [-Wunused-variable]
getchmodule.c: In function ‘getch_getch’:
getchmodule.c:43:6: warning: unused variable ‘ok’ [-Wunused-variable]
getchmodule.c: At top level:
getchmodule.c:54:15: error: variable ‘getchmodule’ has initializer but incomplete type
getchmodule.c:55:4: error: ‘PyModuleDef_HEAD_INIT’ undeclared here (not in a function)
The Python 2 version is also 1.0, but the file name is getch-1.0-python2.tar.gz. You can download it directly from the index.
Once downloaded, extract the archive and then python setup.py install from within the extracted directory.

error happens during installation of pyipopt in Ubuntu 12.04

having installed IPOPT and trying to install pyipopt in Ubuntu 12.04 box, I encountered the following error:
python setup.py install
results in the following error:
running install
running build
running build_py
running build_ext
building 'pyipoptcore' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include/coin/ -I/usr/include/python2.7 -c src/callback.c -o build/temp.linux-x86_64-2.7/src/callback.o
In file included from src/callback.c:36:0:
src/hook.h:5:29: fatal error: IpStdCInterface.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
any ideas ?
this is the interface for the ipopt library which is required to compile. as stated in the setup.py file
# You will probably have to edit this file in unpredictable ways
# if you want pyipopt to work for you, sorry.
the easiest way to handle this is to adjust the setup.py accordingly:
# When I installed Ipopt from source, I used the
# --prefix=/usr/local
# option, so this is where I want pyipopt to look for my ipopt installation.
# I only installed from source because the ipopt packaging
# for my linux distribution was buggy,
# so by the time you read this the bugs have probably been fixed
# and you will want to specify a different directory here.
IPOPT_DIR = '/usr/local/'
adjust IPOPT_DIR to the path where the library has been installed on your system, which of course should has been conducted anyway.
EDIT:
If you are installing from source, just use --prefix=/usr/local for the configure script and compile and install the library by running make; sudo make install. Then you don't have to change the setup.py file.