ModuleNotFoundError: No module named 'cryptography.hazmat'; 'cryptography' is not a package
Asked Answered
B

2

1

This line

from cryptography.hazmat.backends import default_backend

is creating this error

Traceback (most recent call last):
  File "C:/Users/user/PycharmProjects/crypto/venv/cryptography.py", line 2, in <module>
    from cryptography.hazmat.backends import default_backend
  File "C:\Users\user\PycharmProjects\crypto\venv\cryptography.py", line 2, in <module>
    from cryptography.hazmat.backends import default_backend
ModuleNotFoundError: No module named 'cryptography.hazmat'; 'cryptography' is not a package

Process finished with exi
Bergen answered 25/10, 2019 at 13:3 Comment(0)
M
7

You named your file cryptography.py. That conflicts with (and takes precendence over) cryptography package.

Rename your file name to (something that isn't a well known module / package name) e.g. cryptography_test.py (consider a valid Python identifier name, if you'll ever need to import it from another script), and you should be fine.

More info:

Mettle answered 25/10, 2019 at 13:11 Comment(0)
T
0

i was getting that error when i use from arcgis import GIS

it worked after ive dont this conda install -c conda-forge protobuf pip install --no-cache arcgis --user

Tatting answered 15/6, 2023 at 11:59 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Chairwoman

© 2022 - 2024 — McMap. All rights reserved.