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
-
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?
-
did you try pip install astroid?
iirc, pip doesn't auto download dependencies in the stash version. -
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.
-
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 -
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?
-
Six
is already installed in Pythonista (at least in the current Beta). You should always go to the console and doimport 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 -
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!
-
logilab makes extensive use of
setuptools
, andpkg_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.py
I 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
-
Supercool! The
_osx_support.py
thing is caused by the fact thatplatform.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'
-
Thank you very much, @JonB! It worked like a charm!