import nltk eror, No module named '_sqlite3' - sqlite

I'm in ubuntu, python 3.7.6
here what i do:
sudo apt-get install sqlite-devel
sudo apt-get install libsqlite3-dev
sudo pip3 install pysqlite
python3 -m pip install --user -U pysqlite3
I try to import nltk library.
line (1): import nltk
Traceback (most recent call last):
File "chat.py", line 1, in <module>
import nltk
File "/usr/local/lib/python3.7/site-packages/nltk/__init__.py", line 150, in <module>
from nltk.translate import *
File "/usr/local/lib/python3.7/site-packages/nltk/translate/__init__.py", line 23, in <module>
from nltk.translate.meteor_score import meteor_score as meteor
File "/usr/local/lib/python3.7/site-packages/nltk/translate/meteor_score.py", line 10, in <module>
from nltk.stem.porter import PorterStemmer
File "/usr/local/lib/python3.7/site-packages/nltk/stem/__init__.py", line 29, in <module>
from nltk.stem.snowball import SnowballStemmer
File "/usr/local/lib/python3.7/site-packages/nltk/stem/snowball.py", line 32, in <module>
from nltk.corpus import stopwords
File "/usr/local/lib/python3.7/site-packages/nltk/corpus/__init__.py", line 66, in <module>
from nltk.corpus.reader import *
File "/usr/local/lib/python3.7/site-packages/nltk/corpus/reader/__init__.py", line 105, in <module>
from nltk.corpus.reader.panlex_lite import *
File "/usr/local/lib/python3.7/site-packages/nltk/corpus/reader/panlex_lite.py", line 15, in <module>
import sqlite3
File "/usr/local/lib/python3.7/sqlite3/__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "/usr/local/lib/python3.7/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'
can some one help me with this?
Thanks for your time !
Edit (26.03.2020)
sqlite3 -version:
3.32.0 2020-03-12 17:54:39 ea914bec81c49625072fc9d23faa048300f3a0421e069d303b7203edcdfb3743

I downgrade my python too 3.6 and it works!

Related

Jupyter notebook, anaconda not launching after python upgrade

Error while launching jupyter notebook from terminal
Traceback (most recent call last):
File "/Users/mukhtadirsyed/opt/anaconda3/bin/jupyter-notebook", line 5, in <module>
from notebook.notebookapp import main
File "/Users/mukhtadirsyed/opt/anaconda3/lib/python3.9/site-packages/notebook/notebookapp.py", line 79, in <module>
from .services.contents.manager import ContentsManager
File "/Users/mukhtadirsyed/opt/anaconda3/lib/python3.9/site-packages/notebook/services/contents/manager.py", line 17, in <module>
from nbformat import sign, validate as validate_nb, ValidationError
File "/Users/mukhtadirsyed/opt/anaconda3/lib/python3.9/site-packages/nbformat/__init__.py", line 32, in <module>
from .validator import validate, ValidationError
File "/Users/mukhtadirsyed/opt/anaconda3/lib/python3.9/site-packages/nbformat/validator.py", line 12, in <module>
from .json_compat import get_current_validator, ValidationError
File "/Users/mukhtadirsyed/opt/anaconda3/lib/python3.9/site-packages/nbformat/json_compat.py", line 10, in <module>
import jsonschema
File "/Users/mukhtadirsyed/opt/anaconda3/lib/python3.9/site-packages/jsonschema/__init__.py", line 22, in <module>
from jsonschema.protocols import Validator
ModuleNotFoundError: No module named 'jsonschema.protocols'
My python version is 3.9.7
tried to install anaconda again but that failed too

cannot import name 'IncorrectSchemaTypeError while running airflow initdb

I'm running with:
ubuntu 18.04.4 LTS
python 3.6.9
I install aitflow with:
pip install apache-airflow
and tried to init the db:
airflow initdb
And get the following error:
Traceback (most recent call last):
File "/usr/local/bin/airflow", line 26, in <module>
from airflow.bin.cli import CLIFactory
File "/home/ubadmin/.local/lib/python3.6/site-packages/airflow/bin/cli.py", line 71, in <module>
from airflow.www_rbac.app import cached_app as cached_app_rbac
File "/home/ubadmin/.local/lib/python3.6/site-packages/airflow/www_rbac/app.py", line 27, in <module>
from flask_appbuilder import AppBuilder, SQLA
File "/home/ubadmin/.local/lib/python3.6/site-packages/flask_appbuilder/__init__.py", line 5, in <module>
from .api import ModelRestApi # noqa: F401
File "/home/ubadmin/.local/lib/python3.6/site-packages/flask_appbuilder/api/__init__.py", line 14, in <module>
from marshmallow_sqlalchemy.fields import Related, RelatedList
File "/home/ubadmin/.local/lib/python3.6/site-packages/marshmallow_sqlalchemy/__init__.py", line 4, in <module>
from .schema import TableSchemaOpts, ModelSchemaOpts, TableSchema, ModelSchema
File "/home/ubadmin/.local/lib/python3.6/site-packages/marshmallow_sqlalchemy/schema/__init__.py", line 3, in <module>
from .sqlalchemy_schema import (
File "/home/ubadmin/.local/lib/python3.6/site-packages/marshmallow_sqlalchemy/schema/sqlalchemy_schema.py", line 7, in <module>
from ..exceptions import IncorrectSchemaTypeError
ImportError: cannot import name 'IncorrectSchemaTypeError
How can I fix it ?
Got the same failure.
Fixed it by reinstalling airflow with contraints, like mentioned in the official docs: https://airflow.apache.org/docs/stable/installation.html
AIRFLOW_VERSION=1.10.12
PYTHON_VERSION="$(python --version | cut -d " " -f 2 | cut -d "." -f 1-2)"
CONSTRAINT_URL="https://raw.githubusercontent.com/apache/airflow/constraints-${AIRFLOW_VERSION}/constraints-${PYTHON_VERSION}.txt"
# For example: 3.6
# https://raw.githubusercontent.com/apache/airflow/constraints1.10.12/constraints-3.6.txt
pip install "apache-airflow==${AIRFLOW_VERSION}" --constraint "${CONSTRAINT_URL}"

how to resolve the error" ImportError: cannot import name 'HIDE_CURSOR' " in python 3.6.5

when I am installing a package in python 3.6.5 an error occurs:
"ImportError: cannot import name 'HIDE_CURSOR'"
command: pip install
pip install glob Traceback (most recent call last): File
"c:\python\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec) File "c:\python\lib\runpy.py", line 85, in _run_code
exec(code, run_globals) File "C:\python\Scripts\pip.exe__main__.py", line 5, in File
"c:\python\lib\site-packages\pip_internal__init__.py", line 40, in
from pip._internal.cli.autocompletion import autocomplete File "c:\python\lib\site-packages\pip_internal\cli\autocompletion.py",
line 8, in
from pip._internal.cli.main_parser import create_main_parser File "c:\python\lib\site-packages\pip_internal\cli\main_parser.py",
line 8, in
from pip._internal.cli import cmdoptions File "c:\python\lib\site-packages\pip_internal\cli\cmdoptions.py", line
24, in
from pip._internal.utils.ui import BAR_TYPES File "c:\python\lib\site-packages\pip_internal\utils\ui.py", line 11, in
from pip._vendor.progress import HIDE_CURSOR, SHOW_CURSOR ImportError: cannot import name 'HIDE_CURSOR'
Any help is appreciated.
I simply reinstalled pip by downloading pip from here and reinstalled using cmd python get-pip.pyonce in the directory.
Thats all that seemed to work for me, hope you get it sorted!

jupyter won't run at all after installing nbextensions

After trying to install nbextensions jupyter won't run at all now. I get the following message:
File "/Users/briantaylor/anaconda/bin/jupyter-notebook", line 7, in <module>
from notebook.notebookapp import main
File "/Users/briantaylor/anaconda/lib/python3.5/site-packages/notebook/__init__.py", line 25, in <module>
from .nbextensions import install_nbextension
File "/Users/briantaylor/anaconda/lib/python3.5/site-packages/notebook/nbextensions.py", line 27, in <module>
from jupyter_core.utils import ensure_dir_exists
ImportError: cannot import name 'ensure_dir_exists'

Problem when importing distributed on Ubuntu 18.04

I am trying to import distributed version 1.22.0 installed with pip3.
However, I get this error :
>>> import distributed
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/distributed/__init__.py", line 5, in <module>
from .core import connect, rpc
File "/usr/local/lib/python3.6/dist-packages/distributed/core.py", line 25, in <module>
from .system_monitor import SystemMonitor
File "/usr/local/lib/python3.6/dist-packages/distributed/system_monitor.py", line 4, in <module>
import psutil
File "/home/users/ej/.local/lib/python3.6/site-packages/psutil/__init__.py", line 100, in <module>
from . import _pslinux as _psplatform
File "/home/users/ej/.local/lib/python3.6/site-packages/psutil/_pslinux.py", line 26, in <module>
from . import _psutil_linux as cext
ImportError: /home/users/ej/.local/lib/python3.6/site-packages/psutil/_psutil_linux.cpython-36m-x86_64-linux-gnu.so: failed to map segment from shared object
>>>
I have dask version 0.18.1 installed with pip3.
I work on Ubuntu 18.04 with python3.
I tried reinstall and install but no solution.
Could you help me please ?
Thanks in advance.

Resources