That particular error just means you need to "pip2 install cffi" first.

If you need any hints on how IBM built any of their packages, you can find
all answers to every package IBM has built here:
ftp://public.dhe.ibm.com/software/ibmi/products/pase/rpms/repo/src/

For instance, the spec file for the Python3 package shows the necessary
runtime dependencies
Requires: python3-cffi
Requires: python3-asn1crypto
Requires: python3-idna
Requires: python3-six

The BuildRequires shows you everything that was needed to build a package.
For instance, if you chased down the
spec for the python3-cffi module you'd see
BuildRequires: python3-devel
BuildRequires: python3-pip
BuildRequires: libffi-devel
BuildRequires: pkg-config
BuildRequires: python3-pycparser

So you'll have some time to spend building dependencies (probably 7/8 in
total) but overall this should be a pretty doable exercise.
Start with "yum install libffi-devel pkg-config python2-six"
Then "pip2 install pycparser cffi asn1crypto idna"
... and go from there!




"OpenSource" <opensource-bounces@xxxxxxxxxxxxxxxxxx> wrote on 11/02/2019
01:43:26 PM:

From: Pete Helgren <pete@xxxxxxxxxx>
To: IBMi Open Source Roundtable <opensource@xxxxxxxxxxxxxxxxxx>
Date: 11/02/2019 01:43 PM
Subject: [EXTERNAL] [IBMiOSS] Building cryptography for python2
Sent by: "OpenSource" <opensource-bounces@xxxxxxxxxxxxxxxxxx>

I see that python3 has the cryptography library but not python2 . I am
on V7R4 and python 2.7.17 installed through the Open Source Package
manager (the only way OSS has been installed on this machine). I get
the following error:

bash-4.4$ pip2 install cryptography
DEPRECATION: Python 2.7 will reach the end of its life on January 1st,
2020. Please upgrade your Python as Python 2.7 won't be maintained after

that date. A future version of pip will drop support for Python 2.7.
More details about Python 2 support in pip, can be found at
https://urldefense.proofpoint.com/v2/url?

u=https-3A__pip.pypa.io_en_latest_development_release-2Dprocess_-23python-2D2-2Dsupport&d=DwIGaQ&c=jf_iaSHvJObTbx-
siA1ZOg&r=ZCVxF-
w6wAginVZ42dfeYbM5huvio_77jTCJXaiFgrE&m=qeuQ6fdglsaTQCDEAX2aNmBq-
PeFfrGYVzpLL9P3Vyo&s=3wH7Ck1Ej8m3L-wHynkTSk18wRVkVuuEX-_Arh2C_rM&e=
Collecting cryptography
Using cached
https://urldefense.proofpoint.com/v2/url?

u=https-3A__files.pythonhosted.org_packages_be_60_da377e1bed002716fb2d5d1d1cab720f298cb33ecff7bf7adea72788e4e4_cryptography-2D2.
8.tar.gz&d=DwIGaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=ZCVxF-
w6wAginVZ42dfeYbM5huvio_77jTCJXaiFgrE&m=qeuQ6fdglsaTQCDEAX2aNmBq-
PeFfrGYVzpLL9P3Vyo&s=2CYauS3gLrXfzH-lhatf2FcPc2vmHf3dAiA5MXfW7Eo&e=
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: /QOpenSys/pkgs/bin/python2

/QOpenSys/pkgs/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py

prepare_metadata_for_build_wheel /tmp/tmpV3U20Q
cwd: /tmp/pip-install-CW5LUD/cryptography
Complete output (41 lines):
Traceback (most recent call last):
File
"/QOpenSys/pkgs/lib/python2.7/site-packages/pip/_vendor/pep517/
_in_process.py",
line 257, in <module>
main()
File
"/QOpenSys/pkgs/lib/python2.7/site-packages/pip/_vendor/pep517/
_in_process.py",
line 240, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File
"/QOpenSys/pkgs/lib/python2.7/site-packages/pip/_vendor/pep517/
_in_process.py",
line 110, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File
"/tmp/pip-build-env-3ziLDd/overlay/lib/python2.7/site-packages/
setuptools/build_meta.py",
line 156, in prepare_metadata_for_build_wheel
self.run_setup()
File
"/tmp/pip-build-env-3ziLDd/overlay/lib/python2.7/site-packages/
setuptools/build_meta.py",
line 142, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 275, in <module>
**keywords_with_side_effects(sys.argv)
File
"/tmp/pip-build-env-3ziLDd/overlay/lib/python2.7/site-packages/
setuptools/__init__.py",
line 145, in setup
return distutils.core.setup(**attrs)
File "/QOpenSys/pkgs/lib/python2.7/distutils/core.py", line 111,
in setup
_setup_distribution = dist = klass(attrs)
File
"/tmp/pip-build-env-3ziLDd/overlay/lib/python2.7/site-packages/
setuptools/dist.py",
line 447, in __init__
k: v for k, v in attrs.items()
File "/QOpenSys/pkgs/lib/python2.7/distutils/dist.py", line 287,
in __init__
self.finalize_options()
File
"/tmp/pip-build-env-3ziLDd/overlay/lib/python2.7/site-packages/
setuptools/dist.py",
line 735, in finalize_options
ep.load()(self, ep.name, value)
File
"/tmp/pip-build-env-3ziLDd/overlay/lib/python2.7/site-packages/cffi/
setuptools_ext.py",
line 217, in cffi_modules
add_cffi_module(dist, cffi_module)
File
"/tmp/pip-build-env-3ziLDd/overlay/lib/python2.7/site-packages/cffi/
setuptools_ext.py",
line 49, in add_cffi_module
execfile(build_file_name, mod_vars)
File
"/tmp/pip-build-env-3ziLDd/overlay/lib/python2.7/site-packages/cffi/
setuptools_ext.py",
line 25, in execfile
exec(code, glob, glob)
File "src/_cffi_src/build_openssl.py", line 106, in <module>
extra_link_args=extra_link_args(compiler_type()),
File "src/_cffi_src/utils.py", line 57, in build_ffi_for_binding
extra_link_args=extra_link_args,
File "src/_cffi_src/utils.py", line 65, in build_ffi
ffi = FFI()
File

"/tmp/pip-build-env-3ziLDd/overlay/lib/python2.7/site-packages/cffi/api.py",

line 48, in __init__
import _cffi_backend as backend
ImportError: Could not load module
/tmp/pip-build-env-3ziLDd/overlay/lib/python2.7/site-packages/
_cffi_backend.so.
The local-exec model was used for thread-local
storage, but the module is not the main program.
Examine the .loader section header with the 'dump -Hv' command.
----------------------------------------
ERROR: Command errored out with exit status 1:
/QOpenSys/pkgs/bin/python2

/QOpenSys/pkgs/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py

prepare_metadata_for_build_wheel /tmp/tmpV3U20Q Check the logs for full
command output.

Searches turned up nothing useful.cffi is installed: (with "pip2 install

cffi") just can't quite sort out what the error is trying to tell me
except that _cffi_backend.so shared object isn't found.

--
Pete Helgren
www.petesworkshop.com
GIAC Secure Software Programmer-Java
Twitter - Sys_i_Geek IBM_i_Geek



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.