![]() |
Import module not in bundled Python
I want to use a module in Python and it is not in the bundled Python. I can of course use a non-bundled version, but I would like to make it easier for the users. Is there a way to use a module that is not in the bundled Python?
|
List it as a requirement and tell users to use pip install?
Or else bundle it in the plugin and use that copy... |
If the module would be useful for processing epubs in general, let us know and we may consider including it in the bundled version. If not generally of use to multiple users, the best solution is to include it in the plugin if the license permits it.
Kevin |
It appears (after some testing with a standalone python), that it will not work on Windows machines, only Linux and OSX. So, I will look at something else.
|
Quote:
We've thought of putting a folder in Sigil's prefs (which would be included in sys.path) where pure Python modules could be dropped and thus made available to the bundled Python interpreter, but I'm not sure rooting around in Appdata would be any easier for casual folk than installing/switching to an external Python and using pip. *shrug* Still might do it, just to have options available. |
That sounds like a reasonable approach, assuming plugin authors then have sample snippets like this here: https://stackoverflow.com/questions/...le-within-code
Or perhaps make it available in the launcher, if this is a significant use case. No need to bother the hapless user. :D |
Given how MacOSX python is bundled, a user should be able to do a pip3 install --user and once that is done the bundled python3.4 should see it. But that is conjecture. I have not tested it to see if it actually works or not. I will.
KevinH |
Pretty sure the location where pip installs modules on Windows is hardcoded into the pip executable at install time. One used to be able open it in a hex editor and change it to a path relative to the binary (so pip could work in Python virtualenvs), but I'm not sure that still works.
|
Quote:
|
Quote:
But regardless ... I was mistaken. It's not the installation directory that's hard-coded, it's the path to the python executable that is. Almost all exes in the Pythonxx\Scripts directory (including pip) are the same way (at least up to, and including, 3.4). |
I certainly see "--prefix" listed by pip3 install --help
Anywho, as per the SO link, surely this shouldn't care about hardcoded locations in the executable entry points?: Code:
import pipThis should theoretically make it easy for plugin authors to install modules as needed, if they aren't available. |
Quote:
What kind of package are you looking for? |
| All times are GMT -4. The time now is 08:31 PM. |
Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.