Sarhan
02/17/2023, 2:47 AMDownloading flow code from storage at '/deployment/'
Flow could not be retrieved from deployment.
And the traceback ends with (full traceback in thread):
AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'
Running the agent locally is perfectly fine so it’s only when deployed to EC2 that I’m getting the error.
I’ve checked a number of things already including referencing this thread from Brian:
• EC2 is able to connect to S3 and download files (used AWS CLI here) as well as run head_object()
(Python - boto3 here)
• Reinstalled s3fs
. My error isn’t quite the same as Brian’s but tried it anyway.
• Changed my versions of pyOpenSSL
and cryptography
following the first answer here.
• made sure path
and entrypoint
are present and correct (side note that my flow is quite deep into my directory)
Some additional notes:
• Deployed using PythonSarhan
02/17/2023, 2:48 AMDownloading flow code from storage at '/deployment/'
09:48:55 AM
ERROR
Flow could not be retrieved from deployment.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/prefect/engine.py", line 268, in retrieve_flow_then_begin_flow_run
flow = await load_flow_from_flow_run(flow_run, client=client)
File "/usr/local/lib/python3.10/dist-packages/prefect/client/utilities.py", line 47, in with_injected_client
return await fn(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/prefect/deployments.py", line 175, in load_flow_from_flow_run
await storage_block.get_directory(from_path=deployment.path, local_path=".")
File "/usr/local/lib/python3.10/dist-packages/prefect/filesystems.py", line 476, in get_directory
return await self.filesystem.get_directory(
File "/usr/local/lib/python3.10/dist-packages/prefect/filesystems.py", line 320, in get_directory
return self.filesystem.get(from_path, local_path, recursive=True)
File "/usr/local/lib/python3.10/dist-packages/prefect/filesystems.py", line 401, in filesystem
self._filesystem = fsspec.filesystem(scheme, **self.settings)
File "/usr/local/lib/python3.10/dist-packages/fsspec/registry.py", line 251, in filesystem
cls = get_filesystem_class(protocol)
File "/usr/local/lib/python3.10/dist-packages/fsspec/registry.py", line 211, in get_filesystem_class
register_implementation(protocol, _import_class(bit["class"]))
File "/usr/local/lib/python3.10/dist-packages/fsspec/registry.py", line 234, in _import_class
mod = importlib.import_module(mod)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/usr/local/lib/python3.10/dist-packages/s3fs/__init__.py", line 1, in <module>
from .core import S3FileSystem, S3File
File "/usr/local/lib/python3.10/dist-packages/s3fs/core.py", line 28, in <module>
import aiobotocore.session
File "/usr/local/lib/python3.10/dist-packages/aiobotocore/session.py", line 1, in <module>
from botocore import UNSIGNED, translate
File "/usr/local/lib/python3.10/dist-packages/botocore/translate.py", line 16, in <module>
from botocore.utils import merge_dicts
File "/usr/local/lib/python3.10/dist-packages/botocore/utils.py", line 34, in <module>
import botocore.httpsession
File "/usr/local/lib/python3.10/dist-packages/botocore/httpsession.py", line 41, in <module>
from urllib3.contrib.pyopenssl import orig_util_SSLContext as SSLContext
File "/usr/lib/python3/dist-packages/urllib3/contrib/pyopenssl.py", line 50, in <module>
import OpenSSL.SSL
File "/usr/lib/python3/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/usr/lib/python3/dist-packages/OpenSSL/crypto.py", line 3279, in <module>
_lib.OpenSSL_add_all_algorithms()
AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'
James Sopkin
02/17/2023, 2:59 AMJames Sopkin
02/17/2023, 3:00 AMSarhan
02/17/2023, 3:07 AMJames Sopkin
02/17/2023, 3:11 AMJames Sopkin
02/17/2023, 3:12 AMSarhan
02/17/2023, 3:17 AMSarhan
02/17/2023, 3:20 AMJames Sopkin
02/17/2023, 3:23 AMpip install --force-reinstall "cryptography==38.0.4"
Sarhan
02/17/2023, 3:28 AMJames Sopkin
02/17/2023, 3:33 AMpip install --upgrade --force-reinstall pyopenssl
James Sopkin
02/17/2023, 3:35 AMSarhan
02/17/2023, 3:44 AM