Sshuttle fails to build

Not sure where to start here - it could be openwrt, python or sshuttle ... as I am on the openwrt forum, let's start here :slight_smile:
I am running OpenWrt 19.07.7 r11306-c4a6851c72 and I am trying to get sshuttle running - as described here:
https://sshuttle.readthedocs.io/en/stable/openwrt.html

The problem, (to my untrained eye), looks to be that 'psutil' fails to build and then in turn sshuttle fails to build.

This runs without error:
opkg install python3 python3-pip iptables-mod-extra iptables-mod-nat-extra iptables-mod-ipopt

But the next command fails:
python3 /usr/bin/pip3 install sshuttle

with the following output:

'Collecting sshuttle
  Downloading sshuttle-1.0.5-py2.py3-none-any.whl (65 kB)
     |████████████████████████████████| 65 kB 383 kB/s 
Collecting psutil
  Downloading psutil-5.8.0.tar.gz (470 kB)
     |████████████████████████████████| 470 kB 702 kB/s 
Building wheels for collected packages: psutil
  Building wheel for psutil (setup.py) ... error
  ERROR: Failed building wheel for psutil
  Running setup.py clean for psutil
Failed to build psutil
Installing collected packages: psutil, sshuttle
    Running setup.py install for psutil ... error
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-zgttjzus/psutil_fcefdf36f0ca484d874cf4dabb1dcb39/setup.py'"'"'; __file__='"'"'/tmp/pip-install-zgttjzus/psutil_fcefdf36f0ca484d874cf4dabb1dcb39/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-r7y6u5h1/install-record.txt --single-version-externally-managed --compile --install-headers /usr/include/python3.7/psutil Check the logs for full command output.
'

Any constructive advice would be appreciated.

1 Like

Your log literally says this at the end:

Check the logs for full command output.

Did you do that? Up to this point this looks like a generic python issue.

Yes Borromini, thanks for that suggestion - it's always a good idea to look at the logs.
Needless to say, there is nothing interesting in /var/log/*
The syslog is redirected to a remote log server, and again, there is absolutely nothing to do with building this python application there either.

I wonder if you might know how to enable more verbose logging in this build process?

OpenWrt doesn't use that, you'd call 'logread' to see logs. Failing that, maybe /tmp/pip/ contains stone useful stuff?

OK, thanks again Borromini, that's the next clue I needed :slight_smile:

There is a 'pip' log file at /tmp/pip-log.txt, and in there I could see pip complaining that it couldn't find gcc
So, after I installed gcc I am now getting 'out of memory' errors so I will have to add a swap file, but now my file system has only 10.9M free so I will have to add a USB stick - if I can.

BTW, this is the latest error:
"ERROR: Could not install packages due to an OSError: [Errno 12] Out of memory"

  • no idea if gcc will actually run yet.

... watch this space.

Well, that was a saga!

After the original Python error message:-

  • Find the Python log file, (with Borromini's advice), at /tmp/pip-log.txt and watch it while attempting the compile.

  • Notice that Python is trying to call gcc, but it is not installed.

  • Install gcc; watch the logs again.

  • Notice the 'out of memory' error and the file system is nearly full.

  • Buy a USB thumb drive and learn how to configure it to run my system ... now I have a truck load of memory and swap space :slight_smile:

  • Run the compile and watch the logs again - this time gcc can't find a file called Phthon.h

  • Google around for a bit and find that Python.h is usually in a python-devel package or similar.

  • Install python3-dev version 3.7.10-1, sure enough Python.h is there now.

  • Finally run python3 /usr/bin/pip3 install sshuttle to completion and sshuttle is installed on my router

  • Matter closed - thanks again Borromini.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.