I am aware it is possible to install PySide2 on Raspbian using the following command:
sudo apt-get install python3-pyside2.qt3dcore python3-pyside2.qt3dinput python3-pyside2.qt3dlogic python3-pyside2.qt3drender python3-pyside2.qtcharts python3-pyside2.qtconcurrent python3-pyside2.qtcore python3-pyside2.qtgui python3-pyside2.qthelp python3-pyside2.qtlocation python3-pyside2.qtmultimedia python3-pyside2.qtmultimediawidgets python3-pyside2.qtnetwork python3-pyside2.qtopengl python3-pyside2.qtpositioning python3-pyside2.qtprintsupport python3-pyside2.qtqml python3-pyside2.qtquick python3-pyside2.qtquickwidgets python3-pyside2.qtscript python3-pyside2.qtscripttools python3-pyside2.qtsensors python3-pyside2.qtsql python3-pyside2.qtsvg python3-pyside2.qttest python3-pyside2.qttexttospeech python3-pyside2.qtuitools python3-pyside2.qtwebchannel python3-pyside2.qtwebsockets python3-pyside2.qtwidgets python3-pyside2.qtx11extras python3-pyside2.qtxml python3-pyside2.qtxmlpatterns python3-pyside2uic
However, this doesn't include QtWebEngine and I cannot seem to find a package like python3-pyside2.qtwebengine either. Same goes for PyQt5 which I could use alternatively, but it does not exist there either.
So my question is: Is there any way to run my Python application, which uses QtWebEngine, on my Raspberry Pi (Raspbian 10 "Buster")? Also I have 6 Pi's which need to run the application. So if the only solution is to build from source, is there a way to build on one machine and then distribute it to the others without recompiling?
Another consideration is to use QWebView instead of QWebEngineView because that seems to be available through QtWebKit at least for PyQt5 (package python3-pyqt5.qtwebkit). Would that work? Is it okay to work-around the issue despite the fact that QtWebKit is deprecated? Also I have the problem, that on my windows machine QtWebKit is NOT included within the PyQt5 package, nor does the seperate PyQtWebKit PyPl package work, so it would be hard to code/debug the tool as I would always have to move it to the raspi first... So however I put it, there is always something which is inconvinient...
So I finally found the solution myself. From what I understand, the reason you cannot find QtWebEngine in the Raspberry Pi OS repositories, is that the Pi OS is made to run on all Raspberry Pi's, including Pi 1 and Pi 2, which have an ARMv6 and ARMv7 CPU architecture respectively. The WebEngine module however is platform dependend and not tested, compiled and distributed for ARMv6/7 anymore, so they won't release it in the repositories for Raspberry Pi OS. Luckily though, the Raspberry Pi 3 that I use has ARMv8, so it is possible to install QtWebEngine from Debian repositories, which offer QtWebEngine for exactly that architecture. Here is how:
Open your sources.list file
sudo nano /etc/apt/source.list
Add the following line and save/close:
deb http://deb.debian.org/debian/ buster main
Now update your package list
sudo apt update
It is possible that you encounter some errors concerning missing public keys, which we will now validate through a keyserver:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138
Note that the key 648ACFD622F3D138 was the first one to be shown in the error message from the previous step. It actually told me there were 3 missing keys, but dealing with the first one was sufficient to now update the package list once again and then being able to install the module finally.
sudo apt update
sudo apt-get install python3-pyside2.qtwebengine
I apparently don't have enough rep to comment. but editing the sources file above should be
sudo nano /etc/apt/sources.list
Related
Package management and juggling pip, anaconda, PPAs, and virtual-environments is difficult. Somewhere in my constellation of dependencies, things are broken. I'm on Ubuntu 18.04. As far as I know, I cannot fix these dependencies by hand.
The problem, for what it's worth: I've been unable to use tensorflow for a few months. Every time I try to fix it, even uninstalling and reinstalling everything to the best of my knowledge, things still don't work. After sinking enough hours, I'm looking for a "nuclear solution".
What I would like to do is cleanly remove everything except Python and any Python packages my system might require, so that I can start fresh (and hopefully do things properly.)
So, my question: How can I systematically clean up or remove my Python installation? I want to wipe everything and start anew. Does there exist a systematic guide, or a smart and reputable script that does this?
Helpful and cautionary tale, be a good idea not to delete it I think... I'll assume it was the profanity that got it deleted so I've edited it out.
!!!! WARNING !!!!
If you're like me and you think ah shur I'll do an 'apt list --installed | grep -i python' and then 'apt purge -y' all that crap, well, maybe don't.
Now my entire system is doo-doo. It all seemed fine until I rebooted and now there is no network connection, netplan and a bunch of other stuff is just gone. No recovery possible.
Actually it looks like it was an 'apt autoremove' AFTER I'd done the above that actually removed netplan.
And all because I wanted to remove multiple python versions to get over those gosh darn import issues and messin' around with pip and pip3 and pip3432432 and what gosh flippin' version of python is tied to what oody doody version of pip...
UPDATE - This video helped me recover me files https://youtu.be/tGIPeWkPkMc
You can try sudo apt purge python-pip python-dev, or python3 and python3-pip if you're using Python 3. This must remove all files/folders created by the installed packages. But I'm not really sure you need to do it.
The better solution is just to uninstall all pip packages, like pip freeze | xargs pip uninstall -y. Just to be sure you can even remove pip folder /usr/lib/python2.7/site-packages manually (or similar folder for Python 3).
(Extending #jay 's warning)
"Out of the Box", later Ubuntu versions have a system dependency on Python(3). For instance, my Ubuntu 20.04 runs "networkd-dispather" and "unattended-upgrade-shutdown". I've seen similar on various Cloud instances. Kali 2020 uses python to run a printer daemon. Check your system first. Or even try it on a VM similar to your system.
Try a quick check before doing something drastic.
ps aux | grep python
That will give you an idea if services are being run by Python. Frankly, I like the pip3 freeze to list the installed packages and cleanup from that list, like #sortas suggests in the second half of his answer.
I installed pyOpenCV on my raspberry pi using the pre-built binary from here. It doesn't seem to work at all. I wrote this little script to test:
import cv2
webcam = cv2.VideoCapture(0)
if not webcam.isOpened():
print('VideoCapture failed')
exit()
while True:
frame = webcam.read()[1]
cv2.imshow("Test", frame)
key = cv2.waitKey(1) & 0xFF
if key == ord("q"):
break
webcam.stop()
cv2.destroyAllWindows()
and it crashes with the message
OpenCV Error: Unspecified error (The function is not implemented.
Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you
are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then
re-run cmake or configure script) in cvShowImage, file
/home/yyoo/src/opencv-3.3.0/modules/highgui/src/window.cpp, line 605
Traceback (most recent call last): File "test.py", line 10, in
cv2.imshow("Test", frame) cv2.error: /home/yyoo/src/opencv-3.3.0/modules/highgui/src/window.cpp:605: error:
(-2) The function is not implemented. Rebuild the library with
Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian,
install libgtk2.0-dev and pkg-config, then re-run cmake or configure
script in function cvShowImage
Since I didn't build the code from source in the first place, I have no idea what to do. I think I should just start over, building from source. I have two questions related to this. First, do I need to delete anything before undertaking this, and if so, what? Second, where is a good place to get instructions? I'm running stretch, and python 3.5, and I'm planning on using a USB webcam. I tried following the instructions at pyImageSearch but it uses a virtual environment, and that didn't work for me for some reason. I'm planning on using the pi for one app only, so the virtual environment isn't important to me, and I'd just as soon skip it.
On this site it seems to say that all I have to do is to type
sudo apt-get install python-opencv
which makes me wonder why other sites talk about downloading openCV source and running make. I'm really confused and would be grateful for advice.
Build OpenCV from scratch gives your more control over the choice of modules like CUDA version or which BLAS library to use.
It could be quite troublesome and slow to build OpenCV on a Raspberry Pi, I believe. Therefore I would suggest trying pre-built packages through channels like sudo apt-get install python-opencv or pip. You can test them pretty quickly and they are easy to be removed even if they don't work.
If you really wanted to build from scratch, the site that you have mentioned should work. If you don't want virtual environment, just skip all the steps that involves virtual environment. Installation commands that work inside a virtual environment should work outside it too.
in the last couple of days I was developing an APP on python IDLE.
I tried to import the vlc module, when I run it I get this error:
OSError: dlopen(libvlccore.dylib, 6): image not found
I installed the module with this command: pip install python-vlc.
I hope you can help me getting it work!
Thanks in advance!
Zaid Zaim
python-vlc is just Python bindings for libVLC.
Without that library, it won't do you any good, because all it does is try to load that library (a .dylib, .so, or .dll, depending on your platform) and call functions out of it.
There should be installation instructions at the wiki page linked above, but on a Mac, the easiest way is to just install the VLC player. I know that if you install it with Homebrew, you get the library, in a location that python-vlc can find. But I think even the binary installer from the front page of the main VideoLAN website will work as well.
If you're using Homebrew, you'll want to read the docs for when to search brew vs. brew cask vs. other taps,1 or search somewhere like Mac App Store for the current status. But at present, the appropriate command appears to be:
brew cask install vlc
1. Generally, anything that you'd expect to find as a double-clickable app in /Applications, as opposed to a Unix command-line tool or a support library, is going to be a cask, and therefore in the tap cask, which has special shortcuts to access it. But that's a relatively new thing, and not every recipe has been converted yet.
brew install --cask vlc
Is the latest command, and it works for me!
Odroid running Ubuntu Mate 16.04 and ROS Kinetic. I have wiringPi2 installed for accessing the GPIO pins. I am able to use the GPIO pins through a Python script, but they require sudo access. I have a ROS node (written in Python) in which I want to access the GPIO pin data and publish to a topic. But, I am not able to do so, because wiringPi2 required sudo access, and ROS is not defined in root.
I have tried using wiringPiSetupSys() function which does not require sudo access, but that does not work i.e. I am not able to get the GPIO pin data without sudo access.
All the solutions to similar problems for Raspberry Pi platform don't seem to work for Odroid.
Thanks
Unfortunately, I could not find a fix to the problem with the exact specifications mentioned. However, when I tested the same code on a Raspberry Pi 3 with Raspbian, it works correctly.
So, I have concluded that the issue lies in the OS used i.e. Ubuntu Mate 16.04.
So, a solution might be to use Raspbian on Odroid itself. I am yet to test whether that works out.
Update : Raspbian doesn't exist as such for Odroid, so some other work around might be required.
When i used to code pynotify for python2.7 in Windows 10 then it shows an error that module object has no attribute 'init'. And i have already done to install the init module but same error occur. so what are the possible solutions for this problem?
here the code is.
import pynotify
pynotify.init("Basic")
n = pynotify.Notification("Title","Some sample content")
n.show()
It looks like the pynotify package you are looking for was initially designed for linux and was never supposed work on windows
The pynotify package installable through pip is just a name collision, and is not what not what you are looking for. (as this stackoverflow thread shows : I have already installed pynotify, still getting error no module named pynotify)
The package you want has GTK dependencies and can be installed in linux-based systems through the package management system using commands like : sudo apt-get install pynotify.
Other similar packages like notify2 (https://pypi.python.org/pypi/notify2) require linux components like dbus, and thus are not windows compatible.
If you're looking for a way to make windows 10 notifications, you can probably have look at this repository https://github.com/jithurjacob/Windows-10-Toast-Notifications.