vincelwt / RaspberryCast

:tv: Transform your Raspberry Pi into a streaming device. Videos can be sent from mobile devices or computers (Chrome extension).
MIT License
871 stars 138 forks source link

Switch default to Python3, and change deps installation #67

Closed jarondl closed 6 years ago

jarondl commented 6 years ago

setup.sh used to install some dependencies with apt-get and some with pip. In the pip part, we had livestreamer, which is not inuse, and youtube-dl and bottle which both exist in Raspbian repositories for Python3. So instead of the mix (which is problematic, because no one ever updates pip deps), we install it all with apt-get.

This required to switch to Python3. The problem is that existing users with a self-updating git installation will not see this change. So for backwards compatibility I added a simple dependency check before running the main script.

vincelwt commented 6 years ago

Hey!

Using exclusively apt-get restricts RaspberryCast on others systems such as Arch. However I agree it makes updates way smoother than with pip (although that could be solved by forcing an update check for those packages on start). Are you sure that the youtube-dl Debian package contains the Python bindings? If I remember correctly that was the reason in the first place I switched youtube-dl to pip

Also, I agree that we need Python 3 compatibility but I don't know if imposing Python 3 is a good idea, as if I'm not mistaken Python 2 is the only one installed by default on Raspbian. That'd make the RaspberryCast installation much larger/longer.

Tell me your thoughts on this :) Thanks

jarondl commented 6 years ago

OK, so the situation was indeed more troublesome than I expected. I actually wanted to shift from pip to consolidate, and make the case easier for Arch (since youtube_dl and bottle also exist there in the AUR, and pip-installing is frowned upon.)

But, coming from a rolling-release world, I only checked if the current Raspbain package contains the Python binding. After your question, I checked all versions of Raspbian:

$ for rel in buster jessie stretch wheezy; do \
echo "${rel}:" && curl "http://archive.raspbian.org/raspbian/dists/${rel}/main/Contents-armhf.gz" 2>/dev/null \
| zgrep "dist-packages/youtube_dl/__init__.py";
done

And the results are not promising:

buster:
usr/lib/python3/dist-packages/youtube_dl/__init__.py        web/youtube-dl
jessie:
usr/lib/python2.7/dist-packages/youtube_dl/__init__.py      web/youtube-dl
stretch:
usr/lib/python3/dist-packages/youtube_dl/__init__.py        web/youtube-dl
wheezy:

wheezy doesn't have youtube_dl at all. jessie has a python2 version, and buster and strech have python3. I don't know enough about Raspbian to know if old versions are still in use, so let's leave it as is.