psutil icon indicating copy to clipboard operation
psutil copied to clipboard

Android is not supported

Open u400822 opened this issue 4 months ago • 4 comments

Summary

  • OS: Android 10
  • Architecture: aarch64
  • Psutil version: 7.0.0
  • Python version: 3.12.10
  • Type: installation
Image

u400822 avatar Aug 06 '25 23:08 u400822

Image

u400822 avatar Aug 06 '25 23:08 u400822

I don't think Android is supported. According to the error it seems the missing piece is the freeifaddrs() syscall (and also getifaddrs()?). I suppose the right solution is to disable that part of the C code with an #ifdef, and just don't support that psutil.net_if_addrs() on Android. But I never developed on Android, nor I have one, nor I have any idea how to setup the whole dev environment etc. So either somebody steps in with a patch or this ticket is likely gonna linger. undefinitively

giampaolo avatar Aug 24 '25 14:08 giampaolo

I've built some unofficial Android wheels for psutil here, based on the patches here, which treat Android as if it's Linux.

However, I've never throroughly tested them beyond some basic checks of the disk and process APIs. In particular, if you look at the history of the recipe, you'll see that I previously removed a test for the network API because Android was blocking that information for privacy reasons.

mhsmith avatar Nov 22 '25 12:11 mhsmith

I previously removed a test for the network API because Android was blocking that information for privacy reasons

However, this isn't the cause of the compiler error above. That's happening because Android doesn't support getifaddrs and freeifaddrs until API level 24. So you should at least be able to finish the build by targeting API level 24 or newer, but I'm not sure how to do that on Termux (assuming that's what you're using).

mhsmith avatar Nov 24 '25 11:11 mhsmith