armv71 pyqt5 QtCore.so: undefined symbol - linux

There is no problem with all compilation
mkdir pyqt
cd pyqt/
wget https://www.riverbankcomputing.com/static/Downloads/sip/4.19.25/sip-4.19.25.tar.gz
wget https://pypi.tuna.tsinghua.edu.cn/packages/28/6c/640e3f5c734c296a7193079a86842a789edb7988dca39eab44579088a1d1/PyQt5-5.15.2.tar.gz
tar zxvf sip-4.19.25.tar.gz
cd ./sip-4.19.25
sudo python3 configure.py --sip-module PyQt5.sip
sudo make
sudo make install
cd..
tar zxvf PyQt5-5.15.2.tar.gz
cd ./PyQt5-5.15.2
sudo python3 configure.py
Do you accept the terms of the license? yes
sudo make -j4
sudo make install
I compiled, but there was a problem with the import
>>> from QtSql import QSqlQuery
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /usr/lib/python3/dist-packages/PyQt5/QtCore.so: undefined symbol: sipTypeDef_QtCore_QAbstractItemModel

Related

python poetry how to install for all users ubuntu 18.04?

I am trying to install poetry for all users on ubuntu 18.04 and it doesn't seem to work.
I have tried the script (which installs to a local user's home directory)
$ curl -sSL https://install.python-poetry.org | python3 -
# this works but is only installed for the current user
and I've tried pip:
$ pip install poetry
$ poetry
Traceback (most recent call last):
File "/usr/lib/command-not-found", line 28, in <module>
from CommandNotFound import CommandNotFound
File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 19, in <module>
from CommandNotFound.db.db import SqliteDatabase
File "/usr/lib/python3/dist-packages/CommandNotFound/db/db.py", line 5, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
I also tried manually moving the poetry binary into /usr/local/bin but there are library dependencies that are not available.
this is how I solved it:
# copy poetry bin and lib to /usr/local/bin and /usr/local/lib
$ cd ~/.local/lib/python3.8/site-packages
$ sudo cp -R ./poetry-1.1.13.dist-info/ /usr/local/lib/python3.8/dist-packages/
$ sudo cp -R ./poetry_core-1.0.8.dist-info/ /usr/local/lib/python3.8/dist-packages/
$ sudo cp -a . /usr/local/lib/python3.8/dist-packages/
$ cd ~/.local/bin
$ sudo cp poetry /usr/local/bin/
$ sudo chmod -R 775 /usr/local/lib/python3.8/dist-packages/

What is happening with my python and terminal on ubuntu?

I utilize Ubuntu 20.4 and python3.10, but when I run:
sudo apt-get update or sudo apt update
my terminal show me this code:
Traceback (most recent call last):
File "/usr/lib/cnf-update-db", line 8, in <module>
from CommandNotFou/?nd.db.creator import DbCreator
File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 12, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Reading package lists... Done
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
When I run: sudo apt-get upgrade no problems happen.
Detail my python3.8 and python3.10 run normally
I don't know what is this.
I ran into same problem today. I did some search via google. Per https://www.linuxquestions.org/questions/linux-software-2/errors-trying-to-run-apt-get-update-4175665017/#3, finally my problem is fixed by followings:
cd /usr/lib/python3/dist-packages
ls -la apt.pkg.*
if apt.pkg.so is no there, copy the one to there.
sudo cp apt_pkg.cpython-38-x86_64-linux-gnu.so apt_pkg.so

caffe import error: even after installing it successfully, on ubuntu 18.04

I'm getting caffe import error even after installing it successfully using the command sudo apt install caffe-cpu. I was able to find caffe file at /usr/lib/python3/dist-packages/caffe (Path was added to PYTHONPATH). All requirements mentioned in the requirements.txt file of caffe directory was also installed.
I'm using Ubuntu 18.04 LTS, Python3.
Could anyone help me with this error?
import caffe
Traceback (most recent call last):
File "6_reconstruct_alphabet_image.py", line 17, in <module>
import caffe
File "/usr/lib/python3/dist-packages/caffe/__init__.py", line 1, in <module>
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer
File "/usr/lib/python3/dist-packages/caffe/pycaffe.py", line 15, in <module>
import caffe.io
File "/usr/lib/python3/dist-packages/caffe/io.py", line 2, in <module>
import skimage.io
File "/usr/lib/python3/dist-packages/skimage/__init__.py", line 158, in <module>
from .util.dtype import *
File "/usr/lib/python3/dist-packages/skimage/util/__init__.py", line 7, in <module>
from .arraycrop import crop
File "/usr/lib/python3/dist-packages/skimage/util/arraycrop.py", line 8, in <module>
from numpy.lib.arraypad import _validate_lengths
ImportError: cannot import name '_validate_lengths'
Problem solved: The error came up because caffe build wasn't done successfully. I recommend not to go up with the sudo apt install caffe-cpu command (Which is mentioned in the official caffe installation guide for Ubuntu); because it will end up in the error as above. It's better to install from the source.
Let me give step by step guidance to install caffe successfully in Ubuntu 18.04 LTS:
1] sudo apt-get install -y --no-install-recommends libboost-all-dev
2] sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev \ libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler
3] git clone https://github.com/BVLC/caffe
cd caffe
cp Makefile.config.example Makefile.config
4] sudo pip install scikit-image protobuf
cd python
for req in $(cat requirements.txt); do sudo pip install $req; done
5] Modify the Makefile.config file:
Uncomment the line CPU_ONLY := 1, and the line OPENCV_VERSION := 3.
6] Find LIBRARIES line in Makefile and change it to as follows:
LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5 \
opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs
7] make all
Now you could get some error like this:
CXX src/caffe/net.cpp
src/caffe/net.cpp:8:18: fatal error: hdf5.h: No such file or directory
compilation terminated.
Makefile:575: recipe for target '.build_release/src/caffe/net.o' failed
make: *** [.build_release/src/caffe/net.o] Error 1
To solve this error follow step 8.
8] install libhdf5-dev
open Makefile.config, locate line containing LIBRARY_DIRS and append /usr/lib /x86_64-linux-gnu/hdf5/serial
locate INCLUDE_DIRS and append /usr/include/hdf5/serial/ (per this SO answer)
rerun make all
9] make test
10] make runtest
11] make pycaffe
Now you could get some error like this:
CXX/LD -o python/caffe/_caffe.so python/caffe/_caffe.cpp
python/caffe/_caffe.cpp:10:31: fatal error: numpy/arrayobject.h: No such file or directory
compilation terminated.
Makefile:501: recipe for target 'python/caffe/_caffe.so' failed
make: *** [python/caffe/_caffe.so] Error 1
To solve this error follow step 12.
12] Find PYTHON_INCLUDE line in Makefile.config and do the changes as follows:
`PYTHON_INCLUDE := /usr/include/python2.7 \
/usr/local/lib/python2.7/dist-packages/numpy/core/include`
13] Add the module directory to our $PYTHONPATH by adding this line to the end of ~/.bashrc file:
`sudo vim ~/.bashrc`
`export PYTHONPATH=$HOME/Downloads/caffe/python:$PYTHONPATH`
`source ~/.bashrc'
14] Done.
This can be happened if there is any older version of the packages. Particularly, according to the Traceback, main reason can be the older version of scikit-image package. Just upgrade the package using the command.
for Python 2.7 : pip install --upgrade scikit-image
and
for Python 3.x : pip3 install --upgrade scikit-image
Installation of Caffe on ubuntu 18.04 in cpu mode .
conda update conda
conda create -n testcaffe python=3.5
source activate testcaffe
conda install -c menpo opencv3
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y build-essential cmake git pkg-config
sudo apt-get install -y libprotobuf-dev libleveldb-dev libsnappy-dev protobuf-compiler
sudo apt-get install -y libatlas-base-dev
sudo apt-get install -y --no-install-recommends libboost-all-dev
sudo apt-get install -y libgflags-dev libgoogle-glog-dev liblmdb-dev
mkdir build
cd build
make -j8 l8
make all
make install
conda install cython scikit-image ipython h5py nose pandas protobuf pyyaml jupyter
sed -i -e 's/python-dateutil>=1.4,<2/python-dateutil>=2.0/g' requirements.txt
for req in $(cat requirements.txt); do pip install $req; done
cd ../build
cd ../python
export PYTHONPATH=pwd${PYTHONPATH:+:${PYTHONPATH}}
python -c "import caffe;print(caffe.version)"
jupyter notebook
Complete steps just run these command as it is, Caffe will be installed in the system.

ModuleNotFoundError: No module named '_sqlite3'

On Redhat 4.4.7-18 I am trying to run python3 code using sqlite, but I get the following import error:
Traceback (most recent call last):
File "database.py", line 7, 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'
I tried to install it:
>sudo pip install sqlite3
Collecting sqlite3
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(101, 'Network is unreachable'))': /simple/sqlite3/
(while the network is reachable...) and with the following command:
> sudo yum install sqlite-devel
Loaded plugins: post-transaction-actions, product-id, refresh-packagekit,
: rhnplugin, search-disabled-repos, security, subscription-manager
This system is receiving updates from RHN Classic or RHN Satellite.
Setting up Install Process
Package sqlite-devel-3.6.20-1.el6_7.2.x86_64 already installed and latest version
Nothing to do
So it is installed and not installed? Any suggestion how I can solve the original problem?
Not a direct answer but I ended up here with my search engine... So for my fellow web-surfers:
I had a similar issue, but on ubuntu 16.04 with a manually compile python3.6 version :
from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'
I had to install libsqlite3-dev (sudo apt install libsqlite3-dev) and compile from the start python3.6 to make it work.
Yep.
sudo yum install sqlite-devel
Followed by rebuild of Python 3.8.3 from source did the trick. Thx!
I had this issue on linux mint 20 after sqlite3 successfully installed
from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'
also, could not import sqlite3 into python interpreter
Fix:
sudo apt install libsqlite3-dev
cd your python installer directory
./configure
sudo make install
It happens when you install Python using the source code and then compile.
Usually people tend to install python and sqlite into separate folders. This causes sqlite binary inaccessible to python executables.
To solve this problem, use a common folder to install BOTH, the Python as well as sqlite. So that python binary and sqlite binary, reside in the same bin folder.
Below example script will solve:
INSTALL_BASE_PATH="/home/<user>/<tools>"
cd ~
mkdir build
cd build
[ -f Python-3.9.10.tgz ] || wget --no-check-certificate https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz
tar -zxvf Python-3.9.10.tgz
[ -f sqlite-autoconf-3380000.tar.gz ] || wget --no-check-certificate https://www.sqlite.org/2022/sqlite-autoconf-3380000.tar.gz
tar -zxvf sqlite-autoconf-3380000.tar.gz
cd sqlite-autoconf-3380000
./configure --prefix=${INSTALL_BASE_PATH}
make
make install
cd ../Python-3.9.10
LD_RUN_PATH=${INSTALL_BASE_PATH}/lib configure
LDFLAGS="-L ${INSTALL_BASE_PATH}/lib"
CPPFLAGS="-I ${INSTALL_BASE_PATH}/include"
LD_RUN_PATH=${INSTALL_BASE_PATH}/lib make
./configure --prefix=${INSTALL_BASE_PATH}
make
make install
cd ~
LINE_TO_ADD="export PATH=${INSTALL_BASE_PATH}/bin:\$PATH"
if grep -q -v "${LINE_TO_ADD}" $HOME/.bashrc; then echo "${LINE_TO_ADD}" >> $HOME/.bashrc; fi
LINE_TO_ADD="export LD_LIBRARY_PATH=${INSTALL_BASE_PATH}/lib"
if grep -q -v "${LINE_TO_ADD}" $HOME/.bashrc; then echo "${LINE_TO_ADD}" >> $HOME/.bashrc; fi
source $HOME/.bashrc

python3.6 import sqlite3 error

I installed Python3.6 on ubuntu16.04 and installed sqlite3. When in python2, I can import sqlite successfully, but in python3 I got an import error. I tried many methods from Google, but it still doesn't work. I want to know how to solve it.
Python 3.6.0 (default, Mar 13 2017, 06:38:19)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
> import sqlite3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
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'
sqlite3 will comes with python itself. I also get the same problem i just uninstalled the python3.6 and installed again.
uninstall existing python:
sudo apt-get remove --purge python3.6
Install python3.6:
sudo apt install -y \
build-essential \
checkinstall
sudo apt install -y \
libreadline-gplv2-dev \
libncursesw5-dev \
libssl-dev \
libsqlite3-dev \
tk-dev \
libgdbm-dev \
libc6-dev \
libbz2-dev
PYTHON_VERSION=3.6.0
wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz
tar xvf Python-${PYTHON_VERSION}.tar.xz
cd Python-${PYTHON_VERSION}/
./configure
sudo make altinstall
It works!
You can install python3 and sqlite by yourself.
try this.
Or you can try it as follows,
1. install sqlite3
$ wget https://www.sqlite.org/2017/sqlite-autoconf-3170000.tar.gz --no-check-certificate
$ tar zxvf sqlite-autoconf-3170000.tar.gz
$ cd sqlite-autoconf-3170000
$ ./configure --prefix=/usr/local/sqlite3 --disable-static --enable-fts5 --enable-json1 CFLAGS="-g -O2 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_RTREE=1"
2. install python3.6
$ cd Python-3.6.0
$ LD_RUN_PATH=/usr/local/sqlite3/lib ./configure --prefix=/usr/local/python3.6 LDFLAGS="-L/usr/local/sqlite3/lib" CPPFLAGS="-I /usr/local/sqlite3/include"
$ LD_RUN_PATH=/usr/local/sqlite3/lib make
$ LD_RUN_PATH=/usr/local/sqlite3/lib make install

Resources