Plex Remote Transcoder - A distributed transcoding backend for Plex

I did it all manually as you typed out above (replacing token of course) and here are the error messages:
Could not find platform independent libraries
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to [:<exec_prefix>]
ImportError: No module named site

@boboki said:
I did it all manually as you typed out above (replacing token of course) and here are the error messages:
Could not find platform independent libraries
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to [:<exec_prefix>]
ImportError: No module named site

Those errors are due to python not being able to find the correct libraries. As a regular user, what do you get when you run the following?

python -c "import sys; print sys.path"

How about when you are the plex user?

The returns:

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site

@boboki said:
The returns:

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site

Something is messed up with your Python setup. Where you able to install PRT before on this machine? Try resetting the environmental variables used by Python and rerun the above command.

unset PYTHONPATH
unset PYTHONHOME

Also, it might be easier to fix this issue if you hop on the chat to work through the problem.

Yeah, this was a machine I loaded fresh, installed python then prt like the guide says. This has nothing else on it at all fresh build. Same error after doing the unset commands.

@boboki said:
Yeah, this was a machine I loaded fresh, installed python then prt like the guide says. This has nothing else on it at all fresh build. Same error after doing the unset commands.

Sounds like something is messed up with Python on that system. You can see here that the error ImportError: No module named site stems from Python being unable to find the necessary libraries.

Well, I have tried changing to Python 3.4, no luck, 2.7, no luck. I pointed the PYTHONHOME and PYTHONPATH to /usr/lib64python3.4 and 2.7 and they give me different errors each time.

2.7 gives me:

bash: export: `Support/Plex': not a valid identifier
bash: export: `Server/Cache/': not a valid identifier
bash: export: `Support/Plex\': not a valid identifier
bash: export: `Media\': not a valid identifier
bash: export: `Server/Codecs/ecd8c57-1099-linux-ubuntu-x86_64/': not a valid identifier
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site.py", line 564, in <module>
    main()
  File "/usr/lib64/python2.7/site.py", line 546, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/lib64/python2.7/site.py", line 276, in addusersitepackages
    user_site = getusersitepackages(kind)
  File "/usr/lib64/python2.7/site.py", line 244, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/usr/lib64/python2.7/site.py", line 230, in getuserbase
    from sysconfig import get_config_var
  File "/usr/lib64/python2.7/sysconfig.py", line 10, in <module>
    'stdlib': '{base}/'+sys.lib+'/python{py_version_short}',
AttributeError: 'module' object has no attribute 'lib'

and 3.4 gives me:

bash: export: `Support/Plex': not a valid identifier
bash: export: `Server/Cache/': not a valid identifier
bash: export: `Support/Plex\': not a valid identifier
bash: export: `Media\': not a valid identifier
bash: export: `Server/Codecs/ecd8c57-1099-linux-ubuntu-x86_64/': not a valid identifier
  File "/usr/lib64/python3.4/site.py", line 176
    file=sys.stderr)
        ^
SyntaxError: invalid syntax

Not exactly sure where to go from here.

@boboki said:
Well, I have tried changing to Python 3.4, no luck, 2.7, no luck. I pointed the PYTHONHOME and PYTHONPATH to /usr/lib64python3.4 and 2.7 and they give me different errors each time.

Python 3.x is not supported, so stick to 2.7. Sounds to me like your python setup is totally messed up. You might try setting the PYTHONPATH to /usr/lib64/python2.7 and /usr/lib/python2.7:

export PYTHONPATH=/usr/lib/python2.7/dist-packages:/usr/lib/python2.7/site-packages:/usr/lib64/python2.7/dist-packages:/usr/lib64/python2.7/site-packages

If you still can’t get it working, you might be better off just cutting your losses and either reinstalling or switching to a Debian based distro.

Meh, to heck with it. I’ll rebuild the box tonight with probably debian or ubuntu, any preference to most compatibility? I can see opensuse being pretty awesome for other server based stuff, but it seems pretty weak thus far for playing around it looks like. I’ll report back after I rebuild and redeploy the transcode box, hopefully I’ll have better news then. Thanks a ton for sticking it out with me trying to figure out wth is wrong with this, it shows a great deal of how much you care about your project!

Do we know if this is working with the latest plex pass release 1.0.2.2413?

Ok, I am starting to have a little doubt with this being all correct. I just completely reloaded that server using Debian 8.5. Recreated everything from scratch, loaded the prt and followed the standard walkthrough… and did a transcode which failed. I copied and pasted the prt log command as we have above and I got the error message:

bash: export: `Support/Plex': not a valid identifier
bash: export: `Server/Cache/': not a valid identifier
bash: export: `Support/Plex\': not a valid identifier
bash: export: `Media\': not a valid identifier
bash: export: `Server/Codecs/ecd8c57-1099-linux-ubuntu-x86_64/': not a valid identifier
bash: cd: /opt/plex/tmp/plex-transcode-4kzym0nvydk9qy1xt7qu5zh0k9-71f960ad-a437-4b71-a797-30e06426f1ba: No such file or directory
Traceback (most recent call last):
  File "/usr/lib/plexmediaserver/Resources/plex_transcoder", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2876, in <module>
    working_set = WorkingSet._build_master()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 451, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 464, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 639, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: prt==0.3.2

There is something very obviously more going on than just a random bad install here. The same exact error messages with the export not valid identifiers are still occurring, and resource.py issues from before have carried over with a totally new OS and load. Looking forward to your next suggestions.

Guess I will reload both boxes 100% fresh. What Linux build/ver should I use to have best compatibility with your releases?

@boboki said:
Guess I will reload both boxes 100% fresh. What Linux build/ver should I use to have best compatibility with your releases?

I’m running out of ideas as to what the issue is here. Something is clearly messed up because the commands aren’t even being escaped correctly.

If you’re gonna start fresh, I’ve tested everything on Ubuntu 14.x.

Sounds like a plan, I’ll reload both boxes with 14.x and try it again later today/tomorrow. Hopefully all will go well :wink:

guys I supose any of you know about my automatization of PRT, it’s fully automated you only need to run 2 dockers.
Use Cloud computing power to transcode on demand.
The app automatic initialize transcoder in the cloud. So you don’t need to have the infraestructure previously. it will be scale up depend of the demand.
https://hub.docker.com/r/segator/plex/
It’s compatible with the new Plex.

P.D:It’s based on wnielson idea, thanks

Such interesting topic here!

So, to offload my ā€˜master’ Plex server (4C/8T Xeon E3-1270, Ubuntu 16.04 LTS), i made an ā€˜slave’ VM, 4C/4T on a 32C/64T ESX5i server, installed Ubuntu 14.04.4 LTS, and followed all the steps on the guide. After a false start (key based authentication had some problems, but got it fixed), it seems working well. When i remotely play a video, i see the CPU usage of the slave skyrocketing to +/- 70% on all 4 cores for the first 20 seconds.
However, when i start a second transcoding video, the CPU usage on the ā€˜master’ stays at 0%, and the slave get to 4 times 100%. A third vid, 4 vids, even on 5 concurrent transcode sessions, the master CPU stays at 0%, slave at 4x100% and the video starts lagging on all Chrome/Firefox sessions.
So i assume, the load balancing isn’t working here at all. Any advise how to diagnose the problem, and how to fix it ? Are there any tweaks available in the loadbalancer, ie. prioritize the master CPU first, etc.etc. ?

@Madshark said:
So i assume, the load balancing isn’t working here at all. Any advise how to diagnose the problem, and how to fix it ? Are there any tweaks available in the loadbalancer, ie. prioritize the master CPU first, etc.etc. ?

Did you add the master as a transcode target? By default it isn’t added.

@wnielson said:

@Madshark said:
So i assume, the load balancing isn’t working here at all. Any advise how to diagnose the problem, and how to fix it ? Are there any tweaks available in the loadbalancer, ie. prioritize the master CPU first, etc.etc. ?

Did you add the master as a transcode target? By default it isn’t added.

Ehh… i exactly followed the instructions as on Ubuntu Install Ā· wnielson/Plex-Remote-Transcoder Wiki Ā· GitHub .
I guess i haven’t added the ā€˜master’ as transcode target then ?

Btw, when i shutdown the VM, the clients will brief stop playback after a minute. When resuming the playback, the ā€˜master’ is going using its CPU again.

@Madshark

By default, the master is only considered for a transcode session if it has either a) been explicitly added as a transcode slave or b) there are no available transcode slaves. So, if you add the master (via prt add) then it will be considered for transcode sessions and will be the default when no other slaves are available.

WOOOO so I reloaded all the test boxes and was able to successfully get them working finally, same steps, same everything. Looks like this works just fine with Ubuntu 14.4. After testing I went ahead and moved it over to my prod box. It seems to be working just fine on prod too. My only issue right now is prt sessions asks for a login and password for plex I think and that is bombing. Does not seem to matter what I put in I get:

Error getting auth token...invalid credentials?

Be that the plex account (with or without a password) or the root.

edit lol I am an idiot. That is my plex username and password on plex.tv… not on the host. Working now.

What top program are you using in the pictures at Improvements & Additional Features Ā· wnielson/Plex-Remote-Transcoder Wiki Ā· GitHub ? I really like it.

edit ahh it is htop, awesome, one more tool for my abuse :wink: I now have three transcoders rolling and it seems all is working pretty well.