Welcome!
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.
Stash, PIP and versions
-
Hi Pythonistas,
I have a comprehensive question to the inner workings of stash related to the double interpreter (Python 2.x and Python 3.x)
stash allows me to pip install. How do I tell it which version of python to use? (I was looking for a pip3 command but did not find it)
the question gets mor complex. Stash wants to be launched in python 2.7. How would that impact the Python 3 package installation with pip.
The source of my question is the wonderful ‘python-pptx’ module. I can not install it in Pythonista though I am sure (and can show you) that it runs under a Python 3.x environment on iOS. The problems that are popping up are completely Py2to3 issues that look like a misplaced library (site-packages) which brings me back to pip and stash.
Would be great to find out the reason and solve it. Because I want to promote the script in other forums with both Python Apps available (Pythonista and the other one that shall not be named ...)
Cheers
Andreas -
Have you read the README? https://github.com/ywangd/stash
-
-
A more direct answer, perhaps: As the StaSh README says, StaSh runs by default in Python 2, because not all of its functions work in Python 3.
But I’ve simply taken the
launch_stash.py
script, and copied it tolaunch_stash3.py
, then edited the latter so that the first line is:#!python3
if you do the same, when you run
launch_stash.py
you’ll get it in Python 2, andlaunch_stash3.py
in Python 3. If you runpip
in a Python 3 StaSh, it will install Python 3 libraries.You can also use
six
by runningpip -6 install…
, but I’ve found modules installed into Python 3 that way from Python 2 StaSh to be unreliable. You canimport
them, but sometimes they don’t work, andpip list
doesn’t show them in either StaSh 2 or 3. So I just wouldn’t do it. -
StaSh runs on both py2 and py3, though not all commands support py3.
pip
uses the python interpreter StaSh was launched with and installs the package into the version specificsite-packages
directory. You can use the-6
option to tell pio that it should install a package into the sharedsite-packages
directory.You can force StaSh to use a specific python version by long-pressing the Run-Button and choosing the "run with python X" option.
-
You can also use six by running pip -6 install…, but I’ve found modules installed into Python 3 that way from Python 2 StaSh to be unreliable. You can import them, but sometimes they don’t work, and pip list doesn’t show them in either StaSh 2 or 3. So I just wouldn’t do it.
-6
does not usesix
, it just tells pip to use the shared site-packages directory so that you can install a package for both interpreters. Some packages may distribute different files depending on the installing python version which may cause the problems. Also, since pip stores information about the installed packages within site-packages, you must specify-6
forpip show
too (pip -6 show
). -
Sorry if I forgot that there is a obvious place for a manual. I am through the github readme of stash
and foundpip.py - Search, download, install, update and uninstall pure Python packages from PyPI
This does not say anything about the inner working of pip with the two interpreters.
But it was a nice read.
The issue described by problem but did not really solve it.
The ‘not everything runs’ is not very helpful to understand what would run (the issue flags git as a py2 only but still says nothing about pip)
Thanks a lot for the other replies they help me better to act. The launch_stash3.py would be my choice.
Thanks again!
-
Removing legacy Python and upgrading to Python 3.9 would be my choice.
-
Question 1
Are you able to pip install opencv cv2 with stash?Question 2
Are you able to install tessaract and pytessaract with stash?Question 3
Does pythonista 3 come with Core ML already or does it need to be installed? -
@sodoku said:
Question 1
Are you able to pip install opencv cv2 with stash?No.
Question 2
Are you able to install tessaract and pytessaract with stash?No.
Question 3
Does pythonista 3 come with Core ML already or does it need to be installed?You just need to
load_framework
.