ImportError: cannot import name certificate_transparency
On Thursday, January 17, 2019 at 12:10:51 AM UTC-8, Stone Zhong wrote:
> My program depend on package oci, I am using the following command to install it:
> pip install oci
> Everything works perfect in virtualenv (I am still using python 2.7.x)
> Now I am creating a zip file from the libraries:
> pip install oci -t ~/temp/oci
> cd ~/temp/oci
> zip -r ~/temp/oci.zip .
> Test A) PYTHONPATH=~/temp/oci myapp.py
> Test B) PYTHONPATH=~/temp/oci.zip myapp.py
> Test A) works fine and Test B) failed with error "ImportError: cannot import name certificate_transparency"
> It seems we have some so file there:
> I also tested below:
> from cryptography.hazmat.bindings._constant_time import lib
> PYTHONPATH=~/temp/oci.zip mytest.py
> I end up with error "ImportError: No module named _constant_time"
> So my guess is, package with shared lib (.so files) cannot be put into zip file, is it a bug in python zipimport?
> The reason I have to use a zip file is, I need it in a spark job, I cannot do "virtualenv" in pyspark, have to use --py-files to pass the zip file for all dependent packages.
ok, found the doc @ https://docs.python.org/3/library/zipimport.html
import of dynamic modules (.pyd, .so) is disallowed.
So it is not a bug.