Replies: 2 comments 3 replies
-
Don't do this. It won't work. |
Beta Was this translation helpful? Give feedback.
3 replies
-
Hi @Tyldi |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am quite new on python environment and on pyinstaller, but I really need your help.
Context
I have a python app which loads plugins at runtime. Indeed, we provide new features for our users in the form of plugins, and we want them to be able to install and use those that interest them. We don't want to build a new executable file every new plugin.
We bundled our app in a one folder, because it seems easier to add plugins. We have a folder for Linux and Windows
pyinstaller --clean --paths=lib/python3.8/site-packages src/main.py
My plugins have sometimes external dependencies (lib, etc.), so foreach plugin here is my setup.py (with requirements, values from requirements.txt file) :
My issue
I know how to import installed modules dynamically to my code:
module = __import__(module_name, globals(), locals(), [name], 0)
This part works.
But I have difficulties to install completely and dynamically those plugins within my code.
What I tried
Let's imagine I want to import my test.whl plugin, which has a dependency with 'test2' package
1. Install the plugin with pip:
subprocess.run(["pip", "install", "--upgrade", package, "-t", my_one_folder_location])
=> Cons : You need to have python and "pip" (not "pip3" etc) on the user computer. Not the best solution
I also tried to use the python installed in the pyinstaller folder but did not succeed.
2. Import every plugins in a specific directory:
I tried to put my .wheel packages in a folder "egg". Then my program detect the plugin, but it doesn't import my lib dependencies
__main__:Unexpected error: no module named 'test2'
I'm going around in circles and can't find any solutions: What is the best way to import my external .whl packages and all it's dependencies in a pyinstaller solution?
Beta Was this translation helpful? Give feedback.
All reactions