Forums

Can't find shared object file

Ok, so I've pip3..6 install --user PyQt5 , which seems to install ok, but my python pgm which runs ok on my local machine fails with this

"/home/Donquixote2u/.local/lib/python3.6/site-packages/PyQt5/Qt/libexec/QtWebEngineProcess: error while loading shared libraries: libQt5WebEngineCore.so.5: cannot open shared object file: No such file or directory"

yet that file seems to have been installed; (in /home/Donquixote2u/.local/lib/python3.6/site-packages/PyQt5/Qt/lib)

is there something I need to do to the environment?

Hi there- PythonAnywhere runs in a server (display-less) environment, so stuff like QT will usually fail. What are you trying to do with the QT library?

I am using pyvirtualdisplay so that the script should run in batch mode; heres the code

    ## webkit scraper vsn 3 14/9/17  - works in cli mode, redirect output to file
## example: python3 GetPage.py "http://www.mypage.php" > mypage.html
import sys
from pyvirtualdisplay import Display
from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebEngineWidgets import QWebEngineView

class Render(QWebEngineView):
        def __init__(self):
                self.html = None
                QWebEngineView.__init__(self)
                self.loadFinished.connect(self._loadFinished)

        def _loadFinished(self, result):
            # This is an async call, you need to wait for this
            # to be called before closing the app
            self.page().toHtml(self.callable)

        def callable(self, data):
            self.html = data
            # Data has been stored, it's safe to quit the app
            print(self.html)
            sys.exit()

if __name__ == '__main__':
        ## set up virtual display to receive webengine output if run in batch mode
        display = Display(visible=0, size=(800, 600))
        display.start()
        app = QApplication(sys.argv)
        url=app.arguments()[1]
        if(url):    ## get url from passed args
                view = Render()
                view.load(QUrl(url))
                app.exec_()

and when I try to run in a bash shell I get the following;

11:30 ~ $ python3.6 mysite/GetPage.py http://www.xe.com/currency/nzd-new-zealand-dollar > xe.html QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-Donquixote2u' /home/Donquixote2u/.local/lib/python3.6/site-packages/PyQt5/Qt/libexec/QtWebEngineProcess: error while loading shared libraries: libQt5WebEngin eCore.so.5: cannot open shared object file: No such file or directory [14849:14849:0915/113222.163515:ERROR:child_process_launcher.cc(522)] Failed to launch child process

any ideas?

It sounds like there is a shared library that you don't have.

Also take a look at this about versions of QT and exporting env variables.

Another thing to double check: do you even have QT installed? Or did your pip install etc finish with errors?

ok, to answer that last question first and add more; I dropped back to python 3.5 (from3.6) and got the same error; PyQt5 v 5.9 said installed ok

so based on that link you gave me and others saying similar, I tried

export LD_LIBRARY_PATH=/home/Donquixote2u/.local/lib/python3.5/site-packages/PyQt5/Qt/lib

(which is where I can see libQt5WebEngineCore.so.5 actually is)

now it crash dumped on me

python3.5 GetPage.py http://www.xe.com/currency/nzd-new-zealand-dollar QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-Donquixote2u' [13263:13263:0918/040623.705832:ERROR:stack_trace_posix.cc(577)] Failed to read /proc/self/maps [13246:13271:0918/040624.066209:ERROR:zygote_host_impl_linux.cc(277)] Failed to adjust OOM score of renderer with pid 13282: No such file or directory [13282:13282:0918/040624.069873:FATAL:thread_helpers.cc(41)] Check failed: 0 == fstat_ret. : No such file or directory

I guess that's progress of sorts. Now I know Qtwebengine 5.9 runs with python 3.5 on my Debian Sid machine (4.9 kernel), so the environments aren't too far apart.

I might try python 3.6 again with that env. var set. - watch this space. Thanks for the help so far.

That looks like something in there requires parts of the proc pseudo-filesystem that our virtualization does not provide. That may be something that would be resolved by switching to Docker consoles, but that has other issues: https://blog.pythonanywhere.com/119/

yeah, going back to python 3.6 didn't help; and Docker not allowing webapps or scheduled tasks is a bit of a dealbreaker on that option, even if it did work.

just FYI I am doing a parallel test on Google Compute Engine; It's not nearly as tidy an IDE as Pythonanywhere, but it does give me a few more strings to my bow; their Debian 9 base didn't want to install Qt5 for some reason, but my code ran under Ubuntu 17 ; the only diff from my own Debian machine was that I needed to install xvfb; now all I have to do is work out how to create a webapp on it (it's a shit of an environment really, does life need to be quite that complicated?)

Clearly I could also achieve something similar on Pythonanywhere with Selenium + firefox, yada yada, but that's a path I don't want to go down for now, as I believe qtwebengine will offer me a tighter solution.

I'll put this in the "too hard" basket for now, but keep an eye on Pythonanywhere in future.

understood. good luck, and hope to see you around!