fe80Grau / ytdlp2STRM

A little script to serve Youtube / Twitch / Crunchyroll videos without storage it. Uses yt-dlp HTTP data throught Flask and dynamic URLs. We can use this dynamic URLs to set STRM files.
https://github.com/fe80Grau/ytdlp2STRM
MIT License
205 stars 19 forks source link

Install Failure #69

Closed Jstudner closed 2 weeks ago

Jstudner commented 3 weeks ago

So fairly certain this comes down to user error, however I have been working on installing this the last few days with no luck. I am running Ubontu with the intent to have youtube videos in jellyfin. I have tried the linux install serveral times but kept getting "error: externally-managed-environment", which then told me to do it in a Python venv. I set that up and finaly got it to install requirements.txt, however when I go to start the systemd program it gives me this

"ytdlp2strm.service - ytdlp2STRM Service Loaded: loaded (/etc/systemd/system/ytdlp2strm.service; enabled; preset: enabled) Active: activating (auto-restart) (Result: exit-code) since Tue 2024-08-27 15:50:39 EDT; 3s ago Process: 1417156 ExecStart=/usr/bin/python3 /opt/ytdlp2STRM/main.py (code=exited, status=1/FAILURE) Main PID: 1417156 (code=exited, status=1/FAILURE) CPU: 213ms (venv) jstudner@MyServ:/opt/ytdlp2STRM$ journalctl _PID=1417156 Aug 27 15:50:39 MyServ python3[1417156]: Traceback (most recent call last): Aug 27 15:50:39 MyServ python3[1417156]: File "/opt/ytdlp2STRM/main.py", line 4, in Aug 27 15:50:39 MyServ python3[1417156]: from flask import Flask, request Aug 27 15:50:39 MyServ python3[1417156]: ModuleNotFoundError: No module named 'flask'

I am guessing its not meant to be run in a venv, but unsure how to work it otherwise. In case it wasn't obvious I am very new to linux in general. I also tried it in docker awhile back and while it didn't work then the web UI is there, but does not work (says it downloaded but the files aren't there and jelly fin also reads nothing there.

Guessing I did something stupid but any help would be appreciated!

Jstudner commented 3 weeks ago

I also started getting this massive one whenever I try to use any python command: profiling:/opt/Python-3.12.5/Modules/getpath.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/deepfreeze/deepfreeze.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/pwdmodule.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/symtablemodule.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/_stat.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/_operator.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/_localemodule.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/_functoolsmodule.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/_abc.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/_weakref.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/_typingmodule.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/timemodule.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/_threadmodule.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/_sre/sre.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/itertoolsmodule.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/_io/stringio.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/_io/textio.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/_io/bufferedio.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/_io/bytesio.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/_io/fileio.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/_io/iobase.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/_io/_iomodule.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/errnomodule.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/_collectionsmodule.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/_codecsmodule.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/_tracemalloc.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/signalmodule.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/posixmodule.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/faulthandler.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/atexitmodule.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/gcmodule.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/main.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/dynload_shlib.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/perf_trampoline.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/suggestions.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/fileutils.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/formatter_unicode.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/dtoa.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/pystrhex.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/pystrtod.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/pystrcmp.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/getopt.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/tracemalloc.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/traceback.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/thread.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/sysmodule.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/symtable.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/structmember.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/specialize.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/bootstrap_hash.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/pytime.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/pythonrun.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/pystate.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/pymath.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/pylifecycle.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/pyhash.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/pyfpe.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/pyarena.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/preconfig.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/pathconfig.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/mystrtoul.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/mysnprintf.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/modsupport.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/marshal.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/legacy_tracing.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/intrinsics.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/instrumentation.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/initconfig.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/importdl.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/import.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/hashtable.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/hamt.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/ceval_gil.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/getversion.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/getplatform.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/getcopyright.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/getcompiler.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/getargs.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/future.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/frozenmain.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/frame.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/flowgraph.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/errors.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/context.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/compile.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/codecs.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/ceval.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/bltinmodule.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/ast_unparse.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/ast_opt.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/ast.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/assemble.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/asdl.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/Python-tokenize.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/Python-ast.gcda:Cannot open profiling:/opt/Python-3.12.5/Python/_warnings.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/weakrefobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/unionobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/unicodectype.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/unicodeobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/typevarobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/typeobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/tupleobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/structseq.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/sliceobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/setobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/rangeobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/picklebufobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/obmalloc.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/object.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/namespaceobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/moduleobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/methodobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/memoryobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/odictobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/dictobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/longobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/listobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/iterobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/interpreteridobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/funcobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/frameobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/floatobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/fileobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/genobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/genericaliasobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/exceptions.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/enumobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/descrobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/complexobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/codeobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/classobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/cellobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/capsule.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/call.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/bytesobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/bytearrayobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/bytes_methods.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/boolobject.gcda:Cannot open profiling:/opt/Python-3.12.5/Objects/abstract.gcda:Cannot open profiling:/opt/Python-3.12.5/Parser/tokenizer.gcda:Cannot open profiling:/opt/Python-3.12.5/Parser/myreadline.gcda:Cannot open profiling:/opt/Python-3.12.5/Parser/peg_api.gcda:Cannot open profiling:/opt/Python-3.12.5/Parser/string_parser.gcda:Cannot open profiling:/opt/Python-3.12.5/Parser/parser.gcda:Cannot open profiling:/opt/Python-3.12.5/Parser/action_helpers.gcda:Cannot open profiling:/opt/Python-3.12.5/Parser/pegen_errors.gcda:Cannot open profiling:/opt/Python-3.12.5/Parser/pegen.gcda:Cannot open profiling:/opt/Python-3.12.5/Parser/token.gcda:Cannot open profiling:/opt/Python-3.12.5/Modules/getbuildinfo.gcda:Cannot open profiling:/opt/Python-3.12.5/Programs/python.gcda:Cannot open

Jstudner commented 3 weeks ago

I redid the install a few more times, used the "--break-system-packages" to install all of the dependencys again (originally I had done them one by one) I got one status check to show as working, but then it promptly went back to not working (i ran the command a 2nd time in disbelief (changed nothing)) After a few more I got a install with no errors, but it still doesnt show working in status. I also tried just running python3 main.py, which opened the webUI, but its totally broken lol giving this error atm:

$ python cli.py --media youtube --params direct only python cli.py command can be executed from here. $

so yea.... fun

Jstudner commented 3 weeks ago

and here is an example of the working thing, I believe it is trying to restart as soon as it loads and then failing?

ytdlp2strm.service - ytdlp2STRM Service Loaded: loaded (/etc/systemd/system/ytdlp2strm.service; enabled; preset: enabled) Active: active (running) since Wed 2024-08-28 00:43:27 EDT; 2ms ago Main PID: 83985 (python3) Tasks: 1 (limit: 38267) Memory: 1.0M (peak: 1.0M) CPU: 1ms CGroup: /system.slice/ytdlp2strm.service └─83985 /usr/bin/python3 /opt/ytdlp2STRM/main.py

Aug 28 00:43:27 JcorpServerNAS systemd[1]: ytdlp2strm.service: Scheduled restart job, restart counter is at 825. Aug 28 00:43:27 JcorpServerNAS systemd[1]: Started ytdlp2strm.service - ytdlp2STRM Service. jstudner@JcorpServerNAS:/opt/ytdlp2STRM$ sudo systemctl status ytdlp2strm.service ● ytdlp2strm.service - ytdlp2STRM Service Loaded: loaded (/etc/systemd/system/ytdlp2strm.service; enabled; preset: enabled) Active: activating (auto-restart) (Result: exit-code) since Wed 2024-08-28 00:43:38 EDT; 6s ago Process: 84052 ExecStart=/usr/bin/python3 /opt/ytdlp2STRM/main.py (code=exited, status=1/FAILURE) Main PID: 84052 (code=exited, status=1/FAILURE) CPU: 236ms jstudner@JcorpServerNAS:/opt/ytdlp2STRM$

Jstudner commented 3 weeks ago

The port is also now showing this:

Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

cleanerspam commented 3 weeks ago

providing it in on ArchAUR or even pip would be better , installing python packages system wide is not recommended

Jstudner commented 3 weeks ago

I am still confused on what is causing them to be installed system wide though? I am using Ubuntu so not sure about archAUR. will look into both though.

Jstudner commented 3 weeks ago

providing it in on ArchAUR -I am on ubontu so I believe makedeb was the closest alternative, but I am unsure what difference this makes?

or even pip would be better , Its currently being installed using pip? I believe you are referring to the requirements.txt as that is seemingly my main issue

installing python packages system wide is not recommended I am aware, but I have been very confused as to why it is installing them system wide, I am following the instructions here and using the recommended directories.

guessing I am missing something, I look forward to hearing from you.

cleanerspam commented 3 weeks ago

those errors you are getting is not your fault , python pip packages are meant to run in virtual environments it is not meant to directly install alongside system packages in opt

Solution would be for the creator of this tool to provide pip packages or binaries for linux

Jstudner commented 3 weeks ago

those errors you are getting is not your fault , python pip packages are meant to run in virtual environments it is not meant to directly install alongside system packages in opt

Solution would be for the creator of this tool to provide pip packages or binaries for linux

Ok, that's very good to know, in that case shouldn't I be able to change everywhere it says opt and move the files to a separated folder? I will first try to remove some of the stuff running in opt though.

If I can move it out of opt what files should I edit?

cleanerspam commented 3 weeks ago

Install Instructions ,

First install nano, screen ,python , python-pip and python-venv using your distro package manager ( they may be called python3 or some variation for your linux distro)

  1. Open terminal type screen -S ytdlp2STRMthen as root by sudo su

  2. cd /opt && git clone https://github.com/fe80Grau/ytdlp2STRM.git

  3. pyhton -m venv ytdlp2STRM

  4. cd ytdlp2STRMsudo nano /etc/systemd/system/ytdlp2strm.service

  5. source bin/activate

  6. pip install -r requierments.txt

  7. python main.py

Your service should be running now to make it run in background press Ctrl+A and then Ctrl+D this will detach your screen session from terminal now you can close terminal.

To stop the service or see logs you can reattach to it by running screen -r ytdlp2STRM and then use Ctrl+C

Automation

If you want this to activate automatically after reboot few more steps would be required , first stop the service by following above instruction then sudo nano /etc/systemd/system/ytdlp2strm.service paste this.

 [Unit]
Description=ytdlp2STRM Service
After=network-online.target

[Service]
WorkingDirectory=/opt/ytdlp2STRM
Type=simple
ExecStart=/opt/ytdlp2STRM/bin/python /opt/ytdlp2STRM/main.py
Restart=always
RestartSec=10

[Install]
WantedBy=default.target

Press Ctrl+S and then Ctrl+X sudo systemctl enable --now ytdlp2strm Now check if it running correctly with sudo systemctl status ytdlp2strm it should show running (Active) . Now Setup is complete visit http://127.0.0.1:5000 to configure further

Removal

sudo systemctl disable ytdlp2strm && sudo systemctl stop ytdlp2strm && sudo rm /etc/systemd/system/ytdlp2strm.service && sudo rm -rf /opt/ytdlp2STRM