Please login or register. October 23, 2017, 06:19:03 AM

Author Topic: Problem with cffi not found  (Read 348 times)

0 Members and 1 Guest are viewing this topic.

scar_86

  • New Member
  • *
  • Posts: 3
  • Karma: +0/-0
Problem with cffi not found
« on: September 02, 2017, 10:18:17 PM »
Hello

I'm pretty newbie to python on AIX, I need to use paramiko, however I face a lot of problems trying to compile it, then I found it under the ansible packages, I installed python and all the ansible packages but there seems to be a problem when paramiko tries to import the cffi module
Below is the summary of the packages I installed and the error trying to import cffi

Installation Summary
--------------------
Name                        Level           Part        Event       Result
-------------------------------------------------------------------------------
aixtools.python.pyparsing.r 2.2.0.0         USR         APPLY       SUCCESS
aixtools.python.pycparser.r 2.17.0.0        USR         APPLY       SUCCESS
aixtools.python.pyasn1.rte  0.2.3.0         USR         APPLY       SUCCESS
aixtools.python.paramiko.rt 2.1.2.0         USR         APPLY       SUCCESS
aixtools.python.packaging.r 16.8.0.0        USR         APPLY       SUCCESS
aixtools.python.ipaddress.r 1.0.18.0        USR         APPLY       SUCCESS
aixtools.python.idna.rte    2.5.0.0         USR         APPLY       SUCCESS
aixtools.python.enum34.rte  1.1.6.0         USR         APPLY       SUCCESS
aixtools.python.cryptograph 1.8.1.0         USR         APPLY       SUCCESS
aixtools.python.cffi.rte    1.9.1.0         USR         APPLY       SUCCESS
aixtools.python.asn1crypto. 0.22.0.0        USR         APPLY       SUCCESS
aixtools.python.appdirs.rte 1.4.3.0         USR         APPLY       SUCCESS
aixtools.python.ansible.rte 2.2.1.0         USR         APPLY       SUCCESS
aixtools.python.rte         2.7.12.3        USR         APPLY       SUCCESS
aixtools.python.man.en_US   2.7.12.3        USR         APPLY       SUCCESS
aixtools.python.six.rte     1.10.0.0        USR         APPLY       SUCCESS
aixtools.python.pycrypto.rt 2.6.1.0         USR         APPLY       SUCCESS
aixtools.python.PyYAML.rte  3.12.0.0        USR         APPLY       SUCCESS
aixtools.python.MarkupSafe. 0.23.0.0        USR         APPLY       SUCCESS
aixtools.python.Jinja2.rte  2.8.0.0         USR         APPLY       SUCCESS

root@AIXhost[/home/user1] /opt/bin/python
>>> import paramiko
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/lib/python2.7/site-packages/paramiko/__init__.py", line 30, in <module>
    from paramiko.transport import SecurityOptions, Transport
  File "/opt/lib/python2.7/site-packages/paramiko/transport.py", line 34, in <module>
    from cryptography.hazmat.primitives.ciphers import algorithms, Cipher, modes
  File "/opt/lib/python2.7/site-packages/cryptography/hazmat/primitives/ciphers/__init__.py", line 7, in <module>
    from cryptography.hazmat.primitives.ciphers. base import (
  File "/opt/lib/python2.7/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 9, in <module>
    import cffi
ImportError: No module named cffi
>>>

I can see from the /opt/lib/python2.7/site-packages dir that there is no directory named cffi it is instead inside the cffi-1.9.1-py2.7-aix-5.3.egg one

root@frankie[../site-packages/cffi-1.9.1-py2.7-aix-5.3.egg] ls
EGG-INFO           _cffi_backend.py   _cffi_backend.pyc  _cffi_backend.so   cffi
root@frankie[../site-packages/cffi-1.9.1-py2.7-aix-5.3.egg]

Is there something I miss to install ? or could it be a problem with the cffi package ?

Thank you in advance

Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1052
  • Karma: +0/-0
Re: Problem with cffi not found
« Reply #1 on: September 03, 2017, 10:49:09 AM »
I thought I had cffi - will have to look. Will respond with more in a few hours.

Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1052
  • Karma: +0/-0
Re: Problem with cffi not found
« Reply #2 on: September 03, 2017, 11:25:44 AM »
On a real computer - and I see you downloaded all the modules. I'll have to look deeper.

Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1052
  • Karma: +0/-0
Re: Problem with cffi not found
« Reply #3 on: September 03, 2017, 05:25:52 PM »
At this point - I can only say that I had it working (cffi) with other modules.

What you could try - is test as root, and/or verify that the cffi files are world readable.

I shall package cffi-1.10 (which is what pip downloads) - maybe cifs-1.11 once I understand why pip is not downloading that directly.

scar_86

  • New Member
  • *
  • Posts: 3
  • Karma: +0/-0
Re: Problem with cffi not found
« Reply #4 on: September 04, 2017, 03:23:22 PM »
Hi !

I was able to install cffi using pip, and now the directory is there (version 1.10.0) and is working fine

root@AIXHost[../python2.7/site-packages] ls -l | grep cffi
-rwxr-xr-x    1 root     bin          346247 Sep 01 14:02 _cffi_backend.so
drwxr-sr-x    2 root     bin            4096 Sep 01 14:02 cffi
drwxr-sr-x    2 root     bin             256 Sep 01 14:02 cffi-1.10.0-py2.7.egg-info
root@ AIXhost[../python2.7/site-packages]

Python 2.7.12 (default, Sep 29 2016, 12:02:17) [C] on aix5
Type "help", "copyright", "credits" or "license" for more information.
>>> import paramiko
>>>

However I see that the package structure seems to be different, it put _cffi_backend on /opt/lib/python2.7/site-packages instead inside the cffi directory, I installed the packages on another machine and move the the cffi (1.9.1) from the .egg directory to the site-packages and also the _cffi_backend.so too and seems that fix the problem  when using only the packages

root@Host2[../site-packages/cffi-1.9.1-py2.7-aix-5.3.egg] cd ..
root@Host2[../python2.7/site-packages] ls -l | grep cffi
drwxr-xr-x    3 bin      bin             256 Sep 04 15:09 cffi-1.9.1-py2.7-aix-5.3.egg
root@Host[../python2.7/site-packages]
root@Host2[../python2.7/site-packages] cd cffi-1.9.1-py2.7-aix-5.3.egg
root@Host2[../site-packages/cffi-1.9.1-py2.7-aix-5.3.egg] ls
EGG-INFO           _cffi_backend.py   _cffi_backend.pyc  _cffi_backend.so   cffi
root@Host2[../site-packages/cffi-1.9.1-py2.7-aix-5.3.egg] mv cffi ../
root@Host2[../site-packages/cffi-1.9.1-py2.7-aix-5.3.egg] mv _cffi_backend.so ../
root@Host2[../site-packages/cffi-1.9.1-py2.7-aix-5.3.egg] cd
root@Host2[/home/pfe] /opt/bin/python
Python 2.7.12 (default, Sep 29 2016, 12:02:17) [C] on aix5
Type "help", "copyright", "credits" or "license" for more information.
>>> import paramiko
>>>


Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1052
  • Karma: +0/-0
Re: Problem with cffi not found
« Reply #5 on: September 04, 2017, 05:19:27 PM »
Thx. I was 'afraid' it was a problem I created.

Glad you figured out to set OBJECT_MODE=64 to get it to build (at least I assume the python build you got from me is 64-bit).

Curious - although I am nearly certain - which compiler are you using? GCC or IBM xlc/vac?

Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1052
  • Karma: +0/-0

scar_86

  • New Member
  • *
  • Posts: 3
  • Karma: +0/-0
Re: Problem with cffi not found
« Reply #7 on: September 08, 2017, 08:26:46 PM »
Thanks a lot !

I'll try the packages as soon as I can

And to answer your question I used the IBM xlc compiler, I also tried GCC when I tried to compile all the packages but it fail regarding doesn't recognize a parameter "-qmaxmen=16000" if I recall correctly, I can try to reproduce the problem if you like

Regards

Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1052
  • Karma: +0/-0
Re: Problem with cffi not found
« Reply #8 on: September 09, 2017, 09:42:32 AM »
-qmaxmem=XXXX is an xlc option. You could just delete the parameter. It is the amount of memory the compiler may use while trying to optimize the code it is compiling.

p.s. Notice - I moved the files (and decided not to leave a symbolic link behind)

http://download.aixtools.net/tools/python-eggs is now http://download.aixtools.net/tools/python/eggs and I am going to try and keep "python-apps" at  http://download.aixtools.net/tools/python/apps