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 SSH is broken
-
Just purchased Pythonista and first thing I did was install Stash via the Pythonista Tools plugin so I presume I have the latest version. I tried running ssh with password and got an error:
usage: pip.py [-h] [--verbose] sub-command ...
pip.py: error: unrecognized arguments: 0.4.10
usage: pip.py [-h] [--verbose] sub-command ...
pip.py: error: unrecognized arguments: 1.16.0
Please restart Pythonista for changes to take full effectSo I thought that's strange why am I getting pip error. I thought perhaps my password is weird and/or there is no .ssh directory so I did a keygen and copies the public key to a server that works that way. Got same exact error. So I started investigating on this site and read that Paramiko gets updated and you need to restart Pythonista which explains the last line.
So I restarted, tried again same error. So I tried manually installing paramiko and this is what I got:
[~/Documents]$ pip install paramiko
Querying PyPI ...
Downloading package ...
Opening: https://pypi.python.org/packages/source/p/paramiko/paramiko-1.16.0.tar.gz
Save as: /private/var/mobile/Containers/Data/Application/AB28F53F-7AD6-44D0-8845-45EF52848C92/tmp/paramiko-1.16.0.tar.gz (1335094 bytes)
1335094 [100.00%]
Extracting archive file ...
Archive extracted.
Running setup file ...
stash: <type 'exceptions.ValueError'>: substring not foundSo my guess is the problem is paramiko. Any help would be greatly appreciated.
-
SSH works fine with my Raspberry Pi. Please check your stash, paramiko and pyte versions.
StaSh v0.6.1
paramiko 1.16.0
pyte 0.4.10 and 0.5.2 testedimport stash, paramiko print stash.stash.__version__ print paramiko.__version__
ssh --password mypassword -p 22 myuser@myip
You can try a new installation, if you want.
- delete the stash, paramiko and pyte folder in the site-packages folder.
# 2. Simply copy the next line, paste into Pythonista interactive prompt and execute. => https://github.com/ywangd/stash import requests as r; exec r.get('http://bit.ly/get-stash').text
# 3. install librarys with stash pip install paramiko pip install pyte
-
what version of pythonista and stash are you using?
You do need to to a hard reset of pythonista in a few places( i.e double click home menu, and drag the app away).
From your original error, it looked like you were running pip instead of ssh. You can use
stashconf py_traceback 1
to provide more useful error messages.Also... pip and stash both were recently extensively updated... maybe one of the options slipped through testing.
edit: i can confirm the pip install paramiko error -- i think the requirement was of an unexpected form. IIRC, the latest pythonista includes paramiko 1.16 already. and I think pyte comes built in? Try using the stash ssh command without messing with pip..
-
Pyte is not builtin as far as I can tell.
-
Here is a pull request which fixes this issue.
https://github.com/ywangd/stash/pull/170As a temporary measure until this gets incorporated, you can patch your local copy:
wget https://raw.githubusercontent.com/jsbain/stash/dev/bin/pip.py ~/Documents/site-packages/stash/bin/pip.py
then try the pyte/paramiko install again.
-
@zoteca Sorry for the late reply. It is a bug in the new
pip
command that it could not handle some of the version specifiers like the one paramiko declared, i.e.pycrypto>=2.1,!=2.4
.Thanks to @JonB for making a fix for it and I have just merged into the main branch. You can get the latest changes by running
selfupdate
.A bit more information about stash ssh:
- Paramiko is builtin with Pythonista. However, the version that comes with 2.0 app store version (not beta) is old and has some compatibility issues with newer ssh server (2.0 beta has fixed this by bundling newer paramiko). This is why ssh tried to install
paramiko
the first time it runs. - The problem is only just caused by the
pip
installation. It has nothing to do with the ssh command itself. So once you have paramiko and pyte installed, ssh should just work.
- Paramiko is builtin with Pythonista. However, the version that comes with 2.0 app store version (not beta) is old and has some compatibility issues with newer ssh server (2.0 beta has fixed this by bundling newer paramiko). This is why ssh tried to install
-
@ywangd First thanks so much for making such an amazing add on to Pythonista and working to keep it functional.
Since I haven't done much yet, I deleted Pythonista, reinstalled, add the tools, installed stash. Then I did self update and had to manually pip install paramiko and pyte. Restarted and then did ssh.
Yay, it works!!!!
Thanks again for the add on tool and your help!!
-
@ywangd FYI it's broken again.
Just installed pythonista on my new iPad Pro 9.7. I can run ssh-keygen fine out of the box, but then when I do "ssh -h" I get the pip error at top of this thread (although no attempt to install paramiko). If I then manually install paramiko (and manually setuptools for otherwise I get an error) when I run ssh-keygen or try to ssh to a server I get the following error:
" Multibackend cannot be initialized with no backends. If you are seeing this error when trying to use default_backend() please try uninstalling and reinstalling cryptography."
Needless to say reinstalling cryptography does not help. There are obviously are some conflicts between different packages & stuff just isn't working.
The problem exists w/ & w/o installing the pip patch - I installed/uninstalled pythonista multiple times to try different variants of installation methods of stash, paramiko etc
-
Change line 67 in pip.py from
class OmniClass(object):
to
class OmniClass(list):
This reported an error when it tried to install cffi, but it did install paramiko successfully, and i was able to run the ssh keygen.
Not sure if that is a long term solution, I will ley @ywangd comment. The issue was line 293 of the pycrypto setup.py
sub_commands = [ ('build_configure', has_configure) ] + build_ext.sub_commands
since build_ext.sub_commands was a stub, so could not be added to a list. By changing the stub OmniClass to extend list, it allows this type of usage. Not sure if there are other side effects.
-
@JonB Thanks for the reply.
So I tried what you suggested, edited pip,py, removed and installed paramiko, and still got same error re: multi-back ends.
So I was a bit cobfused. When I install paramiko I noticed it uses cryptography package not pycrypto. I did in fact try manually installing pycrypto previously and got a setup error, which your pip patch does indeed fix.
But a brief googling revealed that pycrypto is for paramiko 1.x & what the plain install is doing is installing paramiko 2.0. So I asked myself is that the problem? Indeed it was. Installing version 1.17 of paramiko made everything work perfectly, and I didn't even need your patch to manually install pycrypto, since the bundled version works fine.
Anyway, thanks so much for your help and for putting me on right path to solve the problem, even inadvertently.
Hopefully future versions support paramiko 2.0 since I understand cryptography is a more secure library :)