Skip to content

Instantly share code, notes, and snippets.

@jufogu
Created November 24, 2022 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jufogu/b78509695c6c65cdb2866a56fb14a820 to your computer and use it in GitHub Desktop.
Save jufogu/b78509695c6c65cdb2866a56fb14a820 to your computer and use it in GitHub Desktop.
Hydrus in Anaconda

Hydrus in Anaconda

Running Hydrus from source (git) in the main Anaconda environment.

Install Chocolatey and Anaconda

Note: can also install anaconda manually, instead.

In an administrator powershell:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Restart the shell, probably.

choco install anaconda

Install dependencies

In administrator anaconda powershell prompt:

conda install   cryptography python-dateutil beautifulsoup4 chardet lxml lz4 numpy psutil pyOpenSSL PySocks PyYAML Send2Trash service_identity Twisted requests   # likely already installed
conda install   html5lib   # okay dependencies available in conda
conda install   pyqt5-sip   # tricky, might be useless
pip install -U  cbor2 cloudscraper python-mpv   # just some stuff not in conda
pip install -U  opencv-python Pillow   # can also use opencv-python-headless   # heavy binary stuff
pip install -U  pyqt5   # ?+ pyqt5-qt5 ?+ qtpy   # break stuff
# To consider, instead of pyqt5:
#   pip install -U PySide6

Get mpv-2.dll, likely from mpv-dev-x86_64-v3-...: mpvnet-player/mpv.net#469 and put it here.

Fix sqlite3 fts4

Check (before and after):

python -c "import sqlite3 as m; c = m.connect(':memory:'); res = c.execute('select 1'); print(res.fetchall()); res = c.execute('create virtual table tst1 using fts4()'); print(res)"`

Get the sqlite library (and CLI along the way):

choco install sqlite sqlite.shell

Replace the anaconda's sqlite dll:

cp c:\ProgramData\chocolatey\lib\SQLite\tools\sqlite3.dll  c:\tools\Anaconda3\Library\bin\sqlite3.dll

Run

Put in a hydrus_client.cmd script:

REM %windir%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy ByPass -NoExit -Command "& 'C:\tools\Anaconda3\shell\condabin\conda-hook.ps1' ; conda activate 'C:\tools\Anaconda3' "
REM c:\tools\Anaconda3\Scripts\activate.bat C:\tools\Anaconda3
@CALL "c:\tools\Anaconda3\condabin\conda.bat" activate
cd c:\hydrus\hydrus\
C:\tools\Anaconda3\python.exe c:\hydrus\hydrus\client.py
pause

Packages debug

In a cygwin shell:

( /c/tools/Anaconda3/Scripts/conda.exe list; /c/tools/Anaconda3/Scripts/pip3.exe freeze; ) | grep -i qt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment