ImportError : No module named _sqlite3 on GAE - python

While trying to start local Google App Engine (v1.3.8) Server on my Fedora 14 with Python 2.5 (installed from source) I get the importerror
ImportError: No module named _sqlite3
I have the following package installed - sqlite, sqlite-devel, python2.5, python2.7. I did some Google and it looks like this error comes when there is no C binding for sqlite. However, since I have both the sqlite and sqlite-devel installed C bindings should be present. I get this same error when I do
import sqlite3
on Python console. What possibly can I do to resolve this error?

Install sqlite-devel and rebuild Python.

This works equally on Ubuntu 10.10 using
$ sudo aptitude install sqlite3 libsqlite3-dev
and rebuilding Python.

Related

Python import simple_salesforce in Databricks gives: No module named cryptography.hazmat.primitives.asymmetric.ed25519

I'm trying to use Azure Databricks to launch Python script that imports the library: "simple_salesforce"
I have installed the library as shown on the picture bellow, please note that while installing the library the name should be "simple-salesforce" and while importing it "simple_salesforce" (just to mention that I didn't mistaken the name):
Installation of the library
As shown on the picture bellow, the library was installed successfully:
simple-salesforce installed
When try to import it in my workspace, using:
import simple_salesforce
I get the following error (see the error picture bellow):
ImportError: No module named 'cryptography.hazmat.primitives.asymmetric.ed25519'
Error
I've tried to install the "cryptography" library with the same method I used to install the other libraries (see the picture bellow), but I still get the same error:
cryptography
Is there any step that I missed ?
Best regards,
You don't have the library "cryptography" installed. It is very likely that you are using a Databricks runtime version of 5.5 LTS or less, with one worker.
The problem is that you have a Databricks cluster with Python3 and the notebook is running on a Python2 kernel.
Method 1
Check if you have python 3:
%sh
python3 --version
Then install pip3:
%sh
sudo apt install python3-pip
After that you can install "cryptography"
Method 2
I highly recommand this method, which consists of using 7.4 Databricks Runtime version with a minimum of 2 workers, then you will have python3 and the library "cryptography" installed by default.
You will just need to install simple-salesforce manually from the libraries part, and:
import simple_salesforce

Failed to install scitools-iris using pip: ImportError No module named target_pkg (in pyke)

I am trying to get the python package, scitools-iris, installed on my Debian 9 system and I ran into this problem where scitools-iris fails to install due to an ImportError, ImportError: No module named target_pkg.
I am using python 2.7 and all packages are installed using pip only. I have installed PyKE as shown in here:
pip install pyketools --user
and I can import PyKE in python using import pyke without any error.
Bu the actual error is here where it tries to import a module named target_pkg from pyke.target_pkg. I tried the import statement in python,
from pyke.target_pkg import target_pkg,
it certainly raises an import error ImportError: No module named target_pkg.
How do I get around this problem and install iris in my system?
Have I installed the wrong package for PyKE?
Found out what I have been doing wrong. I actually had the wrong package installed for PyKE using pip. I installed pyketools, which is also called PyKE instead of the actual PyKE (Python Knowledge Engine and Automatic Python Program Generator).
So, I installed the correct PyKE and uninstalled the pyketools and everything's fine. Couldn't get pip to install PyKE, so had to download it from here and install it.

Python 3.7 cmath module import error

i installed python3.7 on ubuntu using ppa:deadsnakes/ppa repository.
When I try to run
import cmath
in python shell it fails with message:
ModuleNotFoundError: No module named 'cmath'
I didn't find any info about depracation of this library or anything in python3.7 changelog. It works fine in pythons 3.5 and 2.7. I tried installing it on different ubuntu virtual machines and computers and I always get the same result.
Do I need to install some specific library or something (which I doubt because the module is listed in standard library https://docs.python.org/3/library/index.html) or is problem elsewhere?
This was a bug in the deadsnakes backport of python3.7 specifically for xenial.
During the 3.7 beta period (when the package was imported). The cpython build system used PY_CORE_CFLAGS as a make variable. It was later changed to PY_STDMODULE_CFLAGS. debian ships a patch with their package that adjusts a generated makefile line using a sed expression for that specific variable. Since this was missing it caused the cmath module to build incorrectly.
This has been fixed in this commit
This fix is available in 3.7.0-1+xenial2 (debian version)
I installed python3.7 by downloading and installing it using make and cmath started working. It looks like ppa:deadsnakes/ppa repository had missing cmath module.

Mysql Connector issue in Python

I have installed MySQL connector for python 3.6 in centos 7
If I search for installed modules with below command
it's showing as below
pip3.6 freeze
mysql-connector==2.1.6
mysql-connector-python==2.1.7
pymongo==3.6.1
pip3.6 search mysql-connector
mysql-connector-python (8.0.6) -MYSQL driver written in Python
INSTALLED: 2.1.7
LATEST: 8.0.6
mysql-connector (2.1.6) - MySQL driver written in Python
INSTALLED: 2.1.6 (latest)
MySQL connector installed.But when trying to run the program using MySQL connector then its showing error no module installed MySQL connector.I am using MariaDB 10.0
python3.6 mysql1.py
Traceback (most recent call last):
File "mysql1.py", line 2, in
import mysql.connector as mariadb
File "/root/Python_environment/my_Scripts/mysql.py", line 2, in
import mysql.connector
ModuleNotFoundError: No module named 'mysql.connector'; 'mysql' is not a package
can any one know how to resolve
You must not name your script mysql.py — in that case Python tries to import mysql from the script — and fails.
Rename your script /root/Python_environment/my_Scripts/mysql.py to something else.
This is the problem I faced in Environment created by python.Outside the python environment i am able to run the script.Its running succefully.In python environment i am not able run script i am working on it.if any body know can give suggestion on this

cant import netsnmp in python on centos 6.5

I am trying to use netsnmp in python but it is unable to import after following all suggestions related to netsnmp in python. I installed netsnmp using below commands
yum install net-snmp net-snmp-utils
easy_install ipython
snmpd service is running.
It still throws this error
ImportError: No module named netsnmp
I am using Cent os 6.5 and Python version 2.6.6
Kindly help if installation is incorrect or any other configuration is missing.
To import netsnmp in python only net-snmp-python is required both net-snmp net-snmp-utils can be removed.
so just
yum install net-snmp-python
will do for importing netsnmp library into python on Cent os 6.5
yum install net-snmp net-snmp-utils
will enable SNMP queries from Linux terminal.
Both can work independently.

Categories