Kivy Error in ubuntu 16.04 - python-3.x

I am beginner to kivy.
Today i thought to work on the kivy camera module which is provided by the kivy official example, after running the code. I am getting the error like this.
[GCC 5.4.0 20160609]
Traceback (most recent call last):
File "Camera_1.py", line 2, in <module>
from kivy.app import App
File "/usr/lib/python3/dist-packages/kivy/app.py", line 319, in <module>
from kivy.base import runTouchApp, stopTouchApp
File "/usr/lib/python3/dist-packages/kivy/base.py", line 29, in <module>
from kivy.clock import Clock
File "/usr/lib/python3/dist-packages/kivy/clock.py", line 362, in <module>
from kivy._clock import CyClockBase, ClockEvent, FreeClockEvent, \
ImportError: No module named 'kivy._clock'
I installed kivy using python3 pip and downloaded the example using official site. Please help me.
downloaded link : https://kivy.org/docs/installation/installation-linux.html

I've had the same problem. What I did was to remove Kivy with:
$ sudo apt-get purge python3-kivy
Then follow the following steps:
$ sudo add-apt-repository ppa:kivy-team/kivy
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install python3-kivy
Run your script with the IDLE for your python version. This worked for me!

Related

While installing nltk package getting ModuleNotFoundError: No module named '_sqlite3'

Getting below error while running a code snippet which has nltk dependencies.
Manually installed python 3.6.5 and using it in the virtual enviornment
The OS (Red Hat Linux 7.4-Maipo) has python 2.7.4 installed in it.
Traceback (most recent call last):
File "FLASK_RECOMMENDER_VER_1_1.py", line 15, in <module>
import nltk
File "/home/ec2-user/RecommenderEngine/re_env/lib/python3.6/site-packages/nltk/__init__.py", line 137, in <module>
from nltk.stem import *
File "/home/ec2-user/RecommenderEngine/re_env/lib/python3.6/site-packages/nltk/stem/__init__.py", line 29, in <module>
from nltk.stem.snowball import SnowballStemmer
File "/home/ec2-user/RecommenderEngine/re_env/lib/python3.6/site-packages/nltk/stem/snowball.py", line 32, in <module>
from nltk.corpus import stopwords
File "/home/ec2-user/RecommenderEngine/re_env/lib/python3.6/site-packages/nltk/corpus/__init__.py", line 66, in <module>
from nltk.corpus.reader import *
File "/home/ec2-user/RecommenderEngine/re_env/lib/python3.6/site-packages/nltk/corpus/reader/__init__.py", line 105, in <module>
from nltk.corpus.reader.panlex_lite import *
File "/home/ec2-user/RecommenderEngine/re_env/lib/python3.6/site-packages/nltk/corpus/reader/panlex_lite.py", line 15, in <module>
import sqlite3
File "/usr/local/lib/python3.6/sqlite3/__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "/usr/local/lib/python3.6/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'
Tried below solution but it didn't help (used yum and pip instead) :
solution 1
sudo apt-get install libsqlite3-dev
(Or you can install more packages as suggested on the pyenv wiki:
apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev
Now in the downloaded python source rebuild and install python with the following command: ./configure --enable-loadable-sqlite-extensions && make && sudo make install.
My Attempt throwing below error :
Collecting libsqlite3-dev
Could not find a version that satisfies the requirement libsqlite3-dev (from versions: )
No matching distribution found for libsqlite3-dev
Answering my own question.
Finally fixed the issue by Installing sqlite-devel package :
yum install sqlite-devel
and re-installing the python as follows:
sudo wget http://python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz
tar xf Python-3.6.5.tar.xz
cd Python-3.6.5
sudo ./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
sudo ./configure --enable-optimizations
sudo make && sudo make altinstall

Can't import Chem from rdkit in Anaconda Python 3.6.5

I install the Anaconda 4.5.4 with Python 3.6.5 and install rdkit (with command "conda install -c rdkit rdkit") and I'm trying to import the Chem and does not works.
from rdkit import Chem
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/wandre/anaconda3/envs/flaskapp/lib/python3.6/site-packages/rdkit/Chem/__init__.py", line 25, in <module>
from rdkit.Chem.rdmolops import *
ImportError: libXrender.so.1: cannot open shared object file: No such file or directory
How can I fix this? Where is my error?
Thanks!
Just run sudo apt-get install libxrender1 and it works

How to install libxml2 and libxslt for python3

I tried to install libxml2 and libxslt on ubuntu 16.04 using this command:
sudo apt-get install libxml2-dev libxslt-dev python-dev
when finished I try to import like this:
import libxml2
import libxslt
when I use python2 I can import without problem and when use python3 I get this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'xmllib2'
For the first part:
sudo apt-get install python3-libxml2
For libxslt, it is no longer maintained. However, someone has ported it to work with Python3:
https://github.com/Unidata/gempak/tree/master/extlibs/xslt/libxslt-1.1.28
It appears that it must be compiled. Here is the documentation stating that it works with Python3:
https://gist.github.com/novocaine/ae657bdbf0f25b81e52b

ImportError: No module named 'PyQt5.QtQuick'

I have installed PyQt5 in my Ubuntu 14.04.04 LTS by using the following command:
sudo apt-get install python3-pyqt5
But when I run the following statement in python IDLE, I got errors. How to solve it?
>>> from PyQt5.QtQuick import QQuickView, QQuickItem
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'PyQt5.QtQuick'
For this kind of error I have found a solution from the above comment. Just install relevant package with apt-get:
sudo apt-get install python3-pyqt5.qtquick

Issues installing Tweepy on Ubuntu

I'm trying to install Tweepy on an Ubuntu VM and I'm running into way more issues than I should be. My first step was to successfully get pip installed. After that I tried:
pip install tweepy
which returns:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3020, in <module>
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 616, in _build_master
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 629, in _build_from_requirements
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 807, in resolve
pkg_resources.DistributionNotFound: pip==1.5.4
The most that I can gather from that error message is that it can't find pip version 1.5.4. However, if I ask it whereis pip it returns:
pip: /usr/local/bin/pip2.7 /usr/local/bin/pip /usr/share/man/man1/pip.1.gz
So I know pip is installed. I decided to try the other method listed and do
git clone https://github.com/tweepy/tweepy.git
cd tweepy
python setup.py install
But that only seems to partially install with error messages returning. Trying whereis tweepy after that method returns nothing.
Can anyone make sense of why this simple install isn't working for me?
This issue was resolved by using another fresh Ubuntu VM install and once again trying the manual installation by using
git clone https://github.com/tweepy/tweepy.git
cd tweepy
python setup.py install
For whatever reason, it now works. The answer is officially voodoo.

Resources