This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Updating included third-party modules
Pythonista indicates in its documentation it includes some third party modules including "Dropbox for Python" and "Requests - HTTP for Humans". I've found them in "Standard Library (3.5)/site-packages". So how should I go about updating them? Installing Python Modules indicates you can use
python -m pip install --upgrade SomePackagefrom the command line but when I try updating dropbox I get:
>>> python -m pip install --upgrade dropbox File "<string>", line 1 python -m pip install --upgrade dropbox ^ SyntaxError: invalid syntax
When I use StaSh with the command
pip update dropboxI get:
[~/Documents]$ pip update dropbox Error: package not installed: dropbox [~/Documents]$
So how do I go about updating them? And do I have to check all the"Standard Library (3.5)" modules before performing a
pip installin case the package I'm trying to install is already available?
The pythonista environment does not come with pip included.
A community program called stash (https://github.com/ywangd/stash)
has a pip command.
It is a little iffy sometimes, sometimes you need to pip download and unzip manually. Sometimes dependencies need to be updated manually.
For requests, I recently posted on this topic:
Phuket2 last edited by
@Dangthrimble in terms of Dropbox, i think you just need to do a pip install in StaSh. I think the update is a little funky, for reasons are beyond my expertise. But as Dropbox is already shipped with Python So i think you just do an install.
Third party libs that dont ship with Pythonista, I have found the pip update cmd does not work. So I do a pip remove, then a pip install. pip list works fine in StaSh, so you can see what you have installed using StaSh. Also pip versions cmd works, although the ordering is not correct. Have to look closely at what comes back. Is doing a text sort I think.
Hope it helps. I dont do much with StaSh, but this is my experience.
Also worth mentioning is that StaSh has an selfupdate cmd. Always worth running to make sure you are using the latest version of StaSh.
I know I can use StaSh to perform a
pip installbut would it therefore make sense to delete the relevant packages in "Standard Library (2.7)" and "Standard Library (3.5)" or would they just reappear if Pythonista gets updated? I presume the Standard Library is last on the search path so packages subsequently installed will be picked up in preference.
Phuket2 last edited by
@Dangthrimble , look I am out of my depth here. But what makes sense on iOS VRS a desktop maybe very different. To me if the newly installed modules are used, then if would be preferable not to delete the shipped versions, as you can also get back to a known state. Also on a desktop you are more likely going to be using something like venv or docker or something to seperate your environments. As I say, I only know a little. Maybe there is a lot more to what you are saying that I don't comprehend.
@Phuket2, I am probably as much out of my depth as you are. I’m new to both Python and Pythonista. Your point about being able to get back to a known state is a good one. I have also discovered the "Modules and Templates" folder is not visible from within StaSh, so I can only assume it is installed as part of the App and not something the user can modify. Presumably the site-packages folders appear first in any search path so user-installed packages are found first.
The modules & templates version is read only.
sys.path has site-packages higher than the built ins, so for modules that can be updated, installing into site packages should work. force quit pythonista to ensure anything already used takes effect.
Also, it is possible to get to the modules/templates folder... Check os.file, then cd ther in stash. Or I think $PYTHONHOME gets you close. But it is all read only, so cannot be changed