omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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

    Pythonista
    version pip stash
    6
    10
    8156
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • deloriel42
      deloriel42 last edited by

      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

      1 Reply Last reply Reply Quote 0
      • ccc
        ccc last edited by

        Have you read the README? https://github.com/ywangd/stash

        1 Reply Last reply Reply Quote 0
        • ccc
          ccc last edited by

          https://github.com/ywangd/stash/issues/397

          1 Reply Last reply Reply Quote 0
          • trey
            trey last edited by

            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 to launch_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, and launch_stash3.py in Python 3. If you run pip in a Python 3 StaSh, it will install Python 3 libraries.

            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.

            1 Reply Last reply Reply Quote 0
            • bennr01
              bennr01 last edited by

              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 specific site-packages directory. You can use the -6 option to tell pio that it should install a package into the shared site-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.

              1 Reply Last reply Reply Quote 0
              • bennr01
                bennr01 last edited by

                @trey

                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 use six, 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 for pip show too (pip -6 show).

                1 Reply Last reply Reply Quote 0
                • deloriel42
                  deloriel42 last edited by

                  Sorry if I forgot that there is a obvious place for a manual. I am through the github readme of stash
                  and found

                  pip.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!

                  1 Reply Last reply Reply Quote 0
                  • ccc
                    ccc last edited by

                    Removing legacy Python and upgrading to Python 3.9 would be my choice.

                    1 Reply Last reply Reply Quote 0
                    • sodoku
                      sodoku last edited by sodoku

                      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?

                      mikael 1 Reply Last reply Reply Quote 0
                      • mikael
                        mikael @sodoku last edited by

                        @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.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Powered by NodeBB Forums | Contributors