pjsua: unable to import pjsua python module - python

I'm getting the below error while trying to import python module pjsua. I have Mac OS 10.8.1 version. I verified the solution provided in http://www.darrensessions.com/?p=292 and the solution seemed to have fixed this issue in MacOS-10.7. Seems like this is broken again for MacOS-10.8. I did not got any errors when compiling the code. Only get the below error when importing PJSUA module.
>>> import pjsua
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pjsua.py", line 59, in <module>
import _pjsua
ImportError: dlopen(/Library/Python/2.7/site-packages/_pjsua.so, 2): Symbol not found: _AudioOutputUnitStart
Referenced from: /Library/Python/2.7/site-packages/_pjsua.so
Expected in: flat namespace
in /Library/Python/2.7/site-packages/_pjsua.so
Your help in highly appreciated.
Thanks,

One straight-forward solution would be (purely theoretical, haven't tested):
Look at http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2011-November/013722.html
See, where the patch says:
# OS X Lion Support
if platform.mac_ver()[0].startswith("10.7"):
extra_link_args += ["-framework", "AudioUnit"]
Change line
if platform.mac_ver()[0].startswith("10.7"):
to
if platform.mac_ver()[0].startswith("10.7") or platform.mac_ver()[0].startswith("10.8"):
Recompile
-- edit --
Ok, I patched it as I suggested and:
> python ~/a.py
a
> cat ~/a.py
import pjsua
test = "a"
print test

This error was recently fixed as showed above in PJSIP 2.4 python package:
# OS X Lion (10.7.x) or above support
if version[0] == '10' and int(version[1]) >= 7:
extra_link_args += ["-framework", "AudioUnit"]
The funny thing is that I run in the same error:
macbookproloreto:python admin$ python samples/simplecall.py
Traceback (most recent call last):
File "samples/simplecall.py", line 23, in <module>
import pjsua as pj
File "/Library/Python/2.7/site-packages/pjsua.py", line 59, in <module>
import _pjsua
ImportError: dlopen(/Library/Python/2.7/site-packages/_pjsua.so, 2): Symbol not found: _pj_atexit
Referenced from: /Library/Python/2.7/site-packages/_pjsua.so
Expected in: flat namespace
in /Library/Python/2.7/site-packages/_pjsua.so
not understanding why since the Python setup.py script checking the platform version seems to be fine:
>>> import platform
>>> version = platform.mac_ver()[0].split(".")
>>> version
['10', '10', '4']
>>>

Related

"Symbol not found: __dyld_shared_cache_contains_path" on OSX after installl from backup?

I've just got a new Macbook running OSX 10.15.7. I installed it from a Time Machine backup of my old machine.
Now when I try to import the ctypes library in Python:
python -c "import ctypes"
I see this:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/Cellar/python#3.9/3.9.1_2/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 8, in <module>
from _ctypes import Union, Structure, Array
ImportError: dlopen(/usr/local/Cellar/python#3.9/3.9.1_2/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload/_ctypes.cpython-39-darwin.so, 2): Symbol not found: __dyld_shared_cache_contains_path
Referenced from: /usr/local/Cellar/python#3.9/3.9.1_2/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload/_ctypes.cpython-39-darwin.so (which was built for Mac OS X 11.0)
Expected in: /usr/lib/libSystem.B.dylib
in /usr/local/Cellar/python#3.9/3.9.1_2/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload/_ctypes.cpython-39-darwin.so
I have no idea how to debug this - can anyone advise? It means I can't run Jupyter notebooks, among other things.

Not being able to use turicreate

I am trying to use turicreate. I installed it on my device (sudo python2.7 -m pip install turicreate) And when I ran my code (in terminal on Mac), I got a long error message. I believe that the significant part is as follows:
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/turicreate/cython/cy_unity.so, 2): Symbol not found: _syslog$DARWIN_EXTSN
Here is the integrity of it for reference:
Traceback (most recent call last):
File "classifier.py", line 1, in <module>
import turicreate as turi
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/turicreate/__init__.py", line 30, in <module>
from turicreate.data_structures.sgraph import Vertex, Edge
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/turicreate/data_structures/__init__.py", line 18, in <module>
from . import sframe
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/turicreate/data_structures/sframe.py", line 16, in <module>
from ..connect import main as glconnect
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/turicreate/connect/main.py", line 13, in <module>
from ..cython.cy_unity import UnityGlobalProxy
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/turicreate/cython/cy_unity.so, 2): Symbol not found: _syslog$DARWIN_EXTSN
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/turicreate/cython/../libunity_shared.dylib (which was built for Mac OS X 10.13)
Expected in: /usr/lib/libSystem.B.dylib
in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/turicreate/cython/../libunity_shared.dylib
What is the problem here?
This article provides a detailed explanation of setting up Python environment for popular ML packages on Mac - Machine Learning Compass

How to import a Python module into Jython?

I can use the module correctly by Python, but when using Jython, some error occurs...
Code:
from jieba import *
Errors:
Traceback (most recent call last):
File "/Users/Jack/Documents/workspace/FirstJython/hellojyphon.py", line 8, in <module>
from jieba import *
File "/Users/Jack/Documents/workspace/FirstJython/jieba/__init__.py", line 15, in <module>
from ._compat import *
ImportError: No module named _compat
Is there any differences between Python and Jython when import?
I solve it by myself.
There is something wrong when using relative directories in Jython.
so after I change ._compat to jieba._compat, the problem solved!
But I don't exactly know the reason...

Importing pyodbc on OS X fails

I am trying to use pyodbc on OS X 10.7 and Python 2.7.
But the 'import pyodbc' statement causes the following error:
>>> import pyodbc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(./pyodbc.so, 2): Symbol not found: _GetPrivateProfileString
Referenced from: /usr/lib/libiodbc.2.dylib
Expected in: flat namespace
I have been looking on Google and tried to reinstall pyodbc by following different tutorials, without any luck. Any help is appreciated.

ImportError: couldn't find library

I am encountering these errors frequently when I install python libraries and I'm wondering what I am doing wrong
the current example is the libchromaprint library
http://acoustid.org/chromaprint
I install it and everything, try to run the python example, get:
Traceback (most recent call last):
File "examples/fpwav.py", line 7, in <module>
import chromaprint
File "build/bdist.linux-x86_64/egg/chromaprint/__init__.py", line 24, in <module>
ImportError: couldn't find libchromaprint
and then when I check:
find /usr/local/lib/libch*
/usr/local/lib/libchromaprint.so
/usr/local/lib/libchromaprint.so.0
/usr/local/lib/libchromaprint.so.0.1.3
what am I doing wrong?
Python does not use your usual library path. The chromaprint you're looking for should be somewhere like /usr/lib/pymodules/python2.6.
From the python interpreter do:
>>> import sys
>>> sys.path
This will show you the directories python searches for a module.

Categories

Resources