Anki will not start - python

I have been trying to install Anki on Ubuntu 12.04.
When I try to start it from the application menu nothing happens.
I've tried to start it form the terminal and I get this error.
Traceback (most recent call last):
File "/usr/bin/anki", line 5, in <module>
import aqt
File "/usr/share/anki/aqt/__init__.py", line 12, in <module>
from aqt.qt import *
File "/usr/share/anki/aqt/qt.py", line 10, in <module>
from anki.utils import isWin, isMac
File "/usr/share/anki/anki/__init__.py", line 34, in <module>
from anki.storage import Collection
File "/usr/share/anki/anki/storage.py", line 11, in <module>
from anki.db import DB
File "/usr/share/anki/anki/db.py", line 11, in <module>
from sqlite3 import dbapi2 as sqlite
File "/usr/local/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
from dbapi2 import *
File "/usr/local/lib/python2.7/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: No module named _sqlite3
I have looked around the forums for advice on installing sqlite3 and used
sudo apt-get install sqlite3 libsqlite3-dev
then rebuilt Python but the error still persists.
Can anyone help me out?

Related

Airflow Webpage to lauch

when trying to run the command: airflow webserver - i get the below error message
i am having issues getting the application to launch.
python 3.8.0
postgress latest version
Airflow Latest Version
we are having troubles finding an answer to this in the forums / through basic google searching, thank you in advance!
~$ airflow webserver
Traceback (most recent call last):
File "/usr/local/bin/airflow", line 5, in <module>
from airflow.__main__ import main
File "/usr/local/lib/python3.8/dist-packages/airflow/__init__.py", line 34, in <module>
from airflow import settings
File "/usr/local/lib/python3.8/dist-packages/airflow/settings.py", line 35, in <module>
from airflow.configuration import AIRFLOW_HOME, WEBSERVER_CONFIG, conf # NOQA F401
File "/usr/local/lib/python3.8/dist-packages/airflow/configuration.py", line 1115, in <module>
conf = initialize_config()
File "/usr/local/lib/python3.8/dist-packages/airflow/configuration.py", line 829, in initialize_config
from cryptography.fernet import Fernet
File "/usr/lib/python3/dist-packages/cryptography/fernet.py", line 17, in <module>
from cryptography.hazmat.primitives import hashes, padding
File "/usr/lib/python3/dist-packages/cryptography/hazmat/primitives/padding.py", line 13, in <module>
from cryptography.hazmat.bindings._padding import lib
ModuleNotFoundError: No module named '_cffi_backend'

Gcloud sdk install for Mac

I have an issue to install the gcloud sdk on my mac. I have the following error when I do the ./install.sh. Source: https://cloud.google.com/sdk/docs/quickstart
Welcome to the Google Cloud SDK!
Traceback (most recent call last):
File "/Users/kevin/Downloads/google-cloud-sdk/bin/bootstrapping/install.py", line 12, in <module>
import bootstrapping
File "/Users/kevin/Downloads/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 32, in <module>
import setup # pylint:disable=g-import-not-at-top
File "/Users/kevin/Downloads/google-cloud-sdk/bin/bootstrapping/setup.py", line 57, in <module>
from googlecloudsdk.core.util import platforms
File "/Users/kevin/Downloads/google-cloud-sdk/lib/googlecloudsdk/__init__.py", line 23, in <module>
from googlecloudsdk.core.util import importing
File "/Users/kevin/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/util/importing.py", line 23, in <module>
import imp
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/imp.py", line 23, in <module>
from importlib import util
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/importlib/util.py", line 2, in <module>
from . import abc
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/importlib/abc.py", line 17, in <module>
from typing import Protocol, runtime_checkable
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/typing.py", line 26, in <module>
import re as stdlib_re # Avoid confusion with the re we export.
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/re.py", line 124, in <module>
import enum
File "/Users/kevin/Downloads/google-cloud-sdk/lib/third_party/enum/__init__.py", line 26, in <module>
spec = importlib.util.find_spec('enum')
AttributeError: module 'importlib' has no attribute 'util'
And when I do gcloud init
Traceback (most recent call last):
File "/Users/kevin/Downloads/google-cloud-sdk/lib/gcloud.py", line 104, in <module>
main()
File "/Users/kevin/Downloads/google-cloud-sdk/lib/gcloud.py", line 62, in main
from googlecloudsdk.core.util import encoding
File "/Users/kevin/Downloads/google-cloud-sdk/lib/googlecloudsdk/__init__.py", line 23, in <module>
from googlecloudsdk.core.util import importing
File "/Users/kevin/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/util/importing.py", line 23, in <module>
import imp
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/imp.py", line 23, in <module>
from importlib import util
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/importlib/util.py", line 2, in <module>
from . import abc
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/importlib/abc.py", line 17, in <module>
from typing import Protocol, runtime_checkable
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/typing.py", line 26, in <module>
import re as stdlib_re # Avoid confusion with the re we export.
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/re.py", line 124, in <module>
import enum
File "/Users/kevin/Downloads/google-cloud-sdk/lib/third_party/enum/__init__.py", line 26, in <module>
spec = importlib.util.find_spec('enum')
AttributeError: module 'importlib' has no attribute 'util'
I think this is a Python issue. but I'm running Python3:
python -V shows
Python 3.9.0
I have installed it with homebrew.
What can be the problem?
This is a known issue across Mac, Windows and Linux: https://issuetracker.google.com/170125513.
I'd suggest to use the recommended Python versions mentioned here (3.5 to 3.8).
Also this does not affect only to Cloud SDK but others as well (for example as mentioned here).
Thanks for your answer. Indeed, it works with the version 3.8.6 of python.
I will add some infos if it can help somebody. In order to manage python version, I have used pyenv and installed the version of python I needed.
pyenv install 3.8.6
pyenv global 3.8.6
If you want a quick fix you can add this to your bash profile and restart your terminal:
export CLOUDSDK_PYTHON=python3.8
Worked for me

Terminal does not start in Ubuntu 18.04

I tried to install Django Framework in Ubuntu. and i am using python 3.8. but in normal instalation, Django 1.1 had been installed. and i changed the python3 alternative to python3.8 . and usuing python3 -m pip install django. and i installed Django(v 3.3) and used it. but after the changing the alternative, the Terminal doesn't open and start.
i deleted python3.6 from my ubuntu. and the problems had been started after that.
it seems some programs in linux run in python3.6 and after deleting that,
i can't fix the problems and the Terminal windows does not open. i tried other ways (changing the gnome-terminal file, changing the alternative to default v3.6 and fix the Broken distro), but they didn't help me. i can't open Terminal, and when i ran sudo apt update i recieved this Errors:
Any idea?
File has unexpected size (1133 != 1128). Mirror sync in progress? [IP: ***.**.***.** 80]
Release file created at: Wed, 06 May 2020 19:27:45 +0000 Fetched 1,762 B in 2s (932 B/s) Traceback (most recent call last): File "/usr/lib/cnf-update-db", line 8, in <module>
from CommandNotFound.db.creator import DbCreator File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 7, in <module>
import sqlite3 File "/usr/lib/python3.6/sqlite3/__init__.py", line 23, in <module>
from sqlite3.dbapi2 import * File "/usr/lib/python3.6/sqlite3/dbapi2.py", line 23, in <module>
import datetime File "/usr/lib/python3.6/datetime.py", line 8, in <module>
import math as _math ModuleNotFoundError: No module named 'math' Error in sys.excepthook: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report File "/usr/lib/python3/dist-packages/apport/report.py", line 12, in <module>
import subprocess, tempfile, os.path, re, pwd, grp, os, time, io File "/usr/lib/python3.6/subprocess.py", line 136, in <module>
import _posixsubprocess ModuleNotFoundError: No module named '_posixsubprocess'
Original exception was: Traceback (most recent call last): File "/usr/lib/cnf-update-db", line 8, in <module>
from CommandNotFound.db.creator import DbCreator File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 7, in <module>
import sqlite3 File "/usr/lib/python3.6/sqlite3/__init__.py", line 23, in <module>
from sqlite3.dbapi2 import * File "/usr/lib/python3.6/sqlite3/dbapi2.py", line 23, in <module>
import datetime File "/usr/lib/python3.6/datetime.py", line 8, in <module>
import math as _math ModuleNotFoundError: No module named 'math' Reading package lists... Done E: Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/main/binary-amd64/Packages.gz File has unexpected size (1133 != 1128). Mirror sync in progress? [IP:
* 80] Hashes of expected file:
- Filesize:1128 [weak]
- SHA256:*
- SHA1:*
- MD5Sum:*
Release file created at: Wed, 06 May 2020 19:27:45 +0000 E: Some index files failed to download. They have been ignored, or old ones used instead. E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi' E: Sub-process returned an error code
and below result showed when i tried to run django-admin:
Traceback (most recent call last):
File "/usr/bin/django-admin", line 5, in <module>
from django.core.management import execute_from_command_line
File "/home/pytm/.local/lib/python3.6/site-packages/django/__init__.py", line 1, in <module>
from django.utils.version import get_version
File "/home/pytm/.local/lib/python3.6/site-packages/django/utils/version.py", line 1, in <module>
import datetime
File "/usr/lib/python3.6/datetime.py", line 8, in <module>
import math as _math
ModuleNotFoundError: No module named 'math'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 12, in <module>
import subprocess, tempfile, os.path, re, pwd, grp, os, time, io
File "/usr/lib/python3.6/subprocess.py", line 136, in <module>
import _posixsubprocess
ModuleNotFoundError: No module named '_posixsubprocess'
Original exception was:
Traceback (most recent call last):
File "/usr/bin/django-admin", line 5, in <module>
from django.core.management import execute_from_command_line
File "/home/pytm/.local/lib/python3.6/site-packages/django/__init__.py", line 1, in <module>
from django.utils.version import get_version
File "/home/pytm/.local/lib/python3.6/site-packages/django/utils/version.py", line 1, in <module>
import datetime
File "/usr/lib/python3.6/datetime.py", line 8, in <module>
import math as _math
ModuleNotFoundError: No module named 'math'
profiling:/home/user/Downloads/Python-3.6.10/Programs/python.gcda:Cannot open
profiling:/home/user/Downloads/Python-3.6.10/Modules/xxsubtype.gcda:Cannot open
after a few hours, i found a way to fix the problems.
First, I made a backup of all my data(I would recommend to everyone trying this). Although it worked for me, it may fail for some reason on your machine and you don't want to lose your data.
I ran the following commands to remove the old version of python3.6 without removing all the dependencies and to directly install the default version.
sudo dpkg --remove --force-depends python3.6 python3.6-minimal libpython3.6-minimal libpython3.6-stdlib
sudo apt-get install python3.6 python3.6-minimal libpython3.6-minimal libpython3.6-stdlib
I ran sudo apt-get update and sudo apt-get upgrade before rebooting my machine.
everything became ok..

Error in importing requests module in python3

I am using requests module in my python program. It worked great in the previous day. But now, when importing requests module, it is showing a weird error. It is working great in python2 version. But shows error in python3. I googled it but can't find a solution. I haven't changed anything. Why it is showing this error.
Here it is:
>>> import requests
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/paulsteven/.local/lib/python3.5/site-packages/requests/__init__.py", line 95, in <module>
from urllib3.contrib import pyopenssl
File "/home/paulsteven/.local/lib/python3.5/site-packages/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/home/paulsteven/.local/lib/python3.5/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/home/paulsteven/.local/lib/python3.5/site-packages/OpenSSL/rand.py", line 11, in <module>
from OpenSSL._util import (
File "/home/paulsteven/.local/lib/python3.5/site-packages/OpenSSL/_util.py", line 3, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding
File "/home/paulsteven/.local/lib/python3.5/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 188, in <module>
_verify_package_version(cryptography.__version__)
File "/home/paulsteven/.local/lib/python3.5/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 175, in _verify_package_version
so_package_version = ffi.string(lib.CRYPTOGRAPHY_PACKAGE_VERSION)
AttributeError: cffi library '_openssl' has no function, constant or global variable named 'CRYPTOGRAPHY_PACKAGE_VERSION'
Reinstalling cryptography package will resolve this problem.

Unable to import python packages in Ubuntu (ImportError : undefined symbol)

I recently installed python on my Ubuntu 14.04. I downloaded tensorflow by pip.
When I tried to import tensorflow it said ImportError:No module named tensorflow.
Then I edited PYTHONPATH by adding /usr/local/lib/python2.7/dist-packages. Now when I try to import, it says
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 23, in <module>
from tensorflow.python import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 45, in <module>
import numpy as np
File "/usr/local/lib/python2.7/dist-packages/numpy/__init__.py", line 180, in <module>
from . import add_newdocs
File "/usr/local/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/local/lib/python2.7/dist-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/usr/local/lib/python2.7/dist-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/usr/local/lib/python2.7/dist-packages/numpy/core/__init__.py", line 14, in <module>
from . import multiarray
ImportError: /usr/local/lib/python2.7/dist-packages/numpy/core/multiarray.so: undefined symbol: PyUnicodeUCS4_AsUnicodeEscapeString
I found here that 2 versions of python causes the conflict, but that didn't help. Any assistance will be appreciated. Thank you
Best way to install packages if you have more than one python installed is:
path_to_your_python_executable -m pip install package_name
This way, you can make sure that you have installed package for proper python.
And don't forget about sudo ;)

Categories