Got you - your top level script will need to modify sys.path so as to include the location(s) where your virtual environment will install the installed packages in the list of places that it searches for the packages - normally I believe pysinstaller sets this to the exe files containing directory plus a zip file of the packages that pyinstaller has stored the included packages. Obviously enough this will need to be done prior to importing any such packages. - Personally I would prepend the location using sys.path.insert(0, wherever) so that the pip installed packages are used before any included ones.
Steve From: pyinstaller@googlegroups.com <pyinstaller@googlegroups.com> On Behalf Of Yogesh Sheoran Sent: 05 May 2021 09:29 To: PyInstaller <pyinstaller@googlegroups.com> Subject: Re: [PyInstaller] External Imports Sorry, I think I did not asked clearly. I am taking care of this thing, only required packages are getting packed that is not the issue for me. What I need help in is - Not pack these packages at all, I am providing a installation script which will setup a virtual env and install the list of requirements(heavy packages). How can I make my exe(the embedded python interpreter) to use those packages? On Tuesday, 4 May 2021 at 13:01:02 UTC+5:30 gadge...@live.co.uk<mailto:gadge...@live.co.uk> wrote: I suspect that you are using an Anaconda installation which includes just about everything (alternatively you are not working in a minimal venv) - try: 1. Install Python from https://python.org<https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpython.org%2F&data=04%7C01%7C%7C780d5e5778574fcfba4208d90fa0d1fe%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637558005648099022%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ayijbdBWRZOR4x7x6A4NNpOzBBW8xP7puv%2B8h8nbm60%3D&reserved=0> 2. Create and activate a virtual machine using python -mvenv 3. pip install pysintaller and just the libraries that you actually use 4. test to make sure everything is working 5. run pyinstaller You should end up with a much smaller package. Steve Barnes From: pyins...@googlegroups.com <pyins...@googlegroups.com> On Behalf Of Yogesh Sheoran Sent: 04 May 2021 06:22 To: PyInstaller <pyins...@googlegroups.com> Subject: [PyInstaller] External Imports Hi, I am relatively new with pyinstaller and could not find any reference/help with my requirement. I am creating an application which is using all the major ML frameworks like tensorflow, pytorch, onnx, caffe, mxnet. While packaging it with pyInstaller, I am able to pack it successfully but exe size is around 1.5GB. I was wondering is there any way to tell/point the python interpretor packed with pyinstaller to look for these imports on the host machine? There is one option in pyinstaller "exclude" but this excluded module can not import something which is not already imported by other packed modules. -- 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...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/c5b4c9b0-ff9f-47f5-9cc0-837808822abfn%40googlegroups.com<https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fpyinstaller%2Fc5b4c9b0-ff9f-47f5-9cc0-837808822abfn%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=04%7C01%7C%7C780d5e5778574fcfba4208d90fa0d1fe%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637558005648099022%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=B3zXdrHPrwTdY0iDmYSZ%2B%2FyXTIB2n9KtoM8gI0WMbjg%3D&reserved=0>. -- 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<mailto:pyinstaller+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/458601f9-96e9-4885-a3a7-d46f914c829dn%40googlegroups.com<https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fpyinstaller%2F458601f9-96e9-4885-a3a7-d46f914c829dn%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=04%7C01%7C%7C780d5e5778574fcfba4208d90fa0d1fe%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637558005648109016%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Y6eD%2FTwD56N7ss9ekWG4gPgEkqDNkDyttMMigL4f1fY%3D&reserved=0>. -- 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/VI1PR03MB4479ABCCF5CCC77227A6A8499B589%40VI1PR03MB4479.eurprd03.prod.outlook.com.