Install Pipx on Pythonista 3
Please can anyone provide an example how to install pipx on iPadOS/iOS Pythonista app?
I don't think pipx would work in pythonista.
For one, it has some
subprocessdependencies, although those might be able to extracted. However the bigger issue is that pythonista really has no way to support virtual environments. Everything is running inside the same interpreter, rather than a separate process. So, while you CAN change the system path to point to different site-packages alternates, anything that is already running or loaded would stay loaded. You would need to clear out sys.modules, which is hard to do without screwing something up.
You should install
stash, then use the pip that comes with stash to install packages.
If you need to handle different versions of some package, the best way to do that is in the wrapper script itself -- insert an entry before sys.path, find and delete the modules from sys.modules, then import the module.
Technically, it might be possible to use thread local storage to have a different
sys.modulesper thread. I think
stashmight do this to ensure that other code doesn't interfere with stash. I think it is possible that the
pythoncommand in stash would let you effectively have virtual environments, but you'd have to sort of manually set up the paths.
Thank you for that information. I was aware that pip could be done, from what I’ve read anyway,
But also read pip could mess things up in ways that Pipx wouldn’t, not including libraries that could interfere with other modules that pip would include. I’m still just getting my head wrapped around all of this, It may be the case then that python on a desktop would be more suited. I just don’t have one at the moment and wanted to get busy. Need pipx as an install for brownie, can do with pip I think but as I mentioned that brought up other concerns. Maybe I’ll try pip anyway