undefined symbol when importing pyo - python

I am running python 2.7 in Ubuntu 14.04 and have installed the python-pyo package, but when I import the pyo module I get the following error:
ImportError: /usr/lib/python2.7/dist-packages/_pyo.so: undefined symbol: jack_port_register
It seems like I must have screwed up the jack libraries on my system somehow, but I can't figure out what is broken.
[~/Downloads/pyo-read-only]$ ldconfig -p|grep jack
libjack.so.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libjack.so.0
libjack.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libjack.so
[~/Downloads/pyo-read-only]$ objdump -tT /usr/lib/x86_64-linux-gnu/libjack.so.0|grep jack_port_register
000000000000a3a0 g DF .text 00000000000001a1 Base jack_port_register
I have tried building python-pyo from scratch but I get the same error. If I build it without --use-jack, I get a segmentation fault when I try to boot a server.

I had this problem. It was fixed by ensuring I had the correct packages installed.
From http://ajaxsoundstudio.com/pyodoc/compiling.html
sudo apt-get install libjack-jackd2-dev libportmidi-dev portaudio19-dev liblo-dev
sudo apt-get install libsndfile-dev python-dev python-tk
sudo apt-get install python-imaging-tk python-wxgtk3.0

I was able to get a bit further by manually adding -ljack to the setup.py and building from source.

Related

how to install cpp man page on debian 10?

from here: https://stackoverflow.com/questaions/34507045/how-to-install-man-pages-for-c11 there is mentioned,
cppman is no longer supported under Ubuntu/apt
and therefor no libstdc++6-<version>-doc could be install via apt anymore.
and the only way to install the man page is via pip3. So I have tried to install
sudo apt-get install python-pip and sudo apt-get install python3-pip. Now, having python3, I can install it via pip3:
pip3 install cppman, everything seems correct, before I tried to cache the man pages: cppman -c, which giver error:
Traceback (most recent call last):
File "/usr/local/bin/cppman", line 40, in <module>
from cppman.main import Cppman
File "/usr/local/lib/python2.7/dist-packages/cppman/main.py", line 26, in <module>
import html
ImportError: No module named html
As could be seen, it uses Python2.7 instead of Python3, that is strange.
From github, I have found similar problem here: https://github.com/aitjcize/cppman/issues/80, where they suggest to do
pip uninstall mancpp
pip3 install mancpp
Which I did, but when installing mancpp again from pip3, then another server error:
Collecting mancpp
Could not install packages due to an EnvironmentError: 404 Client Error: Not Found for url: https://pypi.org/simple/mancpp/
So what now? If you read till here, than you can see there are many errors, but cannot find solution anywhere in stack sites. I only want to have cpp manuals for searching for functions and classes (like std) and mainly for glibc++. As I could do simply with c functions. Why is it so hard? Anyway, how to install the mancpp via pip3?
uname -a:
Linux 4.19.0-9-amd64 #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07) x86_64 GNU/Linux
The script uses #!/usr/bin/env python shebang and on your system python is most probably 2.7. Just edit the script:
sudo vim /usr/local/bin/cppman
Append 3 at the end: #!/usr/bin/env python3 and try again.

Issue in installing PyOpenCL

I'm trying to install PyOpenCL on Ubuntu 16.04, but getting the following error:
/usr/bin/ld: cannot find -lOpenCL
collect2: error: ld returned 1 exit status
error: command 'c++' failed with exit status 1
How can I solve this issue?
Thanks.
You need to install: ocl-icd-opencl-dev
apt-get install ocl-icd-opencl-dev
You can check what was actually installed with that package running:
$ dpkg -L ocl-icd-opencl-dev
which should return something along these lines:
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/ocl-icd-opencl-dev
/usr/share/doc/ocl-icd-opencl-dev/copyright
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/OpenCL.pc
/usr/share/doc/ocl-icd-opencl-dev/changelog.Debian.gz
/usr/lib/x86_64-linux-gnu/libOpenCL.so # <--- this is the important bit
Bonus
If you get a complaint about missing headers, e.g CL/cl.h, then you should install:
apt-get install opencl-headers.
Don't forget to install specific OpenCL drivers for your platform. You could be running against an Intel CPU/GPU, an AMD or NVidia graphics card or even an FPGA.
A good way of checking everything is well setup, is to run clinfo which will show useful information about available platforms (apt-get install clinfo).
Based on this page, it seems that I had to only run this command on my bash for the error to be removed:
apt-get install python-pyopencl

pyqt4.core Import error: no module named Core

Just learning Python here and I can't seem to get my python program to work from line 2 :
from PyQt4.Core import *
I get the following error:
ImportError: no module named Core
From what I can see, usually the programmer is just missing part of python-qt4
I have tried installing (or re-installing as the case may be) the following packages using apt-get, but surprisingly to no avail:
python-qt4 pyqt-tools pyside-tools libqt4-dev build-essential python-sip
I also tried using the interactive shell to do:
PyQt4.Core import SIGNAL
Where I get the same message
apt-get shows that I have the latest version of everything. I recently did an apt-get update and an apt-get upgrade, after installing the above packages then tried apt-get install(each) again. The update had all packages show most recent version is installed.
Still I get the same error message :(

Python-tesseract installation on Ubuntu

I am trying to install python-tesseract 0.9-0.5 from a deb file on Ubuntu 15.04, but it gives several errors.
This is what I do:
1- I open the path of the file on terminal and write
sudo dpkg -i python-tesseract_0.9-0.5ubuntu2_i386.deb
2- After this, the console shows several errors:
Selecting previously unselected package python-tesseract.
(Reading database ... 349994 files and directories currently installed.)
Preparing to unpack python-tesseract_0.9-0.5ubuntu2_i386.deb ...
Unpacking python-tesseract (0.9-0.5ubuntu2) ...
dpkg: dependency problems prevent configuration of python-tesseract:
python-tesseract depends on python (<< 2.8).
python-tesseract depends on python (>= 2.7~).
python-tesseract depends on liblept4.
python-tesseract depends on libopencv-core2.4; however:
Package libopencv-core2.4:i386 is not installed.
python-tesseract depends on libtesseract3; however:
dpkg: error processing package python-tesseract (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python-tesseract
3- Just for checking, I open the installation file and extracted the tesseract.py class, and used alone in python.
I opened it this way:
python tesseract.py
, but I got this:
Traceback (most recent call last):
File "tesseract.py", line 28, in <module>
_tesseract = swig_import_helper()
File "tesseract.py", line 20, in swig_import_helper
import _tesseract
ImportError: No module named _tesseract
The thing is that I want to use tesseract functions on python for an optical character recognition application, and I have understood that the best wrapper for this is python-tesseract (is not the same that pytesseract, I think).
My question is: How can I to install python-tesseract on Ubuntu 15.04? Thanks a lot
sudo apt-get install tesseract-ocr
**After Entering this command in terminal it will install tesseract **
Update and install tesseract-ocr
sudo apt-get update && sudo apt-get install tesseract-ocr
Install pytesseract for python
pip3 install pytesseract
Usage
import pytesseract
from PIL import Image
img= "path/img.jpg"
text = pytesseract.image_to_string(Image.open(img))
print(text)
When I was trying to get python to use Tesseract, I found this tutorial which was pretty useful.
But I then found out that this was way too simple for my needs, so I will need to find a another solution.
I hope this is going to help you man!
It works installing gdebi-core first, and afterwards installing the .deb package with it, so that gdebi install dependencies for me. I used Ubuntu 14.04.
sudo apt-get install gdebi-core
sudo gdebi python-tesseract_0.9-0.5ubuntu2_i386.deb
Use this link for installation
once you do that,
here is the code
from PIL import Image
img="pathToYourImage/img.jpeg"
text = pytesseract.image_to_string(Image.open(img))
print(text)

Installing rpy2 without admin privileges

I am having trouble installing the Python package rpy2. I have already compiled R as a shared library, but I do not have admin priviledges so I am trying to install rpy2 with:
pip install -user rpy2
However, I am getting the following error:
./rpy/rinterface/_rinterface.c:86:31: fatal error:
readline/readline.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
I have downloaded readline to:
/some/path/readline-6.2/
where I can see readline.h (I have also compiled readline just in case)
My question:
How can I make rpy2 (or pip) aware of this location with readline.h to avoid the header compilation error?
You'll need to actually install readline, not just download it, and then point rpy2 to it with CFLAGS and LDFLAGS.
Try this approach. It's almost working for me - I have the same problem, except an additional wrinkle that rpy2 seems to be linking against the system R instead of my homedir install.
First, I downloaded readline to ~/src/readline-6.2, and installed it with ./configure --prefix=$HOME && make && make install. (You need to install it somewhere, not just download the source.)
Then I re-compiled R with
CPPFLAGS="-I/usr/local/include -I$HOME/include/" \
LDFLAGS="-L/usr/local/lib64 -L/usr/local/lib -L$HOME/lib64 -L$HOME/lib" \
./configure --prefix=$HOME --enable-BLAS-shlib --enable-R-shlib
make
make install
R is definitely now using that readline:
$ ldd ~/lib64/R/lib/libR.so | grep readline
libreadline.so.6 => /home/dsutherl/lib/libreadline.so.6 (0x00007f8104207000)
The same for my in-home install of Python (3.2.3, since h5py doesn't work with 3.3 yet):
CFLAGS="-I/usr/local/include -I$HOME/include/" \
LDFLAGS="-L/usr/local/lib64 -L/usr/local/lib -L$HOME/lib64 -L$HOME/lib" \
./configure --prefix=$HOME
make
make install
And again:
$ ldd ~/lib/python3.2/lib-dynload/readline.cpython-32m.so | grep readline
libreadline.so.6 => /home/dsutherl/lib/libreadline.so.6 (0x00007fbfff5c2000)
Then I downloaded the rpy2 source and built that:
CFLAGS="-I/usr/local/include -I$HOME/include/" \
LDFLAGS="-L/usr/local/lib64 -L/usr/local/lib -L$HOME/lib64 -L$HOME/lib" \
python3 setup.py build --r-home $HOME/lib64/R install
This seemed successful, and ldding the .sos in site-packages/rpy2 links to the right libreadline...but to the system R, instead of mine, despite the explicit --r-home.
more simple :
yum install readline-devel.x86_64
run for me on centos 7
for debian/ubuntu
apt-get install libreadline-dev
Sometime in linux is needed an sudo apt-get upgrade, to get the news libraries, may work
This is another option, but too you need root privilegies ...
sudo apt-get install libreadline-dev

Categories

Resources