Please login or register. October 18, 2019, 09:31:11 PM

Author Topic: Paramiko for Python3  (Read 1219 times)

0 Members and 1 Guest are viewing this topic.

prolly_brent

  • New Member
  • *
  • Posts: 3
  • Karma: +0/-0
Paramiko for Python3
« on: July 24, 2019, 02:47:06 PM »
I really like using Paramiko under Python3 for doing SSH operations.  Easy enough in the Linux/RHEL world, but I have had no success getting this module inside of Python3 on AIX (where I really need it).  It won't pip install under gcc with  AIX ToolBox's version of python3 (errors out) and I don't have the luxury of an IBM C compiler.  Any chance you would consider making paramiko accessible via your distribution?

Thanks,
Brent Fortman

Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1156
  • Karma: +0/-0
Re: Paramiko for Python3
« Reply #1 on: July 25, 2019, 09:44:42 AM »
My pleasure to give it a try. Which Python3 are you using? 3.5, 3.6, or 3.7?

Michael

prolly_brent

  • New Member
  • *
  • Posts: 3
  • Karma: +0/-0
Re: Paramiko for Python3
« Reply #2 on: July 25, 2019, 12:46:05 PM »
I am currently using 3.7.  Thanks.

Brent

Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1156
  • Karma: +0/-0
Re: Paramiko for Python3
« Reply #3 on: July 26, 2019, 05:10:01 PM »
I have all the modules built - but something is not 100% correct (the dependencies relationships) is not working correctly.

I'll try and fix that - but for testing I'll put all in http://download.aixtools.net/test - asap.

prolly_brent

  • New Member
  • *
  • Posts: 3
  • Karma: +0/-0
Re: Paramiko for Python3
« Reply #4 on: July 26, 2019, 06:29:33 PM »
I have downloaded, installed (on AIX 7200-03-02-1846), and done some basic testing.  No issues installing, and no errors during testing.  This is really great!  Thanks so much and I will keep an eye out for the official version when that's ready.

Sample code for doing simple remote command via SSH using paramiko:

#!/opt/bin/python3

def normal( a_str ):
    return a_str.decode('utf-8').rstrip('\n')

import paramiko

k = paramiko.RSAKey.from_private_key_file("/.ssh/id_rsa")
client = paramiko.SSHClient()
client.set_missing_host_key_policy( paramiko.AutoAddPolicy() )
client.connect(
                 hostname = "myhost",
                 username = "root",
                 pkey = k
               )

stdin, stdout, stderr = client.exec_command( "ls -al" )
print( normal( stdout.read() ) )

client.close()


Regards,
Brent

Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1156
  • Karma: +0/-0
Re: Paramiko for Python3
« Reply #5 on: July 28, 2019, 01:17:03 PM »
Thanks for the feedback.

The later packaging will be the same binaries. The only difference in /usr/lpp/* files. I need to debug why it is not taking my requisites info. Cutting too many corners I guess.

Michael

Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1156
  • Karma: +0/-0
Re: Paramiko for Python3
« Reply #6 on: July 28, 2019, 02:52:10 PM »
Actually, the packaging is okay as is. The corner I cut was to not "inutoc .", i.e., recreate the .toc file.

If you would try to "uninstall", e.g., six using
Code: [Select]
# installp -up aixtools.python3.six you should get something as:

  Dependency Failures
  (Deinstall Operation)
  ---------------------
  SELECTED FILESETS:  The following is a list of filesets that you asked to
  remove.  They cannot be removed until all of their dependent filesets
  are also removed.  See subsequent lists for details of dependents.

    aixtools.python3.six.rte 1.12.0.0         # tools six 26-Jul-2019

  INSTALLED DEPENDENTS:  The following filesets are dependents of one or more
  of the selected filesets listed above.  These must be removed before
  or with the filesets that you selected.  To remove these dependents with
  the selected filesets, specify the option to automatically remove dependent
  software (-g flag).

    aixtools.python3.asn1crypto.rte 0.24.0.0  # tools asn1crypto 26-Jul-2019
    aixtools.python3.bcrypt.rte 3.1.7.0       # tools bcrypt 26-Jul-2019
    aixtools.python3.cffi.rte 1.12.3.0        # tools cffi 26-Jul-2019
    aixtools.python3.cryptography.rte 2.7.0.0 # tools cryptography 26-Jul-2019
    aixtools.python3.paramiko.rte 2.6.0.0     # tools paramiko 26-Jul-2019
    aixtools.python3.pynacl.rte 1.3.0.0       # tools pynacl 26-Jul-2019

  << End of Failure Section >>

SUCCESSES
---------
  Filesets listed in this section passed pre-deinstall verification
  and will be removed.

  Selected Filesets
  -----------------
  aixtools.python3.six.adt 1.12.0.0           # tools six ADT files

  << End of Success Section >>

FILESET STATISTICS
------------------
    2  Selected to be deinstalled, of which:
        1  Passed pre-deinstall verification
        1  FAILED pre-deinstall verification
  ----
    1  Total to be deinstalled


******************************************************************************
End of installp PREVIEW.  No deinstall operation has actually occurred.
******************************************************************************


Now I just need to figure out how to best include these items in the wiki.

Duckabush

  • Jr. Member
  • **
  • Posts: 9
  • Karma: +0/-0
Re: Paramiko for Python3
« Reply #7 on: July 31, 2019, 05:29:42 PM »
Wow this is a fantastic thread to stumble upon today. I been looking everywhere to ensure I could install Paramiko on our AIX 7.2 setup, but our IT Admin is very fearful of breaking our UniVerse install. We also do not have the luxury of owning the xlC/C++ compiler from IBM, we were attempting to install GCC, but again we don't want to run into any issues.

I hope that we can get Paramiko running as well with python 3.7.

Duckabush

  • Jr. Member
  • **
  • Posts: 9
  • Karma: +0/-0
Re: Paramiko for Python3
« Reply #8 on: July 31, 2019, 05:38:18 PM »
@Michael,

Our system is generally maintained by another company, with minor modifications to our system.

Do we need to remove our Python37 install, and install new, and how do I go about installing paramiko, do i need to install files from http://download.aixtools.net/test/paramiko/?
 (Note from Michael - this directory has been removed) - See http://www.aixtools.net/index.php?title=python.wheels and http://download.aixtools.net/tools/Python3/apps/paramiko/

Thanks


edit: so based on looking around I downloaded all the files for python3 and need to put them in a folder and run
installp -d aixtools.python3.3.7.4.0.I -a all

correct?
« Last Edit: August 02, 2019, 12:03:27 PM by Michael »

Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1156
  • Karma: +0/-0
Re: Paramiko for Python3
« Reply #9 on: August 02, 2019, 05:42:25 AM »
The command would be “installp -d. All”

I found some extra dependencies on some gnu software I don’t want to be there, so please wait for the update to the wiki.

What is your “univers” install?

I try to make my packaging work in parallel with AIX toolbox et al.  So my hope and expectation is that nothing breaks.

Please wait for updates!!