#๐ No module named cryptography
33 messages ยท Page 1 of 1 (latest)
@prime star
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
you possibly have multiple python installed. instead of using the pip command directly to install, try using the python command with -m pip install cryptography instead
e.g. python -m pip install ...
or py -m pip install ...
depending on what "python" command you use to run the script.
that should ensure to use the specific pip of that python installation
What is this script?
If you wrote it yourself, you'd know what to install...
And if you downloaded it, please make sure it's safe.
26+ lines of imports is sus, importing cryptography can be sus or not - depending on context.
Maybe he has a license header?
Not necessarily 26 loc, right?
If cryptography can't be installed from a wheel, then it usually fails to install from source (i.e. at all), unless you happen to have Rust installed.
Still the same, no module named cryptography.
It may well have downloaded. Make sure it actually installed successfully (cryptography often doesn't) by posting the complete output from pip.
On unusual platforms, PyCryptodome is a more reliable bet, as it's all pure Python
Thanks.
im using cryptography.Fernet to import Fernet, which i use to encrypt data
Can you try the same again with python -m pip?
Great. What about python -c "import cryptography"?
didnt display anything
Cool, that means there was no error, and the base module at least was imported successfully
Alright, let me test it.
How about `python -c "from cryptography.fernet import Fernet"
I need to go, but it crossed my mind that if you're running Windows on ARM, not on x86/amd64, then I couldn't find a Cryptography wheel for that architecture
Good luck!
Drat. You're not in Python 3.14 are you?
If it was me, I'd go through the installation directories then, comparing what should be there with what actually is. Unfortunately this is best done locally (i.e., by you!).
it should be
from cryptography.fernet import Fernet
^
``` and not
```py
from cryptography.Fernet import Fernet
^
(if cryptography was not installed, it would not include the ".Fernet" part in the error message)
@prime star
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.