Hi,
I've previously installed FreeSWITCH and Plivo successfully on Ubuntu 12.04.2 using the instructions at
http://docs.plivo.org/get-started/. However, I tried following these
instructions again a few days ago and hit 2 problems. I suspect that some Ubuntu packages or Python eggs have been updated and this has caused the problems to be exposed.
1) Missing event.h
The first problem is that the install fails due to gevent failing to build because event.h is missing.
Installing collected packages: gevent, greenlet
Running setup.py install for gevent
building 'gevent.core' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c gevent/core.c -o build/temp.linux-x86_64-2.7/gevent/core.o
In file included from gevent/core.c:253:0:
gevent/libevent.h:9:19: fatal error: event.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
event.h is part of libevent-dev, so installing this with "apt-get install libevent-dev" or adding it to the list of packages at plivo_install.sh;81 fixes this.
2) Install to /usr/local/plivo fails
After fixing this, I still see the following error.
Installing collected packages: plivo, flask, ujson, redis, Werkzeug, Jinja2, markupsafe
Running setup.py develop for plivo
error: None
Complete output from command /usr/local/plivo/bin/python -c "import setuptools; __file__='/usr/local/plivo/src/plivo/setup.py'; exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" develop --no-deps:
running develop
error: None
Running "DISTUTILS_DEBUG=1 /usr/local/plivo/bin/python -c "import setuptools; __file__='/usr/local/plivo/src/plivo/setup.py'; exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" develop --no-deps" gives more information on the
failure.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/plivo/src/plivo/setup.py", line 71, in <module>
setup(**setup_args)
File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 971, in run_command
cmd_obj.ensure_finalized()
File "/usr/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
self.finalize_options()
File "/usr/local/plivo/local/lib/python2.7/site-packages/setuptools/command/develop.py", line 51, in finalize_options
easy_install.finalize_options(self)
File "/usr/local/plivo/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 227, in finalize_options
prefix, exec_prefix = get_config_vars('prefix', 'exec_prefix')
File "/usr/lib/python2.7/sysconfig.py", line 476, in get_config_vars
_init_posix(_CONFIG_VARS)
File "/usr/lib/python2.7/sysconfig.py", line 344, in _init_posix
raise IOError(msg)
IOError: invalid Python installation: unable to open /usr/plivo/lib/python2.7/config/Makefile (No such file or directory)
For some reason, sysconfig.py is deciding to strip the "local" from /usr/local/plivo and so is looking for the Makefile in the wrong place. (Looking at the code, it does this explicitly, but there's no comment as to why.) This behavior seems to have
changed/been fixed in later versions of Python. I worked around it by first installing to /usr/plivo (with "bash plivo_install.sh /usr/plivo") and then reinstalling to /usr/local/plivo (with "bash plivo_install.sh /usr/local/plivo") - very hacky, but it seems
to work. I'm not sure what the "right" fix is here, apart from upgrading Python (although Ubuntu 12.04.2 doesn't come with a more recent version).
Has anyone else seen these issues, do you agree they're worth fixing and, if so, does anyone know how I raise them?
Any help/advice you can give would be much appreciated.
Thanks,
Matt