I am using python3.8 to run a Django project, I tried to import Pisa from xhtml2pdf, got a error message listed below:
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/xhtml2pdf/pisa.py", line 26, in <module>
from xhtml2pdf.document import pisaDocument
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/xhtml2pdf/document.py", line 24, in <module>
from xhtml2pdf.builders.signs import PDFSignature
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/xhtml2pdf/builders/signs.py", line 5, in <module>
from pyhanko.pdf_utils.incremental_writer import IncrementalPdfFileWriter
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyhanko/pdf_utils/incremental_writer.py", line 8, in <module>
from . import generic, misc
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyhanko/pdf_utils/generic.py", line 21, in <module>
from .misc import (
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyhanko/pdf_utils/misc.py", line 18, in <module>
from pyhanko_certvalidator.util import CancelableAsyncIterator, ConsList
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyhanko_certvalidator/__init__.py", line 8, in <module>
from .context import ValidationContext
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyhanko_certvalidator/context.py", line 13, in <module>
from .fetchers.requests_fetchers import RequestsFetcherBackend
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyhanko_certvalidator/fetchers/requests_fetchers/__init__.py", line 8, in <module>
from .cert_fetch_client import RequestsCertificateFetcher
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyhanko_certvalidator/fetchers/requests_fetchers/cert_fetch_client.py", line 7, in <module>
from ...errors import CertificateFetchError
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyhanko_certvalidator/errors.py", line 8, in <module>
from pyhanko_certvalidator._state import ValProcState
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyhanko_certvalidator/_state.py", line 5, in <module>
from pyhanko_certvalidator.path import ValidationPath
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyhanko_certvalidator/path.py", line 15, in <module>
from .util import get_ac_extension_value, get_issuer_dn
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyhanko_certvalidator/util.py", line 10, in <module>
from cryptography.hazmat.primitives.asymmetric import (
ImportError: cannot import name 'ed448' from 'cryptography.hazmat.primitives.asymmetric' (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/cryptography/hazmat/primitives/asymmetric/__init__.py)
P.S. my python version is 3.8.9, Django version is 2.0.7, cryptography version is 2.2.2.
Can you please help me to figure it out? THX!
>Solution :
Ed448 support is only available from cryptography 2.6, it’s mentioned in the documentation and in the changelog.