I would like to use gstreamer library (1.0+) inside my python code. As they mention on their website they offer python bindings, but unfortunately they do not provide any additional information on how to get it up and running.
Can someone please provide a step by step instructions on how to install all the required package (preferably with pip) in order to use gstreamer inside a python virtual environment. A minimal working example would also be highly appreciated.
ps: I am working on Ububtu 18.04
In order to use gstreamer with python bindings a PyGObject package must be installed.
The setup procedure is the following:
Open a terminal and enter your virtual environment
Execute sudo apt install libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0 to install the build dependencies and GTK
Execute pip3 install pycairo to build and install Pycairo
Execute pip3 install PyGObject to build and install PyGObject
A more comprehensive guide can be found here:
https://pygobject.readthedocs.io/en/latest/getting_started.html
Check their examples:
https://gitlab.freedesktop.org/gstreamer/gst-python/-/tree/master/examples
Everything to get started should be in there.
Related
Posts I've viewed:
How to Install Python Development Tools on MSYS2
I'm trying to run pyinstaller in msys2, but I'm getting the following error:
OSError: Python library not found:
python38.dll, libpython3.8.dll, libpython38.dll, libpython3.8m.dll, libpython38m.dll
This would mean your Python installation doesn't come with proper library files.
This usually happens by missing development package, or unsuitable build parameters of Python installation.
* On Debian/Ubuntu, you would need to install Python development packages
* apt-get install python3-dev
* apt-get install python-dev
* If you're building Python by yourself, please rebuild your Python with `--enable-shared` (or, `--enable-framework` on Darwin)
Here's what I've tried installing in MSYS2 using pacman:
mingw-w64-x86_64-python
libgpgme-python
mingw-w64-i686-python3
base-devel
Unfortunately, I get the same error every time. I've also tried setting my path variable to every place I could think of that might have these libraries, and even one spot that I know has libpython3.8.dll but it was no help.
Thanks in advance!
It looks like
pip install python-dev-tools
was what I was looking for.
Here's my problem,
I have a shared hosting (GoDaddy Linux Hosting package) account and I'd like to create .py file to do some scraping for me. To do this I need the scrapy module (scrapy.org). Because of the shared account I can't install new modules so I installed VirtualEnv and created a new virtual env. that has pip, wheel, etc. preinstalled.
Running pip install scrapydoes NOT complete successfully because scrapy has lot of dependencies like libxml2 and it also needs python-dev tools. If I had access to 'sudo apt-get ...' this would be easy but I dont'. I can only use pip and easy_install.
So How do I install the python dev tool? And how do I install the dependencies? Is this even possible?
Cheers
You can install all the dependencies by activating the python virtual environment first.
Step 1 :
On Linux :
env/bin/activate
On Windows :
env\Scripts\activate
Step 2:
pip install lxml
I just tried and it worked for me. Please find screen shot attached.
It's not possible to do what I wanted to do on the GoDaddy plan I had.
I had some of the same issues. I found this and modified to pip3.7 install lxml==3.4.2. I was able to install successfully.
Sorry if this is basic but I'm trying to install dlib to use with python as mentioned in (http://blog.dlib.net/2014/04/dlib-187-released-make-your-own-object.html) "Make your own object detector in Python!".
I downloaded the install files, unzipped, and used cmake as in the install instructions (http://dlib.net/compile.html)
cd examples
mkdir build
cd build
cmake ..
cmake --build . --config Release
which seemed to work fine
However typing "import dlib" in Python just gives ImportError: No module named dlib.
Any idea how I tell Python how to find / use the thing?
Just a note for reference that the easiest way to install is now to use:
sudo python setup.py install
Instead of manual file editing, you can pass -DPYTHON_LIBRARY:FILEPATH=/path/to/your/libpython2.7.dylib to cmake.
What ./compile_dlib_python_module.bat does is
mkdir build
cd build
cmake ../../tools/python
So, just run the commands by one by one and instead of
cmake ../../tools/python
run
cmake ../../tools/python -DPYTHON_LIBRARY:FILEPATH=/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib
Dlib installation instructions for OSX (python3)
brew uninstall boost-python
brew uninstall boost
brew install boost-python --with-python3 --without-python
Installing default dlib
pip3 install dlib
Following Gives Some speedup
Installing dlib with AVX, SSE2, SSE4 instructions enabled (download the source code from dlib.net and execute from within the directory).
python setup.py install --yes USE_AVX_INSTRUCTIONS --yes USE_SSE2_INSTRUCTIONS --yes USE_SSE4_INSTRUCTIONS
On ubuntu I had to do the following:
sudo apt-get install libboost-python-dev cmake
cd to dlib-18.15/python_examples
Then:
./compile_dlib_python_module.bat
I then copied the dlib.so to dist-packages so it would be in my path.
sudo cp dlib.so /usr/local/lib/python2.7/dist-packages/
According to the documentation compile_dlib_python_module.bat will work on any os once you have both CMake and boost-python installed.
I finally got it to work! I'll be posting a detailed blog post about this later, but here's the gist for now. Basically, when I manually inspected the output of cmake, dlib was compiling and linking against the system version of Python not the Homebrew version of python.
If you're interested in the details, it appears that cmake was trying to compile and link against /usr/lib/libpython2.7.dylib. However, that is the system version of Python. It should be compiling a linking against /usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib which is the Homebrew version of Python.
I manually edited CMakeFiles/dlib_.dir/build.make and /CMakeFiles/dlib_.dir/link.txt to point to the Homebrew dylib file instead of the system one. I was able to compile dlib and then run it without a segfault. And furthermore, I was able to run the object detectors without a problem.
You are compiling the C++ example programs. The python examples are in the python_examples folder. Also, each example has instructions at the top that tell you how to use it.
If you use Conda, it's much easier.
conda install -c menpo dlib
https://anaconda.org/menpo/dlib
for Python 3 support use:
python setup.py install --yes DPYTHON3
If you already compiled dlib source code from github by cmake command.
Then you want to run python program to call dlib api.
You should compile dlib Python API as below,
sudo python setup.py install
Or
sudo python setup.py install --yes USE_AVX_INSTRUCTIONS
if you have a CPU that supports AVX instructions, since this makes some things run faster. Note that you need to have boost-python installed to compile the Python API.(Linked from dlib README.md)
It works for me.
I encounted the same error with you.
When I looked at the folder "C:\Anaconda3\Lib\site-packages", I found "dlib-19.8.0-py3.4-win-amd64.egg\", it means I have compiled dlib successfully, but there is no "dlib\" folder under the "C:\Anaconda3\Lib\site-packages", it is inside "dlib-19.8.0-py3.4-win-amd64.egg\" folder, so the solution is simple: just copy the "dlib\" folder to path "C:\Anaconda3\Lib\site-packages", the Python interpreter will find the module and import it successfully.
Hope it will help!
Hey I am pretty new to Pyside and am not sure how to download it or Qt? I have a 64-bit Windows computer and am wondering what I need to download once I have downloaded Qt because there is a checklist for like Qt 5.3, Qt 5.2.1, etc. and I am not sure which to download because under those there are multiple options under them like MSCV2012 64-bit and mscv64-bit OpenGL. Basically I am just very lost on what I need and can't seem to find the answer. Could someone enlighten me?
Thanks!
Install pip:
Download pip installer from here and save it in a directory other than C.
If you haven't set your python path: follow this.
Open Command Prompt and cd to that directory where you saved the pip installer.
run: python get-pip.py
Install pyside:
Close and Reopen Command Prompt.
run: cd C:\Python27\Scripts
run: pip install -U PySide
PySide does not yet support the Qt 5.x branch.
Simply running pip install pyside will install bindings that support the Qt 4.8 branch. Thus, you need that version of Qt.
All the steps are mentioned in here, but for your convenience, here goes it inline:
Installing prerequisites
Install latest pip distribution: download get-pip.py [bootstrap.pypa.io] and run it using the python interpreter.
Installing PySide on a Windows System
To install PySide on Windows you can choose from the following options:
Use pip [pypi.python.org] to install the wheel binary packages by issuing the command:
pip install -U PySide
Use setuptools [pypi.python.org] to install the egg binary packages by issuing the command (deprecated):
easy_install -U PySide
Download and install the packages from the PyPI page [pypi.python.org]
Provided binaries are without any other external dependencies. All required Qt libraries, development tools and examples are included.
Then, you can grab the Qt 4.8.6 version from here:
http://qt-project.org/downloads
Please note that there is no installer for VS2012 off-hand, so you should use an older version or mingw. Alternatively, you could also build Qt 4 yourself.
I have an issue to install python-tk package for my app to user's computer. User does not have sudo rights, but has python installed by default.
I can't even find downloadable python-tk module to simply run "python setup.py install" .
Can someone help with this? Are there any other choices?
Unfortunately, python-tk is actually a separately-packaged version of Tkinter, built straight from the Python source code; it's not a separately available source package.
What you can do is build and install your own version of Python in your homedir.