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.
How do I install packages from PyPi into Pythonista on iOS?
-
How do I install packages from PyPi into Pythonista on iOS?
-
your best bet is to install stash, then you can use pip install, for many pure python packages.
http://github.com/ywangd/stash -
Wow, stash is pretty cool.
But — my attempt to use pip fails:
StaSh v0.4.5 [~/Documents]$ pip install crypto-enigma Creating package file installing module StaSh pip installing crypto-enigma Opening: https://pypi.python.org/packages/source/c/crypto-enigma/crypto-enigma-0.0.1b3.tar.gz Save as: /private/var/mobile/Containers/Data/Application/9A7BF2DD-B5B5-48A5-8522-E8F1D95FA75F/Documents/site-packages/crypto-enigma-0.0.1b3.tar.gz (23849 bytes) 8192 [34.35%] 16384 [68.70%] 23849 [100.00%] Reading gzip file. Extracting files. Extracting: crypto-enigma-0.0.1b3/crypto_enigma.egg-info/dependency_links.txt Extracting: crypto-enigma-0.0.1b3/crypto_enigma.egg-info/PKG-INFO Extracting: crypto-enigma-0.0.1b3/crypto_enigma.egg-info/SOURCES.txt Extracting: crypto-enigma-0.0.1b3/crypto_enigma.egg-info/top_level.txt Extracting: crypto-enigma-0.0.1b3/enigma/__init__.py Extracting: crypto-enigma-0.0.1b3/enigma/_version.py Extracting: crypto-enigma-0.0.1b3/enigma/components.py Extracting: crypto-enigma-0.0.1b3/enigma/machine.py Extracting: crypto-enigma-0.0.1b3/enigma/tests/__init__.py Extracting: crypto-enigma-0.0.1b3/enigma/tests/test_components.py Extracting: crypto-enigma-0.0.1b3/enigma/tests/test_configs.py Extracting: crypto-enigma-0.0.1b3/enigma/tests/test_display.py Extracting: crypto-enigma-0.0.1b3/enigma/tests/test_encodings.py Extracting: crypto-enigma-0.0.1b3/enigma/utils.py Extracting: crypto-enigma-0.0.1b3/PKG-INFO Extracting: crypto-enigma-0.0.1b3/pyenigma.py Extracting: crypto-enigma-0.0.1b3/README.rst Extracting: crypto-enigma-0.0.1b3/setup.cfg Extracting: crypto-enigma-0.0.1b3/setup.py Archive extracted. Trying to run setup.py Added setuptools Added setuptools.command Added setuptools.command.test Added distutils.core *Unable to locate package. Please try manual install.* Removing setup files. Failed import test. Check for dependencies
-
In that case, you can manually download and extract the package:
wget https://pypi.python.org/packages/source/c/crypto-enigma/crypto-enigma-0.0.1b3.tar.gz tar -xzvf crypto-enigma-0.0.1b3.tar.gz mv crypto-enigma-0.0.1b3/enigma site-packages/enigma rm -rf crypto-enigma-0.0.1b3
-
Any idea why it failed. I was hoping to test the installation of my package (using
pip
) on as many platforms as I could. -
Reading the error message might give a clue. (
Failed import test
) -
If it fails on Pythonista with stash, don't worry about it, it's probably because stash's fake distutils/setuptools/pip isn't handling some corner case. Though this error is strange - as far as I know
test
contains the Python unit test suite (the tests that test Python).If you want to do some experimenting, you can try to install this patched version of distutils/setuptools and see if your
setup.py
runs with that. -
@Webmaster4o : Actually, I'm not sure what that means. I don't have an
import test
statement anywhere. -
I think "import test" is not a Python command, but a test that
pip
runs called import. Maybepip
tries to import your module during install as a test? It probably means once it was installed, callingimport crypto-enigma
failed somehow. -
Are all the dependancies installed for your package. Something I noticed is that the Stash version of PiP does not automatically install missing dependancies.
-
This person has the same issue:
https://forum.omz-software.com/topic/1933/stash-pip-and-pylint -
I got it to work by running
pip install cachetools
before doingpip install crypto-enigma
-
@Cethric : After installing
cache tools
I still get:installing module StaSh pip installing cachetools Opening: https://pypi.python.org/packages/source/c/cachetools/cachetools-1.1.5.tar.gz Save as: /private/var/mobile/Containers/Data/Application/9A7BF2DD-B5B5-48A5-8522-E8F1D95FA75F/Documents/site-packages/cachetools-1.1.5.tar.gz (13378 bytes) 8192 [61.23%] 13378 [100.00%] Reading gzip file. Extracting files. Extracting: cachetools-1.1.5/cachetools/rr.py Extracting: cachetools-1.1.5/cachetools/keys.py Extracting: cachetools-1.1.5/cachetools/ttl.py Extracting: cachetools-1.1.5/cachetools/cache.py Extracting: cachetools-1.1.5/cachetools/func.py Extracting: cachetools-1.1.5/cachetools/lru.py Extracting: cachetools-1.1.5/cachetools/lfu.py Extracting: cachetools-1.1.5/cachetools/__init__.py Extracting: cachetools-1.1.5/setup.cfg Extracting: cachetools-1.1.5/README.rst Extracting: cachetools-1.1.5/MANIFEST.in Extracting: cachetools-1.1.5/setup.py Extracting: cachetools-1.1.5/LICENSE Extracting: cachetools-1.1.5/cachetools.egg-info/dependency_links.txt Extracting: cachetools-1.1.5/cachetools.egg-info/SOURCES.txt Extracting: cachetools-1.1.5/cachetools.egg-info/top_level.txt Extracting: cachetools-1.1.5/cachetools.egg-info/PKG-INFO Extracting: cachetools-1.1.5/PKG-INFO Extracting: cachetools-1.1.5/CHANGES.rst Extracting: cachetools-1.1.5/tests/test_wrapper.py Extracting: cachetools-1.1.5/tests/test_cache.py Extracting: cachetools-1.1.5/tests/test_ttl.py Extracting: cachetools-1.1.5/tests/test_lru.py Extracting: cachetools-1.1.5/tests/test_lfu.py Extracting: cachetools-1.1.5/tests/test_rr.py Extracting: cachetools-1.1.5/tests/test_func.py Extracting: cachetools-1.1.5/tests/test_keys.py Extracting: cachetools-1.1.5/tests/test_method.py Extracting: cachetools-1.1.5/tests/__init__.py Archive extracted. Removing setup files. Package Installed. Import Successful! [~/Documents]$ pip install crypto-enigma installing module StaSh pip installing crypto-enigma Opening: https://pypi.python.org/packages/source/c/crypto-enigma/crypto-enigma-0.0.1b3.tar.gz Save as: /private/var/mobile/Containers/Data/Application/9A7BF2DD-B5B5-48A5-8522-E8F1D95FA75F/Documents/site-packages/crypto-enigma-0.0.1b3.tar.gz (23849 bytes) 8192 [34.35%] 16384 [68.70%] 23849 [100.00%] Reading gzip file. Extracting files. Extracting: crypto-enigma-0.0.1b3/crypto_enigma.egg-info/dependency_links.txt Extracting: crypto-enigma-0.0.1b3/crypto_enigma.egg-info/PKG-INFO Extracting: crypto-enigma-0.0.1b3/crypto_enigma.egg-info/SOURCES.txt Extracting: crypto-enigma-0.0.1b3/crypto_enigma.egg-info/top_level.txt Extracting: crypto-enigma-0.0.1b3/enigma/__init__.py Extracting: crypto-enigma-0.0.1b3/enigma/_version.py Extracting: crypto-enigma-0.0.1b3/enigma/components.py Extracting: crypto-enigma-0.0.1b3/enigma/machine.py Extracting: crypto-enigma-0.0.1b3/enigma/tests/__init__.py Extracting: crypto-enigma-0.0.1b3/enigma/tests/test_components.py Extracting: crypto-enigma-0.0.1b3/enigma/tests/test_configs.py Extracting: crypto-enigma-0.0.1b3/enigma/tests/test_display.py Extracting: crypto-enigma-0.0.1b3/enigma/tests/test_encodings.py Extracting: crypto-enigma-0.0.1b3/enigma/utils.py Extracting: crypto-enigma-0.0.1b3/PKG-INFO Extracting: crypto-enigma-0.0.1b3/pyenigma.py Extracting: crypto-enigma-0.0.1b3/README.rst Extracting: crypto-enigma-0.0.1b3/setup.cfg Extracting: crypto-enigma-0.0.1b3/setup.py Archive extracted. Trying to run setup.py Added setuptools Added setuptools.command Added setuptools.command.test Added distutils Added distutils.core mv: /private/var/mobile/Containers/Data/Application/9A7BF2DD-B5B5-48A5-8522-E8F1D95FA75F/Documents/site-packages/crypto-enigma-0.0.1b3/enigma.tests: no such file or directory *Unable to locate package. Please try manual install.* Removing setup files. Failed import test. Check for dependencies
Is there something else you could have that I'm missing?
-
For complex packages, you best bet is to look at that line with the http addrss, then use
wget https://pypi.python.org/packages/source/c/crypto-enigma/crypto-enigma-0.0.1b3.tar.gz
then
tar -xzf crypto-enigma-0.0.1b3.tar.gz
Then move the actual package folders into site-packages, which in this case is just the enigma folder.
-
@JonB : It's a simple package. And in any case I want to be sure it can be installed simply, so it's important to get to the bottom of what about the package is causing this issue.
-
packages that try to do clever things, like running selftests, or doing machine specific things, usually don't work in stash's simple pip implementation .you may also need to copy pyenigma.py into the enigma or site-packages.
-
-
@Cethric are you on the beta? IIRC it changes a few things about the default
sys.path
, including the fact that"."
is included by default. Which sounds like it would be necessary to import thetest.py
file that is next to thesetup.py
. -
My appologies I got it to work by using pip to instal
cache tools
and then manually installing py-enigma. -
@dgelessus this is not a change in the beta.
.
is included in sys.path in 1.5..
was accidentally removed in one beta, but was then put back in place in a later beta. Importing modules from the same directory works fine in pythonista 1.5.