What may be the cause of this error? AttributeError: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK'

This happens due to cryptography library version mismatch. Based on the convo below :point_down:, pinning cryptography to 2.8 wth Prefect 0.15.5 solved the issue.

View in #prefect-community on Slack

@Kathryn_Klarich: Hi all, Iā€™m not sure where the best place to post this is (here versus discourse), but I am running into an error when trying to register a prefect flow: AttributeError: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK' - it seems to be happening during this step RUN pip install pip --upgrade - has anyone come across this before and know how to fix it? I was able to successfully register this flow a few days ago and havenā€™t changed much in the requirements since then.

Kevin_Kho @Kevin_Kho: I think uninstall prefect and re-install it and see if that helps?
What is your cryptography version?

@Kathryn_Klarich: hmm do i need to reinstall it in the image or in my conda environment that I am using to register the flow?

Kevin_Kho @Kevin_Kho: If this is a registration issue, I think just on the registration environment. I think something weird happened with the package versions there

@Kathryn_Klarich: in the image my flow is stored in it is 37.0.0, in my conda env it is 36.0.0

Kevin_Kho @Kevin_Kho: I think that mismatch might be an issue? I donā€™t know for sure. Itā€™s a really weird error :sweat_smile:. For reference though, my stuff is working with 36.0.2 and Prefect 1.2

@Kathryn_Klarich: ok we are using 0.15.5
(prefect version)
iā€™ll try upgrading cryptography on my local env to 0.37.0

Kevin_Kho @Kevin_Kho: Ah ok. It might not even be cryptography
Or well, you could re-build that conda environment if itā€™s not too hard.

@Kathryn_Klarich: yeah i can rebuild the conda env
still getting the same error
maybe i should try rebuilding the base image?
and pinning cryptography to 36.0.2?

Kevin_Kho @Kevin_Kho: Maybe that might help. Itā€™s not just cryptography tho one sec let me show you what i was reading
https://github.com/pyca/pyopenssl/issues/728 this is so old though

GitHub: AttributeError: module ā€˜libā€™ has no attribute ā€˜X509_up_refā€™ Ā· Issue #728 Ā· pyca/pyopenssl

Oh lol cryptography jumped from version 3.4.8 to 35.0.0. No wonder the versions felt so far

@Kathryn_Klarich: ohh haha weird. will check it out, thanks!
Ok I finally got it to work by pinning to cryptography==2.8 in the flowā€™s image (that was the version of cryptography that other flows containerā€™s were using). Iā€™m not sure if this has something to do that we are using prefect version 0.15.5

Kevin_Kho @Kevin_Kho: Oh maybe. Glad you found a working version though

@Kathryn_Klarich: me too :sweat_smile:
thanks for your help!

As an update I donā€™t think it had anything to do with the prefect version as I tried upgrading to prefect 1.2 with newer version of cryptography (37.0.0) and still got this error

1 Like

Thanks. Can you write more about what was the real root cause here and how you solved it?

You wrote: ā€œOk I finally got it to work by pinning to cryptography==2.8 in the flowā€™s imageā€ which seems like a very clear indication that this was the solution :smile:

Iā€™m honestly not sure what the root cause was much more than there is clearly a version conflict with cryptography somewhere. I figured this out by looking at what version of cryptography was installed in the flows I was able to register and they all had cryptography 2.8, the flow I was having an issue with was using 37.0.0. So I tried pinning to cryptography 2.8 and it worked.

1 Like

I just wanted to share one other solution I found.

I didnā€™t have to pin cryptography; I just needed to install pyopenssl
pip install -U pyOpenSSL

1 Like

thanks for sharing, Andrew!