-2

Modulenotfounderror: no module named 'cryptography'

Modulenotfounderror: no module named 'cryptography'

  • Please read the *Python* documentation pages [Command line and environment](https://docs.python.org/3/using/cmdline.html) with information about the environment variable __PYTHONPATH__ and [Using Python on Windows](https://docs.python.org/3/using/cmdline.html) and [Modules](https://docs.python.org/3/tutorial/modules.html) to get knowledge how *Python* finds modules (libraries). – Mofi Feb 21 '23 at 08:12
  • See also [ImportError: No module named 'cryptography'](https://stackoverflow.com/questions/39180609/) Is the `cryptography` module installed at all? It is not a module which is installed together with *Python*. – Mofi Feb 21 '23 at 08:15

2 Answers2

0

Please do try to uninstall and re-install cryptography from the command prompt using pip, sometimes a package might not be installed properly which can happen because of change in path, which is also to be verified after uninstalling.

    pip uninstall cryptography
    pip install cryptography 

Meanwhile you can also try to check all the libraries installed in python using:

    pip freeze
K Rinish
  • 47
  • 1
  • 2
  • 9
0

Thanks for the tip on pip freeze which confirmed cryptography wasn't installed, despite it being listed in my Pipfile (using pipenv).

Just an extra potential answer here for folks using pipenv.

In my case, the cryptography package listed in the Pipfile was being restricted to a specific version. pipenv install clearly skipped it due to incompatibility without making this obvious. Changing the specific version requirement to wildcard worked for me.

Reece
  • 641
  • 7
  • 18