Bench fails to install on Debian 8 **RESOLVED**

I am trying to follow the tutorial to install and test a ERPNext on a local debian ver8 box. The debian box was installed fresh from console just for this test. The only thing installed are the required programs as listed in the instructions found here:

Everything went well until it came time to install bench. When I run these instructions:
git clone bench-repo
sudo pip install -e bench-repo

The console screen quickly runs through a lot of steps but at the end of the process it closes with the following lines:

building ‘psutil._psutil_linux’ extension

creating build/temp.linux-i686-2.7

creating build/temp.linux-i686-2.7/psutil

i586-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=520 -DPSUTIL_LINUX=1 -I/usr/include/python2.7 -c psutil/_psutil_linux.c -o build/temp.linux-i686-2.7/psutil/_psutil_linux.o

psutil/_psutil_linux.c:12:20: fatal error: Python.h: No such file or directory

#include <Python.h>


compilation terminated.

error: command ‘i586-linux-gnu-gcc’ failed with exit status 1

From this point, the bench program seems to be broken or not installed at all. I attempted the next step of bench init and it returns bench: command not found

Is there possibly something I needed to install before starting bench install that I was unaware of?
Is there some patch that needs to be in place for debian 8 (jessie)?

I checked for cron and it seems to be installed and up to date.
I also have already taken care of the MairaDB public key.

Thanks in advance for any pointers.


Install python3-dev and then retry

1 Like

@netchampfaris - I don’t really understand the purpose of installing the python3-dev files when I was using 2.7 for everything else.

I did it anyway and then restarted the server (just for good practice) and the results are exactly the same. Same fatal error, same command failed with the same exit status.

Are there other prerequisites that I might have missed?

Is there a comprehensive list of prerequisites for installing this? (I have not found one yet)

Thank you, but it still will not complete the install of bench


I also went back to read the “” file again and noticed that it only talks about installing bench on Debian 7. Is there a problem with getting bench to run on Debian 8? Version 8 has been around for over a year now. Has anyone else been able to get bench to install on Debian 8 from a console?

It really shouldn’t be this hard but there is not much information that I can find on getting bench installed.


I have it working on two different Debian 8 hosts on master branch and development branch with no issues nor any special configuration.

Try installing python-devel as per (similar issue, different project).


Thanks to all that tried to help. I did eventually get it everything installed, but not manually.

Ultimately, there is just not enough documentation to do a manual install of everything needed to get ERPNext running on a bare Debian console server. Unless you install a full blown system complete with GUI and all the options, you will have a tough time trying to manually install the package.

However, the “Easy Install” script written in python seems to work. Although the file doesn’t make mention of the easy way until near the end of the file. And the author makes the manual process seem easy with just a few prerequisites to install first. Trust me, it doesn’t work. So here is what I did to get a local server box for testing.

I stripped the Debian 8 box and did a complete re-install of the OS using only the first install CD. I deselected the GUI option and selected only the standard utilities (which i believe is the last item in the selection list) along with SSH. Everything else was deselected. That gave me a very bare bones Debian 8 server box.
Then I did the following to get everything installed.

  • I installed sudo by using the “su” command to get root access and the typed in “apt-get install sudo” (evidently Debian 8 does not include this as a standard package)
  • I added my user to the sudo group with “adduser myusername sudo” (replace myusername with yours)
  • Then I had to add my user to the sudoers file with “nano /etc/sudoers” Once I had the file open in the nano editor I just added “myusername ALL=(ALL:ALL) ALL” (without the quotes) to the line immediately following “%sudo ALL=(ALL:ALL) ALL” and I saved the file.
  • Next I used the “exit” command to get out of root access and back to my user prompt so I could use sudo for everything else
  • Now I installed python with “sudo apt-get install python”
  • Once python was installed I was able to use the “Easy Install” script to get everything else installed properly. It is a 2 step process.
  • Step one, type “sudo wget” This will download the install script for you to use.
  • Step two, I ran the install script to generate a production type install with the following command
    “sudo python --production”
    Then just sit back and watch the install script do its work. Just watching everything go by on the console is enough to tell you that there is NOT enough documentation for anyone to do this manually. In my case it took almost 20 minutes on a fairly fast machine to get to the end of the script. During the process it prompts the user for passwords for root and admin users for the database, so you can’t just start it and walk away. You have to be paying attention.

Anyway, this is how I got bench (and everything else) to install properly on a console only Debian 8 box. I believe there will always have to be an install script to do the job, because there is just no way to get all the dependencies worked out. Some of the required packages do not exist in the Debian repository and have to be pulled from other places, so any manual install attempt is pretty much futile.

Hope this helps someone else trying to set up a test server locally.