The reason of "RuntimeError: cryptography is required"

Hmm, Python displays "cryptography is required" error.

One day, when I tried to connect to MySQL from Python, I got this error.

RuntimeError: cryptography is required

What is this error ?

So today, I will introduce about 'The reason of "RuntimeError: cryptography is required"'.

目次

RuntimeError: cryptography is required

First, what is "RuntimeError: cryptography is required" ?

When I tried to connect to MySQL from Python, I got this error.

The error message says cryptography is required.
So it seems that system requires "encryption".

It means "encrypt your MySQL password".

Encryption?
Doesn't library do encryption ?

The reason of "RuntimeError: cryptography is required"

The reason why "RuntimeError: cryptography is required" happens is lack of Python cryptographic library.

In order to install cryptographic library, run following command.

pip install cryptography 

Improve helpfulness of error message when cryptography is required · Issue # 768 · PyMySQL / PyMySQL · GitHub

In case of Windows environment, you may face Access denied error.
Then in order to avoid this error, you should choose "Run as administrator" option.

Right click -> Run as administrator

Conclusion

Today I explained about 'The reason of "RuntimeError: cryptography is required"'.

The reason why "RuntimeError: cryptography is required" happens is lack of Python cryptographic library.

When you face the error, you should install cryptography library.

Once you understand the cause of error, you can solve it.

この記事が気に入ったら
いいね または フォローしてね!

If you like this article, please share !
  • URLをコピーしました!
  • URLをコピーしました!

Author

karasanのアバター karasan System engineer

Mid-career engineer (AI, Data science, Salesforce, etc.).
Good at Python and SQL.

目次