Forum Archive

can PyTorch be in Pythonista ?

SmartGoat

hey everyone, I'm wondering if it is possible to install pytorch in pythonista cause the only dependencies are respectively numpy (already in pythonista) and pillow which, as i read, is pure python.
To install pytorch, you need to install 2 modules: torchvision and torch. Torchvision install itself without problems, but torch isn't found in pip stash:

[~/Documents]$ pip install torch
Querying PyPI ... 
Error: Source distribution not available for torch: 1.0.0

which is strange because this is the command given by the official site for installing it on MacOS.
Also, I can't install Pillow because of this other error:

[~/Documents]$ pip install pillow
Querying PyPI ... 
Downloading package ...
Opening: https://files.pythonhosted.org/packages/f7/d6/00368fe7f9acb9454ba5a75a1edda97b7ee9cfe399af4acb6489466be37e/Pillow-5.4.0.tar.gz

Save as: /private/var/mobile/Containers/Data/Application/89F819E6-6ADB-4FBD-B2AC-889B8BDFCBA3/tmp//Pillow-5.4.0.tar.gz (15929265 bytes)
  15929265  [100.00%]
Extracting archive file ...
Archive extracted.
Running setup file ...
TypeError("unsupported operand type(s) for +: 'OmniClass' and 'list'",)
Failed to run setup.py
Fall back to directory guessing ...
Error: Cannot locate packages. Manual installation required.

Does anyone have an idea ? it would be really interesting to dive in cause pytorch seems to be the only package which can provide high level deep learning/data science with pure python....
Thanks in advance for help !

bennr01

@SmartGoat StaSh pip can only install pure python packages, which means no packages containing or depending on c code.
pytorch appears to have such c dependencies.
Take a look at torch's pypi file page. The filename indicates that each distribution of the torch package is for a specific OS and architecture.
StaSh pip can only install source distributions, either as .tar.gz, .zip, ... or source wheels (wheels containing none-any in its name).
The same is true for pillow. However, IIRC, it may already be included in Pythonista by default.

**Edit: ** A quick search showed npdl as a possible pure-python deeplearning package. It installs successfully using StaSh.