Build failure, python3-ply, no SSL for pip

Debian 9.5 (Stretch), fully patched. Both python-pip and python3-pip are installed at the OS level.

Based off openwrt-18.06 branch at 14580aaf81c692b0f54b4e7aa003f20eeb8705f6 with a few unrelated commits added (capture of config, a couple hacks around gretap and netifd scripts)

Edit: Same behavior with openwrt-18.06 and no modifications.

I believe that these modules get pulled in by ulogd-mod-dbi.

It does appear that it was built for 18.06.01 -- https://downloads.openwrt.org/releases/packages-18.06/mipsel_24kc/packages/python3-ply_3.11-1_mipsel_24kc.ipk as well as the current snapshot https://downloads.openwrt.org/snapshots/packages/mipsel_24kc/packages/python-ply_3.11-1_mipsel_24kc.ipk

  Could not fetch URL https://pypi.python.org/simple/ply/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/ply/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping
  Could not find a version that satisfies the requirement ply==3.10 (from versions: )
No matching distribution found for ply==3.10
Makefile:67: recipe for target '/home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-pycparser-2.18/.built' failed

Any ideas on this one?

More context on the error:

make[3]: Entering directory '/home/jeff/devel/openwrt/feeds/packages/lang/python/python-ply'
mkdir -p /home/jeff/devel/openwrt/out/OpenWrt-2018-08-26_1108-0700-ar71xx-generic/targets/ar71xx/generic/packages /home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-mips_24kc/python3-ply/CONTROL /home/jeff/devel/openwrt/staging_dir/target-mips_24kc_musl/pkginfo
find /home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-install -name "*\.exe" | xargs rm -f
/usr/bin/env bash ../python-package-install.sh "3" "/home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-install" "/home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-mips_24kc/python3-ply" "/home/jeff/devel/openwrt/staging_dir/hostpkg/bin/python3.6" "" "$V_Py3Package_python3_ply_filespec"
copying: '/usr/lib/python3.6/site-packages'
Listing '/home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-mips_24kc/python3-ply'...
Listing '/home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-mips_24kc/python3-ply/CONTROL'...
Listing '/home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-mips_24kc/python3-ply/usr'...
Listing '/home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-mips_24kc/python3-ply/usr/lib'...
Listing '/home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-mips_24kc/python3-ply/usr/lib/python3.6'...
Listing '/home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-mips_24kc/python3-ply/usr/lib/python3.6/site-packages'...
Listing '/home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-mips_24kc/python3-ply/usr/lib/python3.6/site-packages/ply'...
Compiling '/home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-mips_24kc/python3-ply/usr/lib/python3.6/site-packages/ply/__init__.py'...
Compiling '/home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-mips_24kc/python3-ply/usr/lib/python3.6/site-packages/ply/cpp.py'...
Compiling '/home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-mips_24kc/python3-ply/usr/lib/python3.6/site-packages/ply/ctokens.py'...
Compiling '/home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-mips_24kc/python3-ply/usr/lib/python3.6/site-packages/ply/lex.py'...
Compiling '/home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-mips_24kc/python3-ply/usr/lib/python3.6/site-packages/ply/yacc.py'...
Compiling '/home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-mips_24kc/python3-ply/usr/lib/python3.6/site-packages/ply/ygen.py'...
Listing '/home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-mips_24kc/python3-ply/usr/lib/python3.6/site-packages/ply-3.11-py3.6.egg-info'...
find /home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-mips_24kc/python3-ply -name 'CVS' -o -name '.svn' -o -name '.#*' -o -name '*~'| xargs -r rm -rf
export CROSS="mips-openwrt-linux-musl-"  NO_RENAME=1 ; NM="mips-openwrt-linux-musl-nm" STRIP="/home/jeff/devel/openwrt/staging_dir/host/bin/sstrip" STRIP_KMOD="/home/jeff/devel/openwrt/scripts/strip-kmod.sh" PATCHELF="/home/jeff/devel/openwrt/staging_dir/host/bin/patchelf" /home/jeff/devel/openwrt/scripts/rstrip.sh /home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-mips_24kc/python3-ply
(cd /home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-mips_24kc/python3-ply/CONTROL; ( echo "$CONTROL"; printf "Description: "; echo "$DESCRIPTION" | sed -e 's,^[[:space:]]*, ,g'; ) > control; chmod 644 control; ( echo "#!/bin/sh"; echo "[ \"\${IPKG_NO_SCRIPT}\" = \"1\" ] && exit 0"; echo "[ -x "\${IPKG_INSTROOT}/lib/functions.sh" ] || exit 0"; echo ". \${IPKG_INSTROOT}/lib/functions.sh"; echo "default_postinst \$0 \$@"; ) > postinst; ( echo "#!/bin/sh"; echo "[ -x "\${IPKG_INSTROOT}/lib/functions.sh" ] || exit 0"; echo ". \${IPKG_INSTROOT}/lib/functions.sh"; echo "default_prerm \$0 \$@"; ) > prerm; chmod 0755 postinst prerm;  )
install -d -m0755 /home/jeff/devel/openwrt/out/OpenWrt-2018-08-26_1108-0700-ar71xx-generic/packages/mips_24kc/packages
/home/jeff/devel/openwrt/scripts/ipkg-build -c -o 0 -g 0 /home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-mips_24kc/python3-ply /home/jeff/devel/openwrt/out/OpenWrt-2018-08-26_1108-0700-ar71xx-generic/packages/mips_24kc/packages
Packaged contents of /home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/ipkg-mips_24kc/python3-ply into /home/jeff/devel/openwrt/out/OpenWrt-2018-08-26_1108-0700-ar71xx-generic/packages/mips_24kc/packages/python3-ply_3.11-1_mips_24kc.ipk
mkdir -p /home/jeff/devel/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/stamp
SHELL= flock /home/jeff/devel/openwrt/tmp/.root-copy.flock -c 'cp -fpR /home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-ply-3.11/.pkgdir/python3-ply/. /home/jeff/devel/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/'
touch /home/jeff/devel/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/stamp/.python3-ply_installed
make[3]: Leaving directory '/home/jeff/devel/openwrt/feeds/packages/lang/python/python-ply'
time: package/feeds/packages/python/python-ply/python3/compile#0.30#0.02#0.51
make[3]: Entering directory '/home/jeff/devel/openwrt/feeds/packages/lang/python/python-pycparser'
rm -f /home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-pycparser-2.18/.built
touch /home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-pycparser-2.18/.built_check
ARCH="x86_64" CC="ccache gcc" CCSHARED="ccache gcc -fPIC" CXX="ccache g++" LD="ccache gcc" LDSHARED="ccache gcc -shared" CFLAGS="-O2 -I/home/jeff/devel/openwrt/staging_dir/host/include -I/home/jeff/devel/openwrt/staging_dir/hostpkg/include -I/home/jeff/devel/openwrt/staging_dir/target-mips_24kc_musl/host/include" CPPFLAGS="-I/home/jeff/devel/openwrt/staging_dir/host/include -I/home/jeff/devel/openwrt/staging_dir/hostpkg/include -I/home/jeff/devel/openwrt/staging_dir/target-mips_24kc_musl/host/include -I/home/jeff/devel/openwrt/staging_dir/hostpkg/include/python3.6" LDFLAGS="-L/home/jeff/devel/openwrt/staging_dir/host/lib -L/home/jeff/devel/openwrt/staging_dir/hostpkg/lib -L/home/jeff/devel/openwrt/staging_dir/target-mips_24kc_musl/host/lib -lpython3.6 -Wl,-rpath=/home/jeff/devel/openwrt/staging_dir/hostpkg/lib" _PYTHON_HOST_PLATFORM=linux2 /home/jeff/devel/openwrt/staging_dir/hostpkg/bin/pip3.6 install --root=/home/jeff/devel/openwrt/staging_dir/hostpkg --prefix="" "ply==3.10"
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting ply==3.10
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/ply/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/ply/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/ply/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/ply/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/ply/
  Could not fetch URL https://pypi.python.org/simple/ply/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/ply/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping
  Could not find a version that satisfies the requirement ply==3.10 (from versions: )
No matching distribution found for ply==3.10
Makefile:67: recipe for target '/home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-pycparser-2.18/.built' failed
make[3]: *** [/home/jeff/devel/openwrt/build_dir/target-mips_24kc_musl/python3-pycparser-2.18/.built] Error 1
make[3]: Leaving directory '/home/jeff/devel/openwrt/feeds/packages/lang/python/python-pycparser'
Command exited with non-zero status 2
time: package/feeds/packages/python/python-pycparser/python3/compile#1.14#0.02#8.75
package/Makefile:107: recipe for target 'package/feeds/packages/python/python-pycparser/compile' failed
make[2]: *** [package/feeds/packages/python/python-pycparser/compile] Error 2
make[2]: Leaving directory '/home/jeff/devel/openwrt'
package/Makefile:103: recipe for target '/home/jeff/devel/openwrt/staging_dir/target-mips_24kc_musl/stamp/.package_compile' failed
make[1]: *** [/home/jeff/devel/openwrt/staging_dir/target-mips_24kc_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/jeff/devel/openwrt'
/home/jeff/devel/openwrt/include/toplevel.mk:216: recipe for target 'world' failed
make: *** [world] Error 2

I face the same issue. What could be the reason?

I solve it by hash dependency:
vi feeds/packages/lang/python/python-pycparser/Makefile
#HOST_PYTHON_PACKAGE_BUILD_DEPENDS:="ply==3.11"
#HOST_PYTHON3_PACKAGE_BUILD_DEPENDS:="ply==3.11"

I met the same problem. Is there other way to solve it? Thank you very much.

There were many fixes on trunk for Python. Did you try latest version ? or you are working on branch 18.06 ?