Install Crypto using pip in windows - python

I tried with pycrypto, pycryptodome, and crypto seperately.. But it shows ModuleNotFoundError: No module named 'Crypto'
python -m venv .venv
.venv\scripts\activate
pip install pycryptodome
pip install pycrypto
pip install crypto
Installed all the above library..
(.venv) C:\Users\Gokul\Desktop\New Meter>python send_string.py
Traceback (most recent call last):
File "C:\Users\Gokul\Desktop\New Meter\send_string.py", line 7, in <module>
from Crypto.Cipher import AES
ModuleNotFoundError: No module named 'Crypto'

simply deleted my existing folder of pycrpto/pycryptodome-3.11.0 located at ..\Python\Python310\Lib\site-packages (if any..), then tried
pip install pycryptodome

Related

No module named 'importlib.metadata'

I'm trying to install Odoo 15.0 on mac (python 3.7) when i come to run the command:
pip3 install -r requirements.txt
I got this error message:
Traceback (most recent call last):
File "/usr/local/opt/python#3.7/bin/pip3", line 10, in <module>
from importlib.metadata import distribution
ModuleNotFoundError: No module named 'importlib.metadata'
Try installing this lib manually, using :
pip install importlib-metadata
or
pip3 install importlib-metadata

ModuleNotFoundError: No module named 'cryptodomex'

I am getting this error:
Traceback (most recent call last):
File "XXX", line 7, in <module>
from crypt import AESCipher
File "XXX", line 3, in <module>
from cryptodomex import Random
ModuleNotFoundError: No module named 'cryptodomex'
Process finished with exit code 1
Here is my code:
from cryptodomex import Random
from cryptodomex.Cipher import AES
I have the cryptodomex package installed and are still getting this error. Any thoughts?
The pycryptodomex pip package installs its modules under the Cryptodome namespace, without the x. Your imports should be:
from Cryptodome import Random
from Cryptodome.Cipher import AES
(The pycryptodome (without the x) pip package installs its modules under Crypto, as a drop-in replacement for the old pycrypto library)
You should install Cryptodome library by following command line:
pip install pycryptodome
OR
sudo apt install python3-pycrytodome
You should try installing pycryptodomex rather pycryptodome(without x) using the following command line:
pip install pycrotodomex
As,
pip install pycrotodome
command gives ModuleNotFoundError

ImportError: cannot import name 'sysconfig' from 'distutils' (/usr/lib/python3.8/distutils/__init__.py)

I installed pip3 using sudo apt-get install python3-pip after that when I run the following command to install django sudo pip3 install django I get this error:
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in
from pip import main
File "/usr/lib/python3/dist-packages/pip/init.py", line 14, in
from pip.utils import get_installed_distributions, get_prog
File "/usr/lib/python3/dist-packages/pip/utils/init.py", line 23, in
from pip.locations import (
File "/usr/lib/python3/dist-packages/pip/locations.py", line 9, in
from distutils import sysconfig
ImportError: cannot import name 'sysconfig' from 'distutils' (/usr/lib/python3.8/distutils/init.py)
How do I fix this?
I have tried recently manually installing python3.9 version in my Ubuntu from 3.6 version using apt install python3.9. Then pip3 was broken. The issue is because distutils were not build for the 3.9 version.
So in my case I ran apt install python3.9-distutils to resolve my issue.
In your case make sure to modify 3.x version in distutils command.
This helped but then I got another error: ImportError: No module named 'pip._internal'
The following fixed it:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py --force-reinstall

ModuleNotFoundError: No module named 'python_jwt' (Raspberry Pi)

I can't import correct Firebase package in Raspberry PI.
My code:
from firebase import firebase
db = firebase.FirebaseApplication("https://xyz.firebaseio.com/", None)
Error:
Traceback (most recent call last):
File "datastorage.py", line 1, in <module>
from firebase import firebase
firebase/__init__.py", line 14, in <module>
import python_jwt as jwt
ModuleNotFoundError: No module named 'python_jwt'
I tried to use this commands and it didn't help:
sudo pip install requests
sudo pip install python-firebase
pip install jwt
I use Python 3.7.3 and Raspbian Buster. All works on my PC but not on RPi 3B+.
I used advice from #naive.
pip install python_jwt
After that I solved another errors in that order:
pip install gcloud
pip install sseclient
pip install pycrypto
pip install requests-toolbelt
And now I see that It works. Problem was solved.
I think you need python_jwt instead of jwt. You can do:
pip install python_jwt
If you're referring to this library:
https://pyjwt.readthedocs.io/en/latest/
Then you need to install like this:
pip install PyJWT
And afterwards this will work:
import jwt

Unable to import owlready in Python

I am trying to use the owlready library in Python. I downloaded the file from link(https://pypi.python.org/pypi/Owlready) but when I am importing owlready I am getting following error:
>>> from owlready import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'owlready'
I tried running:
pip install owlready
I am get the error:
error: could not create '/usr/local/lib/python3.4/dist-packages/owlready': Permission denied
Try installing it using pip instead.
Run the command pip install <module name here> to do so. If you are using python3, run pip3 install <module name here>.
If neither of these work you may also try:
python -m pip install <module name here>
or
python3 -m pip install <module name here>
If you don't yet have pip, you should probably get it. Very commonly used python package manager. Here are some details on how to set the tool up.
You need installed library:
C:\PythonX.X\Scripts
pip install owlready
Successfully installed Owlready-0.3

Categories