At Ubuntu 18.04 I successfully installed openalpr and tested it. Now I want to use python to call it. To do this, I installed https://pypi.org/project/openalpr/
pip install openalpr
But I'm having trouble with the paths, the ones in the example don't work.
alpr = Alpr("eu", "/etc/openalpr/openalpr.conf", "/usr/share/openalpr/runtime_data")
I get an error
>>> from openalpr import Alpr
>>> alpr = Alpr("eu", "/etc/openalpr/openalpr.conf", "/usr/share/openalpr/runtime_data")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/y700/Env/carplate/lib/python3.7/site-packages/openalpr/openalpr.py", line 95, in __init__
self._add_encoded_image_to_batch_func = self._openalprpy_lib.openalpr_add_encoded_image_to_batch
File "/home/y700/anaconda3/lib/python3.7/ctypes/__init__.py", line 369, in __getattr__
func = self.__getitem__(name)
File "/home/y700/anaconda3/lib/python3.7/ctypes/__init__.py", line 374, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/lib/libopenalpr.so.2: undefined symbol: openalpr_add_encoded_image_to_batch
After a few hours of searching, I found a solution that doesn't require a package installation pip install openalpr
Go to the directory that holds the openaltr source code.
cd openalpr/src/bindings/python/
Run setup to install openalpr as a system-wide python package.
sudo python3 setup.py install
Start an interactive Python session.
python3
Create an alpr object to use.
from openalpr import Alpr
alpr = Alpr("us", "/etc/openalpr/openalpr.conf", "/usr/share/openalpr/runtime_data/")
I had this error but after manual openalpr install, and doing:
cd openalpr/src/bindings/python/
sudo python3 setup.py install
this fix worked OK for me.
Related
I have the following boilerplate code
from scamp import *
s = Session()
s.tempo = 120
clarinet = s.new_part("clarinet")
When I run it, I get the error
Traceback (most recent call last):
File "/home/norhther/Descargas/music.py", line 6, in <module>
clarinet = s.new_part("clarinet")
File "/home/norhther/.local/lib/python3.9/site-packages/scamp/instruments.py", line 184, in new_part
instrument.add_soundfont_playback(preset=preset, soundfont=soundfont, num_channels=num_channels,
File "/home/norhther/.local/lib/python3.9/site-packages/scamp/instruments.py", line 984, in add_soundfont_playback
SoundfontPlaybackImplementation(bank_and_preset=preset, soundfont=soundfont, num_channels=num_channels,
File "/home/norhther/.local/lib/python3.9/site-packages/scamp/playback_implementations.py", line 327, in __init__
SoundfontHost(
File "/home/norhther/.local/lib/python3.9/site-packages/scamp/_soundfont_host.py", line 176, in __init__
raise ModuleNotFoundError("FluidSynth not available.")
ModuleNotFoundError: FluidSynth not available.
I installed FluidSynth in my system (Ubuntu) and I can execute it with no problem. I also used pip install pyFluidSynth with pip
Note: This answer predates OP editing the question; The question indeed contained the quoted phrase.
I also used pip install fluidsynth with pip
The fluidsynth package on PyPI was last updated in 2012, and is not what SCAMP depends on for interfacing with FluidSynth. The correct package to be installed is called pyFluidSynth. To install it, run the following command.
pip install pyFluidSynth
You'll also have to uninstall the wrong fluidsynth package.
pip uninstall fluidsynth
I had some problems with upgrading matplotlib recently so I ended up installing different versions of Python on my Mac (Sierra) via brew, and then uninstalled afterwards. However, now matplotlib works (2.0.2) but whenever I run a particular python script that used to work I get an error which I didn't have before:
Traceback (most recent call last):
File "sim.py", line 254, in <module>
main()
File "sim.py", line 118, in main
db = shelve.open('.sim_balance', 'c')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shelve.py", line 243, in open
return DbfilenameShelf(filename, flag, protocol, writeback)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shelve.py", line 227, in __init__
Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/anydbm.py", line 84, in open
mod = __import__(result)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/dbhash.py", line 7, in <module>
import bsddb
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/bsddb/__init__.py", line 67, in <module>
import _bsddb
ImportError: No module named _bsddb
According to my searches online this has something to do with my brew installed python interfering? I also deleted all my files in /Library/Python/2.7/site-packages yesterday which may have caused this as well.
I have tried homebrew brew install berkeley-db but then pip install bsddb3 yields:
Terrys-MBP:site-packages Terry$ pip install bsddb3
Collecting bsddb3
Using cached bsddb3-6.2.4.tar.gz
Complete output from command python setup.py egg_info:
Can't find a local Berkeley DB installation.
(suggestion: try the --berkeley-db=/path/to/bsddb option)
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/m5/1fg5rnj11_9cz5pntlqlwzyc0000gn/T/pip-build-elBAFK/bsddb3/
EDIT: Solved. Installed anaconda, installed bsddb via conda install and everything is working now.
Solved. I Installed anaconda, installed bsddb via conda install and everything is working now.
Can't seem to get the Python3 bindings for VLC functioning.
I'm doing pip3 install python_vlc which results in:
Collecting python-vlc
Installing collected packages: python-vlc
Successfully installed python-vlc-1.1.2
So, when I do import vlc it gives me the following error:
>>> import vlc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/site-packages/vlc.py", line 173, in <module>
dll, plugin_path = find_lib()
File "/usr/local/lib/python3.5/site-packages/vlc.py", line 165, in find_lib
dll = ctypes.CDLL('libvlc.dylib')
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ctypes/__init__.py", line 347, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(libvlc.dylib, 6): image not found
I tried looking for a solution online, but can't seem to find the cause.
Alright, so I found the problem...
I tried uninstalling python-vlc via pip3 uninstall python-vlc and uninstall the VLC app with AppZapper to completely remove everything. After this I reinstalled it, it worked so I can do import vlc in commandline now.
Update: so after I did that I ran into another issue. I got this error: core libvlc error: No plugins found! Check your VLC installation.
Added the following line to my .bash_profile:
export VLC_PLUGIN_PATH=$VLC_PLUGIN_PATH:/Applications/VLC.app/Contents/MacOS/plugins
which fixed it.
What do I do wrong?
Traceback (most recent call last):
File "/usr/local/bin/pip", line 9, in <module>
load_entry_point('pip==7.1.0', 'console_scripts', 'pip')()
File "/usr/local/lib/python3.4/dist-packages/setuptools-18.1- py3.4.egg/pkg_resources/__init__.py", line 558, in load_entry_point
File "/usr/local/lib/python3.4/dist-packages/setuptools-18.1-py3.4.egg/pkg_resources/__init__.py", line 2682, in load_entry_point
File "/usr/local/lib/python3.4/dist-packages/setuptools-18.1-py3.4.egg/pkg_resources/__init__.py", line 2355, in load
File "/usr/local/lib/python3.4/dist-packages/setuptools-18.1-py3.4.egg/pkg_resources/__init__.py", line 2361, in resolve
ImportError: No module named 'pip'
Stackoverflow asked me to type more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more
Try to fix pip installation with:
sudo apt-get install python3-pip
I've had the same issue and this worked for me. Maybe it's because you only installed pip for an earlier version of python or you intalled it from source and not from you distributions package management.
It sounds like your pip variable isn't set or you're trying to use conflicting environments. If you want to get the python package pymongo installed on your 3.4 version look to use:
/usr/local/bin/pip3.4 install pymongo
Then you can verify by testing in the 3.4 interpreter by running:
python3.4
>>>import pymongo
>>>
In the future look at using virtualenvs, they can be really easy and clean to work with while controlling your packages neatly. Hope this helps!
I'm trying to use the virtualenvwrapper to make a python 3 based virtualenv. However,I'm when I pass the optional interpreter argument, I'm seeing this error. I'm running Ubuntu 15.04. I tried reinstalling virtualenv and virtualenvwrapper without success. Thanks for all your help!
$ mkvirtualenv scriptcutter --python=/usr/bin/python3
Running virtualenv with interpreter /usr/bin/python3
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 8, in <module>
import base64
File "/usr/lib/python3.4/base64.py", line 9, in <module>
import re
File "/usr/lib/python3.4/re.py", line 336, in <module>
import copyreg
File "/usr/local/lib/python2.7/dist-packages/copyreg/__init__.py", line 7, in <module>
raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 53, in apport_excepthook
if not enabled():
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 24, in enabled
import re
File "/usr/lib/python3.4/re.py", line 336, in <module>
import copyreg
File "/usr/local/lib/python2.7/dist-packages/copyreg/__init__.py", line 7, in <module>
raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
Original exception was:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 8, in <module>
import base64
File "/usr/lib/python3.4/base64.py", line 9, in <module>
import re
File "/usr/lib/python3.4/re.py", line 336, in <module>
import copyreg
File "/usr/local/lib/python2.7/dist-packages/copyreg/__init__.py", line 7, in <module>
raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
I come across same issue, but after I downgrade virtualenv to 12.0.2, this problem disappears.
This is sort of a workaround for now.
Create a virtualenv using pyvenv.
# install pyvenv on Ubuntu
sudo apt-get install python3-venv
To minimize disruption in your normal workflow, pass a destination directory that is the same as the one used by virtualenvwrapper Like so,
pyvenv example ~/.virtualenvs/example
This is automatically working with workon and cdproject commands. I don't use much else that is provided by virtualenvwrapper
Hope this helps.
You can upgrade to the most recent version of virtualenv, with:
sudo pip install --upgrade https://github.com/pypa/virtualenv/archive/master.zip
virtualenv --version
# Returns 15.2.0.dev0 when I ran it
The following command then works:
mkvirtualenv scriptcutter --python=/usr/bin/python3
Apparently, the develop branch was dropped, so the URL with "develop" will no longer work. My answer was based off of #pjotr_dolphin's comment, with the URL updated.