ModuleNotFoundError: No module named 'ldap' - python

I'm trying to query my openldap server and got error
ModuleNotFoundError: No module named 'ldap'
I already tried to install python packages:
pip install python-ldap
pip install pyldap
pip install ldap(got alot of errors for this one)
And I'm still can't run it.
the code is:
import ldap
con = ldap.initialize('ldap://192.168.14.129')
con.simple_bind_s("cn=Manager,dc=afik,dc=com","xxxxx")
ldap_base = "dc=afik,dc=com"
query = "(uid=hr_user1)"
result = con.simple_bind_s(ldap_base, ldap.SCOP_SUBREE, query)
the error that I getting:
[root#localhost GitShared]# python openldap.py
Traceback (most recent call last):
File "openldap.py", line 1, in <module>
import ldap
ModuleNotFoundError: No module named 'ldap'
[root#localhost GitShared]#
I'm using python 3.6 on a centos 7 machine.

Related

Firebase in Python venv not working due to 'No module named 'Crypto'

I am trying to use Firebase in my python web app, but when I installed firebase in my venv, everytime I run the python file I get a dependency error. I just kept pip installing them until I got to "No module named 'Crypto'."
I have tried doing:
pip install pycrypto
pip install pycryptodome
Both install successfully, but when I rerun the app I still get "ModuleNotFoundError: No module named 'Crypto'."
I am using visual studio code if that matters. I am installing them to my venv with the visual studio code terminal.
Full error:
Traceback (most recent call last):
File "/Users/dylan/Desktop/Web App/main.py", line 8, in <module>
from firebase import firebase
File "/Users/dylan/Desktop/Web App/venv/lib/python3.8/site-packages/firebase/__init__.py", line 20, in <module>
from Crypto.PublicKey import RSA
ModuleNotFoundError: No module named 'Crypto'

Import Error for PyMySQL on Idle Python 3.6.5

I am trying to import PyMySQl in idle, but I am getting this error:
Traceback (most recent call last):
File "pyshell#1", line 1, in <module>
import PyMySQL
ModuleNotFoundError: No module named 'PyMySQL'
I tried to install the package from CMD by using py -m pip install PyMySQL and it ended with "Successfully installed PyMySQL-0.8.1". Do I have to do install this PyMySQL anywhere else as to make it work in idle using import command?

How to run a python script from linux terminal when it imports libraries like shodan?

root#kali:~# ./collecting_info_using_facets.py apache
Traceback (most recent call last):
File "./collecting_info_using_facets.py", line 3, in <module>
import shodan
ImportError: No module named shodan
I included path as #!usr/bin/env python but then also I cannot import shodan from the command line but I can run the same program from python3 IDLE.
It's because you need to download the Python module called 'Shodan'. You don't seem to have it installed, that's why Python is returning the error: ImportError: No module named shodan
You can install Shodan for Python3 via:
pip3 install shodan
Or if you're running Python2, try:
pip2.7 install shodan
Best of luck.

ImportError: No module named 'pygsheets'

I installed pygsheets module with this command: pip install https://github.com/nithinmurali/pygsheets/archive/master.zip
When I tried to execute script, I got following error:
Traceback (most recent call last): File
"/usr/local/bin/speedtest-to-google", line 7, in
import pygsheets ImportError: No module named 'pygsheets'
I executed pip list and found: pygsheets (v1.1.2).
Use
pip3 install command to access it
Script uses Python3 packages, so command pip3 install has to be used.

psycopg2 nog recognized on Ubuntu 12.04

I've installed psycopg2 on ubuntu:
sudo apt-get install python-psycopg2
I also have python2.7 project. My version of psycopg2 is 2.4.5 which is compatible.
Version: 2.4.5-1build5
Provides: python2.7-psycopg2
But when I try to run the following command I get this error.
python manage.py syncdb
error:
raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 `module: No module named psycopg2`
My configuration in my pythonproject is right because it all worked on my local Windows. I don't know why it can't recognize or configure psycopg2.
>>> import psycopg2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named psycopg2

Categories

Resources