Compiling python libs using the SDK

I've been using the OpenWrt SDK for a while now, to compile packages for my router. However, there is a persistent problem: I cannot compile python libs (the ones that would otherwise be installed by pip).

First of all, I must use the SDK because when I try to install using pip on the router, this error occurs (example with psutil):

ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9xnaq6hn/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9xnaq6hn/psutil/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-pr9aendw/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

This error is equal to many other python libs I tried to install on the router.

I also tried moving the libraries (in the site-packages folder) from my computer to the router, which is not an option also, as the library is not recognized when I try to import it in a python script (everytime).

Finally, this is the common error I get when running, in the SDK, make package/<package>/compile (in this case, psutil lib for python):

Note the "bad interpreter: No such file or directory" error.

My questions are: Is it really not possible to compile python libs using the newest OpenWrt SDK (18.06.2)? Are most python libraries not compatible with this OS?
I'm exhausting all my options... Maybe it is a problem with the Makefiles I'm using (please take a took at: https://pastebin.com/LG3wZjjZ ) . I really don't know...

18.06.2 is stale...

i got pip to fire up recently using a newer build by calling python3 pip3 ... can't remember exactly... ( the point is... you have to pay careful attention to what is calling, who from where! )

python underwent some changes in recent releases... i'm not sure if your older SDK has some back-seep-age from that...

are you using 18.06.2 because your bound to python2 for some reason?

@anon50098793 Well, I was using the SDK that was mentioned here: https://openwrt.org/docs/guide-developer/using_the_sdk (which is 18.06.2)...

...and my router has the following OS version:
erro2

Just because 18.06.2 is stale, it does not mean I am not able to compile python packages using the SDK of that same version, right?
And no, I am not bound to python2. Actually, the package I'm in urgent need to compile right now is psutil and I want it in the python3 version.

Just now, I wrote another Makefile: https://pastebin.com/0h6k6An1 but when I "make package/psutil/compile" in the SDK, the following error appears:

cp: cannot stat '/home/inesmll/Desktop/sdk/openwrt-sdk-18.06.2-x86-64_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-x86_64_musl/psutil-5.6.3/ipkg-install/*': No such file or directory

I think the main problem of this whole situation is the Makefile contents and structure.

Have you ever compiled python packages/libs using the SDK? If so, could you provide any example Makefile? I'm getting desperate :frowning: Or maybe find out what command you used so pip could start working?