I have found at least one of the issues. I dumped the stack trace in subprocess.run() to find out who was calling it. During my code, at some point, a numpy function called check_support_sve() gets called. It resides in numpy/testing/_private/utils.py. Here's the code
def check_support_sve(): """ gh-22982 """ import subprocess cmd = 'lscpu' try: output = subprocess.run(cmd, capture_output=True, text=True) return 'sve' in output.stdout except OSError: return False So, I am wondering how (and if) I can modify that function to behave differently if it recognizes that it's an executable packaged by PyInstaller. I saw something similar in a package called cpuinfo, where they specifically mention Pyinstaller issues, but not exactly sure how to adapt it to numpy. On Sun, Sep 24, 2023 at 11:55 AM Chris Coerber <chriscoer...@gmail.com> wrote: > Thanks so much for the response! I have narrowed it down to the > ultralytics library but I haven't been able to identify where in that code > it's calling a subprocess. I'll try to investigate some more. > > On Sun, Sep 24, 2023, 1:59 AM bwoodsend <bwoods...@gmail.com> wrote: > >> I’ve read some about how sys.executable() is different when you run a >> packaged application, so I’m sure that could be playing a role, but I have >> no idea how to fix that. >> >> A library that tries to run Python subprocesses will cause a PyInstaller >> application to keep spawning itself because sys.executable points to >> your application rather than python.exe. There’s no universal magic fix >> for this. Sometimes you can configure a library not to use subprocesses. >> Sometimes the library uses Python’s multprocessing library for which you >> can enable PyInstaller’s special handling. In nastier cases, you can put a if >> sys.argv[1:3] == [whatever arguments the subprocess always uses]: do the >> task the subprocess was intended to do at the top of your code. If you >> can strip the problem down to one specific library and a small bit of code >> then share that, I should be able to give you a more precise workaround. >> >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "PyInstaller" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/pyinstaller/Z76GgQlCruY/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> pyinstaller+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/pyinstaller/a3f0bcd5-07e2-40c6-8705-22a935d3b154n%40googlegroups.com >> <https://groups.google.com/d/msgid/pyinstaller/a3f0bcd5-07e2-40c6-8705-22a935d3b154n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "PyInstaller" group. To unsubscribe from this group and stop receiving emails from it, send an email to pyinstaller+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/CAGu_XGh64G5Sf62by9ZzPh5qxhpLQBnSfmPCBGWo2EvOY0T99w%40mail.gmail.com.