1

There is an old python app that I want to install on ubuntu.

When I run:

python setup.py install

I get this error:

/tmp/easy_install-s6CQJl/event-0.4.2/setup.py:23: UserWarning: Could not find libevent
  warnings.warn("Could not find libevent")
event.c:4:20: fatal error: Python.h: No such file or directory

I have installed

build-essential
python-setuptools
libevent-dev

Is there something else I am missing?

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
Blankman
  • 259,732
  • 324
  • 769
  • 1,199

1 Answers1

4
event.c:4:20: fatal error: Python.h: No such file or directory

It looks like you need the Python development headers. Try

sudo apt-get install python-dev

Edit:

Hookbox can be successfully installed on Ubuntu 18.04 with a relatively modern Python 2.7. Here's a complete installation process:

  1. Install OS-level dependencies

    sudo add-apt-repository universe  # Required for old libevent
    sudo apt-get update
    sudo apt-get install \
        build-essential \
        libevent1-dev \
        libevent-1.4-2 \
        python \
        python-dev \
        python-setuptools
    
  2. Clone the source code somewhere convenient

    git clone git://github.com/hookbox/hookbox.git
    
  3. Install Hookbox

    cd hookbox
    
    # Ideally we should install Hookbox in a virtualenv
    #
    # Here is one way to do that
    sudo apt-get install virtualenv
    virtualenv env
    source env/bin/activate
    
    python setup.py install
    

    If you use the virtualenv method outlined above you'll be able to run hookbox --help to see that it's working.

    You can exit the virtualenv with deactivate (and still run hookbox by providing an absolute path to path/to/hookbox/env/bin/hookbox) and re-enter it with source path/to/hookbox/env/bin/activate, at which point hookbox should be on your $PATH.

    If you choose not to use a virtualenv you'll need to use sudo python setup.py install here. That's not recommended as you'll be mixing manually installed Python packages with OS-supplied ones.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • from what I understand that gets installed when I do ```apt-get install libevent-dev``` as per https://stackoverflow.com/questions/21623535/installation-of-libevent-development-libraries-in-ubunutu – Blankman Aug 26 '18 at 19:28
  • https://hookbox.readthedocs.io/en/latest/intro.html#installation is the app, it is maybe 10 years old :( So yes an older version of libevent I would assume? – Blankman Aug 26 '18 at 21:12
  • Python 2.5.2 is on the server when I do python --version – Blankman Aug 26 '18 at 21:33
  • The issue appears to be that the [`event` Python module](https://pypi.org/project/event/) won't build, likely due to its [documented dependency on `libevent` 1.4.x](https://github.com/jaraco/pyevent#pyevent). For comparison, my OS-provided `libevent` is at version 2.1.8. I haven't been able to get this to build yet, but Ubuntu has a [`libevent-1.4-2` package](https://packages.ubuntu.com/bionic/libevent-1.4-2). Maybe installing that will work? I'll try it myself in a VM when I get a moment. – ChrisGPT was on strike Aug 27 '18 at 13:35
  • 1
    @Blankman, I got it working on an Ubuntu 18.04 VM. Please see my updated answer. – ChrisGPT was on strike Aug 27 '18 at 15:00
  • Chris, I'm not going to set your question as answered, I will create a bounty and then award you more points b/c I really appreciate your help! – Blankman Aug 27 '18 at 15:16
  • That's very kind, @Blankman. Thanks! It would have bugged me not to solve this one, though :-). – ChrisGPT was on strike Aug 27 '18 at 15:26
  • Thanks for the bounty, @Blankman. I'm glad you found this answer so helpful. – ChrisGPT was on strike Aug 30 '18 at 15:25
  • np! I noticed during the build I was getting allot of warnings, maybe I should drop down to 2.5. – Blankman Aug 30 '18 at 16:26