Forum Archive

[Solved] installing modules with pipista & shellista

BlackTea123

Dear all,

what I want: install decorator

what I did so far:

1) created a file "shellista" in pythonista from https://github.com/transistor1/shellista
2) 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

JonB

I'd suggest switching over to stash, which has a nearly working pip2 command.
https://github.com/ywangd/stash/issues/39#issuecomment-71522878

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

dgelessus

As far as I can tell decorator really consists of only a single Python module, namely decorator.py in the src folder. It should be sufficient to move/copy that file into the site-packages folder so you can import it. Running the setup.py script should not be necessary in this case.

A few other things:

  1. 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.
  2. 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 the setup.py script. Because Pythonista has a different (and more limited) environment than normal computers, the setup.py is not actually executed. Instead pip tries to parse the file and extract all information necessary to perform the installation. This means that complex setup.pys cannot be run using StaSh's pip.
  3. 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.)
  4. 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.
BlackTea123

Thanks, copying decorator.py into site-packages worked for me.

And I'll definitely have a look into StaSh.

briarfox

I'd recommend moving to stash as well. There is a lot of development going into it. https://github.com/ywangd/stash