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 pylint

    Pythonista
    3
    10
    11309
    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.
    • Rosanne
      Rosanne last edited by

      I just installed stash (very cool!) and wanted to use pip to install pylint. It seemed to work, but when I tried to run it I got an error saying it needed astroid. When I tried to pip install that I got a 'Failed import test. Check for dependencies' error. From comments on the forum it seemed as it would be trivial to install pylint, am I doing something wrong?

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

        did you try pip install astroid?
        iirc, pip doesn't auto download dependencies in the stash version.

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

          I got the import error from astroid, but that one didn't specify a module. It said it extracted a requires file, but I couldn't find that. Maybe I should just google for the astroid dependencies then.

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

            So I found out that astroid needs logilab-commons and six. Logilab-commons also needs six. I installed six, no problem, but now I can't get logilab-commons to install.

            I get this error:

            Trying to run setup.py
            Unable to locate package. Please try manual install
            Removing setup files
            Failed import test. Check for dependencies

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

              I added some traceback to the pip code and found out that the problem is that setuptools doesn't have a find_packages function. I don't understand exactly how this part of the code works, so now I'm stuck. There are people that managed to install pylint, any ideas?

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

                Six is already installed in Pythonista (at least in the current Beta). You should always go to the console and do import xyz before you pip install modules. You might overwrite a module that Pythonista relies on with a version that has breaking changes. You can also look through https://github.com/cclauss/pythonista-module-versions

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

                  I did that for a couple of other modules, but forgot it for six 😕. I uninstalled with pip, but that doesn't change the error message. Useful link!

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

                    logilab makes extensive use of setuptools, and pkg_resources, which is a little annoying on platforms that don't have easy_install. the trick is that the dependencies need to have a egg-info adjacent to the package folder on the path. I don't think pythonista supports .pth files, which is the other method. also, pythonista is missing _osx_support.py, which makes setuptools fail.

                    here is a .sh script that can be run in stash which installs setuptools, six, and logilab, including egg-info folders for all of these! and creates a minimal _osx_support.pyI realize six doesn't NEED to be reinstalled, but we'd have to fake the egg-info if we didn't.

                    copy this to install_llc.sh, then type install_llc in stash.

                    #!/bin/sh
                    cd ~/Documents
                    mkdir st_install
                    cd st_install
                    wget https://pypi.python.org/packages/source/s/setuptools/setuptools-18.0.1.tar.gz
                    wget https://pypi.python.org/packages/source/l/logilab-common/logilab-common-1.0.2.tar.gz
                    wget https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz
                    tar -vzxf setuptools-18.0.1.tar.gz
                    tar -vzxf logilab-common-1.0.2.tar.gz
                    tar -vzxf six-1.9.0.tar.gz
                    
                    mv setuptools-18.0.1/setuptools ~/Documents/site-packages
                    mv setuptools-18.0.1/pkg_resources ~/Documents/site-packages
                    mv setuptools-18.0.1/*.egg-info ~/Documents/site-packages
                    mv logilab-common-1.0.2/logilab ~/Documents/site-packages
                    mv logilab-common-1.0.2/*.egg-info ~/Documents/site-packages
                    mv six-1.9.0/six.py ~/Documents/site-packages
                    mv six-1.9.0/*.egg-info ~/Documents/site-packages
                    
                    echo 'def get_platform_osx(cvar,osname,release,machine):'> ~/Documents/site-packages/_osx_support.py
                    echo '   return osname,release,machine' >> ~/Documents/site-packages/_osx_support.py
                    cd ..
                    rm -rf st_install
                    
                    1 Reply Last reply Reply Quote 1
                    • ccc
                      ccc last edited by

                      Supercool! The _osx_support.py thing is caused by the fact that platform.system == 'Darwin' in both Mac OSX and iOS. Therefore, when most Python code in the wild is run in Pythonista, it thinks that it is running on a Mac.

                      One of the side effects of your approach above is that it upgrades the version of six from v1.6.1 to v1.9 which is hopefully all goodness.

                      import six
                      print(six.__version__)
                      

                      Prints '1.6.1'

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

                        Thank you very much, @JonB! It worked like a charm!

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