ModuleNotFoundError: No module named 'cryptodomex' - python

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

Related

Install Crypto using pip in windows

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

Trouble shooting when tring to install and import `stats_exporter` from `opencensus.ext.stackdriver`

Im trying to install and use stats_exporter from opencensus.ext.stackdriver using the following guide: opencensus-ext-stackdriver
after installing it through pip:
pip install opencensus-ext-stackdriver
Im trying to import it and:
from opencensus.ext.stackdriver import stats_exporter as stackdriver
ImportError: cannot import name 'stats_exporter' from 'opencensus.ext.stackdriver'
When comparing the Git repo, and my local venv/lib/python3.7/site-packages/... it seems like the pip version isn't compatible with Github , so i tried to install it though cloning, and using setup.py
pip install ../opencensus-python/contrib/opencensus-ext-stackdriver/dist/opencensus-ext-stackdriver-0.2.dev0.tar.gz
which gives me the following error:
(venv) Yehoshaphats-MacBook-Pro:present-value yehoshaphatschellekens$ pip install ../opencensus-python/contrib/opencensus-ext-stackdriver/dist/opencensus-ext-stackdriver-0.2.dev0.tar.gz
Processing /Users/yehoshaphatschellekens/opencensus-python/contrib/opencensus-ext-stackdriver/dist/opencensus-ext-stackdriver-0.2.dev0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/s2/y6vcdc1105s8xlpb12slr9z00000gn/T/pip-req-build-7m1ibdpd/setup.py", line 17, in <module>
from version import __version__
ModuleNotFoundError: No module named 'version'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/s2/y6vcdc1105s8xlpb12slr9z00000gn/T/pip-req-build-7m1ibdpd/
Similar errors of this type indicated that i need to upgrade setuptools, tried that also :(
This post suggests that it might related to the fact that i'm using python3, which isn't completable with version though i really need to install this package on my python3 venv.
Any Help on this issue would be great!
Try this:
#!/usr/bin/env python
import os
from opencensus.common.transports.async_ import AsyncTransport
from opencensus.ext.stackdriver import trace_exporter as stackdriver_exporter
from opencensus.trace import tracer as tracer_module
from opencensus.stats import stats as stats_module
def main():
sde = stackdriver_exporter.StackdriverExporter(
project_id=os.environ.get("PROJECT_ID"),
transport=AsyncTransport)
tracer = tracer_module.Tracer(exporter=sde)
with tracer.span(name='doingWork') as span:
for i in range(10):
continue
if __name__ == "__main__":
main()
and
grpcio==1.19.0
opencensus==0.3.1
opencensus-ext-stackdriver==0.1.1
NB The OpenCensus libraries need gRPC too.
You will need:
a GCP Project and it's Project ID (${PROJECT_ID})
a service account with roles/cloudtrace.agent and its key.
Then:
virtualenv venv
source venv/bin/activate
export PROJECT_ID=[[YOUR-PROJECT-ID]]
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/key.json
pip3 install --requirement requirements.txt
python3 stackdriver.py

Python import google.oauth2.credentials ImportError: No module named google.oauth2.credentials

i'm trying to run this bot https://github.com/ItsCEED/Youtube-Comment-Bot
in mac os but i get this error
l:Youtube-Comment-Bot-master ROOTXX$ python yt.py
Traceback (most recent call last):
File "yt.py", line 6, in <module>
import google.oauth2.credentials
ImportError: No module named google.oauth2.credentials
l:Youtube-Comment-Bot-master ROOTXX$
Run in a root terminal:
pip install --upgrade google-api-python-client
From here, found with a google search.
EDIT: Even better, you linked the required libraries yourself. They are in the GitHub README.md at here. Please read your own links. Anyway, the commands to install follow:
# pip install --upgrade google-api-python-client
# pip install --upgrade requests
# pip install --upgrade beautifulsoup4

Error installing paramiko using pip

I am trying to install paramiko using pip. It shows the following long list of error messages after installation. The message here Details here.
Running pip freeze show the paramiko package on the installation list but it is not working.
Trying to run a simple paramiko program shows following error again
Traceback (most recent call last):
File "paramikoBasic.py", line 1, in <module>
import paramiko
File "/home/tara/taraproject/scripttest/paramiko_test/myenv/local/lib/python2.7/site-packages/paramiko/__init__.py", line 30, in <module>
from paramiko.transport import SecurityOptions, Transport
File "/home/tara/taraproject/scripttest/paramiko_test/myenv/local/lib/python2.7/site-packages/paramiko/transport.py", line 33, in <module>
from cryptography.hazmat.backends import default_backend
ImportError: No module named cryptography.hazmat.backendsled
I even tried to install cryptography separately but that even didn't solve the problem. Installed libffi too but that also didn't work out.
I am guessing you are using ubuntu since it's a common problem
The cffi module is dependent on libffi and libffi-dev.
If you search for current version using
apt-cache search libffi
you should be able to get latest version.
Currently you can install as
sudo apt-get install libffi6 libffi-dev
Also you need to install python-dev and crypto packages as logs indicates.
Credit: https://gist.github.com/tchalvak/a230f8b759875748240d
Cheers

How to install google.cloud with Python pip?

I am relatively new to Python and I am stuck on something which is probably relatively easy to resolve.
I have installed the following packages:
pip install --upgrade google-api-python-client
pip install --upgrade google-cloud
pip install --upgrade google-cloud-vision
In my Python file I have:
import cv2
import io
import os
# Imports the Google Cloud client library
from google.cloud import vision
...etc...
And this gives me the error:
Traceback (most recent call last):
File "test.py", line 6, in <module>
from google.cloud import vision
ImportError: No module named 'google.cloud'
What am I missing and where should I look (logs?) to find the answer in the future.
PS:
Pip installs of google-cloud and google-cloud-vision have the output:
Cannot remove entries from nonexistent file /Users/foobar/anaconda/lib/python3.5/site-packages/easy-install.pth
UPDATE:
Running pip freeze doesn't show the packages to be installed...
I had a similar problem. Adding "--ignore-installed" to my pip command made it work for me.
This might be a bug in pip - see this page for more details: https://github.com/pypa/pip/issues/2751
You need to download and install the google-cloud-sdk. Follow this link https://cloud.google.com/sdk/docs/
try this :
from google.cloud.vision import *

Categories