Jaded-Encoding-Thaumaturgy / vs-preview

Previewer for VapourSynth scripts.
Apache License 2.0
57 stars 16 forks source link

How to use this with a portable Vapoursynth? (PyQt library location) #120

Closed Selur closed 8 months ago

Selur commented 8 months ago

I'm using portable Vapoursynth R65-RC1, my python311._pth contains:

Scripts
Lib\site-packages
python311.zip
.
# Uncomment to run site.main() automatically
#import site

I installed vspreview using:

python -m pip install vspreview

which downloaded the files, and created a vspreview.exe inside the Scripts folder. When calling:

Scripts\vspreview.exe
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "F:\Hybrid\64bit\Vapoursynth\Scripts\vspreview.exe\__main__.py", line 4, in <module>
  File "F:\Hybrid\64bit\Vapoursynth\Lib\site-packages\vspreview\__init__.py", line 1, in <module>
    from . import qt_patch  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^
  File "F:\Hybrid\64bit\Vapoursynth\Lib\site-packages\vspreview\qt_patch.py", line 1, in <module>
    from PyQt6.QtCore import Qt
ImportError: DLL load failed while importing QtCore: Die angegebene Prozedur wurde nicht gefunden.

How can I tell vspreview where to look for the Qt libraries? (They got installed in the Vapoursynth\Lib\site-packages\PyQt6\Qt6\bin-folder)

Setsugennoao commented 8 months ago

Afaik you need to put your portable install in PATH so that it can find python3.dll since qt imports that. It probably is finding a wrong version or none at all and is erroring on that. Can you try putting it in path? If that works i can put the parent path of the current exe/dll in PATH automatically to patch qt for portable installs

Selur commented 8 months ago

Hmm,... I got my portable Python in my Vapoursynth folder:

F:\Hybrid\64bit\Vapoursynth>dir
 Verzeichnis von F:\Hybrid\64bit\Vapoursynth

27.10.2023  19:38    <DIR>          .
27.10.2023  13:35    <DIR>          ..
20.06.2023  10:00         1.841.664 7z.dll
20.06.2023  10:00           557.056 7z.exe
09.10.2023  18:36           154.112 AVFS.exe
02.06.2023  22:02           327.576 concrt140.dll
05.10.2023  18:01    <DIR>          doc
05.10.2023  18:01    <DIR>          iconengines
05.10.2023  18:01    <DIR>          imageformats
05.10.2023  18:01    <DIR>          Lib
05.04.2023  00:03         3.450.648 libcrypto-1_1.dll
05.04.2023  00:03            39.696 libffi-8.dll
05.04.2023  00:03           704.792 libssl-1_1.dll
05.04.2023  00:03            32.768 LICENSE.txt
16.10.2019  22:21                81 MANIFEST.in
02.06.2023  22:02           578.384 msvcp140.dll
02.06.2023  22:02            35.704 msvcp140_1.dll
02.06.2023  22:02           267.160 msvcp140_2.dll
02.06.2023  22:02            50.072 msvcp140_atomic_wait.dll
02.06.2023  22:02            31.640 msvcp140_codecvt_ids.dll
31.01.2023  18:37         1.403.248 pfm-192-vapoursynth-win.exe
05.10.2023  18:01    <DIR>          platforms
09.10.2023  18:37                 0 portable.vs
05.04.2023  00:03           199.440 pyexpat.pyd
05.04.2023  00:03           631.879 python.cat
05.04.2023  00:03           103.192 python.exe
05.04.2023  00:03            67.344 python3.dll
05.04.2023  00:03         5.760.784 python311.dll
05.04.2023  00:04         4.259.124 python311.zip
03.06.2023  22:44               106 python311._pth
18.06.2023  08:02           669.696 pythoncom311.dll
05.04.2023  00:03           101.648 pythonw.exe
18.06.2023  08:02           134.656 pywintypes311.dll
12.12.2022  13:02         5.691.024 Qt6Core.dll
12.12.2022  19:44           835.728 Qt6Core5Compat.dll
12.12.2022  13:02         7.661.200 Qt6Gui.dll
23.09.2022  14:06           726.416 Qt6Multimedia.dll
12.12.2022  13:03         1.408.144 Qt6Network.dll
12.12.2022  16:15           359.056 Qt6Svg.dll
12.12.2022  13:03         6.040.208 Qt6Widgets.dll
22.09.2022  10:59           136.080 Qt6Xml.dll
23.09.2023  21:20             1.950 requirements.txt
27.10.2023  20:08    <DIR>          Scripts
05.10.2023  18:01    <DIR>          sdk
05.04.2023  00:03            30.480 select.pyd
05.08.2023  19:40             3.100 setup.py
05.10.2023  18:01    <DIR>          share
05.04.2023  00:03         1.474.328 sqlite3.dll
26.04.2023  17:41           713.861 tensorrt-8.6.1-cp311-none-win_amd64.whl
05.10.2023  18:01    <DIR>          torch_dependencies
05.04.2023  00:03         1.141.016 unicodedata.pyd
09.10.2023  18:37         1.027.584 vapoursynth.cp311-win_amd64.pyd
09.10.2023  18:37         1.158.144 vapoursynth.cp38-win_amd64.pyd
09.10.2023  18:36         2.182.656 VapourSynth.dll
05.10.2023  18:01    <DIR>          vapoursynth64
27.10.2023  19:38                29 VAPOURSYNTH_VERSION
02.06.2023  22:02           346.008 vccorlib140.dll
02.06.2023  22:02           109.440 vcruntime140.dll
02.06.2023  22:02            49.560 vcruntime140_1.dll
01.02.2023  00:12               348 vs-detect-python.bat
20.05.2023  15:06                 0 vsedit.conf
06.03.2023  17:26               111 vsgenstubs.py
05.10.2023  18:01    <DIR>          vsgenstubs4
09.10.2023  18:36           114.176 VSPipe.exe
06.03.2023  17:26            37.795 vsrepo.py
09.10.2023  18:36            29.696 VSScript.dll
09.10.2023  18:36            29.696 VSScriptPython38.dll
09.10.2023  18:36            90.624 VSVFW.dll
21.01.2023  22:21           957.440 vsViewer.exe
05.04.2023  00:03            31.000 winsound.pyd
05.04.2023  00:03            65.296 _asyncio.pyd
05.04.2023  00:03            84.752 _bz2.pyd
05.04.2023  00:03           123.672 _ctypes.pyd
05.04.2023  00:03           253.200 _decimal.pyd
05.04.2023  00:03           128.280 _elementtree.pyd
05.04.2023  00:03            65.304 _hashlib.pyd
05.04.2023  00:03           159.000 _lzma.pyd
05.04.2023  00:03            44.816 _msi.pyd
05.04.2023  00:03            34.584 _multiprocessing.pyd
05.04.2023  00:03            50.960 _overlapped.pyd
05.04.2023  00:03            32.536 _queue.pyd
05.04.2023  00:03            79.632 _socket.pyd
05.04.2023  00:03           120.080 _sqlite3.pyd
05.04.2023  00:03           161.048 _ssl.pyd
05.04.2023  00:03            25.360 _uuid.pyd
05.04.2023  00:03            44.816 _zoneinfo.pyd
              73 Datei(en),     55.262.704 Bytes
              13 Verzeichnis(se), 3.673.725.743.104 Bytes frei

using:

F:\Hybrid\64bit\Vapoursynth>set PATH=%PATH%;f:\Hybrid\64bit\Vapoursynth

and then

F:\Hybrid\64bit\Vapoursynth>Scripts\vspreview.exe

still fails

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "F:\Hybrid\64bit\Vapoursynth\Scripts\vspreview.exe\__main__.py", line 4, in <module>
  File "F:\Hybrid\64bit\Vapoursynth\Lib\site-packages\vspreview\__init__.py", line 1, in <module>
    from . import qt_patch  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^
  File "F:\Hybrid\64bit\Vapoursynth\Lib\site-packages\vspreview\qt_patch.py", line 1, in <module>
    from PyQt6.QtCore import Qt
ImportError: DLL load failed while importing QtCore: Die angegebene Prozedur wurde nicht gefunden.

echo %PATH% does properly show that f:\Hybrid\64bit\Vapoursynth was added to the PATH.

Setsugennoao commented 8 months ago

i'm talking about the python portable install

Setsugennoao commented 8 months ago

Wait, just noticed you merged both folders... this is a weird install

Selur commented 8 months ago

Yes, that is why I wrote in my first sentence "I got my portable Python in my Vapoursynth folder" ;) It's working and easily portable (for example on an usb stick). :) ¯\(ツ)/¯ for amusement: https://forum.doom9.org/showthread.php?p=1992302#post1992302

Setsugennoao commented 8 months ago

I can reproduce only by removing python3.dll, and have no idea why pyqt can't import it in your setup. if you can give me simple reproduciple steps in a venv i might be able to look further into it.

Despite all of this, it's not an issue with vspreview; most I can do is patch pyqt (if I can at all).

Selur commented 8 months ago

Steps to reproduce with setting up the environment like I have:

No problem, if you can't look into it. I probably can come up with something to get it working, I just hoped you or someone else already was using vspreview in a portable environment and knew that I just needed to change xy to get it working.

Thanks for spending your time on this. :)