Pythonista 3.4: 'pip install' (alternative to StaSh) #80
RichardPotthoff
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Here is a method that can be used to install Python packages using pip (including pip itself) in Pythonista 3.4:
The Idea is to use an existing pip installation on a shared resource, e.g. shared drive on a remote machine where pip is already installed.
Share a folder with a pip installation on a PC, and connect to this folder from an iPad/iPhone. (I use a shared SMB folder on a Raspberry Pi, and connect to it using the "Files" app on my iPad (Files > ... > connect to Server). An alternative could be to save the folders "pip" and "pip-25.2.dist-info" into a folder on the iCloud drive, where the iPad/iPhone can see it.)
In Pythonista: Navigate to this folder using "External Files > Open... Folder...", and open the shared folder.
Create a new empty Python script inside this folder ( "+" > "New ... Empty Script"), and give it a name (e.g. "shared_pip_sh.py"), and copy/paste the following script into it, and run the script (The script will give further instructions):
This works because the script's path is added to Python's "sys.path", and since "pip" is installed in the same folder, Python can find, load, and execute the "pip" module on the shared drive. (Pythonista has permissions to read the files inside the shared folder, because otherwise it would not be able to run the script.)
Beta Was this translation helpful? Give feedback.
All reactions