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.
[Solved] installing modules with pipista & shellista
-
Dear all,
what I want: install decorator
what I did so far:
- created a file "shellista" in pythonista from https://github.com/transistor1/shellista
- ran shellista, downloaded the package "decorator-3.4.0.tar.gz" and unpacked it by using untgz
I now have a folder structure like "~/decorator-3.4.0/decorator-3.4.0/" and a setup.py therein.
My question: What now? How can I perform the "python setup.py install" operation?
Thanks in advance
-
I'd suggest switching over to stash, which has a nearly working pip2 command.
https://github.com/ywangd/stash/issues/39#issuecomment-71522878In shellista, there really was no install function.
But, often install just meant copying the folder containing the modules py files into site packages.Look in the inner folder for another folder, maybe called decorator.
Move that folder into your site-packages, then you should be able to import.
Note that this only works for pure py modules. -
As far as I can tell
decorator
really consists of only a single Python module, namelydecorator.py
in thesrc
folder. It should be sufficient to move/copy that file into thesite-packages
folder so you can import it. Running thesetup.py
script should not be necessary in this case.A few other things:
- I'd suggest that you have a look at StaSh. Although Shellista is the first and perhaps most well-known Pythonista shell, it is somewhat limited in its capabilities for that reason. There have been multiple forks and remakes of Shellista, with StaSh being the most recent and feature-rich one.
- StaSh includes a simple
pip
command, which works similar to that on Python on a regular computer - it downloads a package from PyPI and installs it using thesetup.py
script. Because Pythonista has a different (and more limited) environment than normal computers, thesetup.py
is not actually executed. Insteadpip
tries to parse the file and extract all information necessary to perform the installation. This means that complexsetup.py
s cannot be run using StaSh'spip
. - Any package that is written in C/C++/Cython cannot be used in Pythonista due to the lack of a C compiler and support for dynamic libraries. (The latter is a restriction by Apple, which makes the former practically impossible unless you want to write a C compiler in pure Python.)
- Because pure Python packages rarely require special setup procedures than "copy this to site-packages" I personally find it easier to look for the main module file/package folder and manually copy it to site-packages. Using
pip
may be easier in some cases though.
-
Thanks, copying decorator.py into site-packages worked for me.
And I'll definitely have a look into StaSh.
-
I'd recommend moving to stash as well. There is a lot of development going into it. https://github.com/ywangd/stash