running from source
I write the client and server entirely in python, which can run straight from source. It is not simple to get hydrus running this way, but if none of the built packages work for you (for instance you use a non-Ubuntu-compatible flavour of Linux), it may be the only way you can get the program to run. Also, if you have a general interest in exploring the code or wish to otherwise modify the program, you will obviously need to do this stuff.
a quick note about Linux flavours
I often point people here when they are running non-Ubuntu flavours of Linux and cannot run my build. One Debian user mentioned that he had an error like this:
- ImportError: /home/user/hydrus/libX11.so.6: undefined symbol: xcb_poll_for_reply64
But that by simply deleting the libX11.so.6 file in the hydrus install directory, he was able to boot. I presume this meant my hydrus build was then relying on his local libX11.so, which happened to have better API compatibility. If you receive a similar error, you might like to try the same sort of thing. Let me know if you discover anything!
what you will need
You will need basic python experience, python 3.x and a number of python modules. Most of it you can get through pip.
If you are on Linux or OS X, or if you are on Windows and have an existing python you do not want to stomp all over with new modules, I recommend you create a virtual environment:
Note, if you are on Linux, it may be easier to use your package manager instead of messing around with venv. A user has written a great summary with all needed packages here.
Also, trying to get wx working in a virtual environment on OS X can be a mega-pain. TBH, if you want to run the client from source on OS X, it is a lot easier to just pip-install to your OS X's python (if that isn't a conflict with what else you are doing).
Nonetheless, if you do want to create a new venv environment:
- (navigate to your hydrus extract folder)
- pip3 install virtualenv (if you need it)
- mkdir venv
- virtualenv venv
- . venv/bin/activate
That '. venv/bin/activate' line turns your venv on, and will be needed every time you run the client.pyw/server.py files. You can easily tuck it into a launch script.
After that, you can go nuts with pip. I think this will do for most systems:
- pip3 install beautifulsoup4 chardet html5lib lxml nose numpy opencv-python six Pillow psutil PyOpenSSL PyYAML requests Send2Trash service_identity twisted
You may want to do all that in smaller batches.
And optionally, you can add these packages:
- lz4 - for some memory compression in the client
- pylzma - for importing rare ZWS swf files
- pysocks - for socks4/socks5 proxy support (although you may want to try "requests[socks]" instead)
- matplotlib - for some bandwidth graph drawing
- mock httmock pyinstaller - if you want to run test.py and make a build yourself
Depending on your OS, you might need something else. Ultimately, the best way to figure out if you have enough for hydrus is to just keep running client.pyw and see what it complains about missing. If you are not familiar with pip and get an error about a library already existing, know that you update an existing library with the --upgrade switch, like so:
- pip3 install --upgrade libraryname
For Windows, depending on which compiler you are using, pip can have problems building some modules like lz4 and lxml. This page has a lot of prebuilt binaries--I have found it very helpful many times. You may want to update python's sqlite3.dll as well--you can get it here, and just drop it in C:\Python37\DLLs or wherever you have python installed. I have a fair bit of experience with Windows python, so send me a mail if you need help.
You will also need wxPython 4.0. This can be simple or complicated. For Windows and OS X, just get it with pip like the rest:
- pip3 install wxPython
If you run Linux, getting wxPython from pip needs a build, which in my experience is a time-consuming and frequently failing pain. Here is their page on it.
They have some wheels for common distros here, which I highly recommend trying before you attempt to build. Even if your distro is not listed, try one that looks similar. On Ubuntu 16.04, I had more luck with the gtk2 build. You'll be running a command like:
- pip3 install -f https://extras.wxpython.org/wxPython4/extras/linux/gtk2/ubuntu-16.04 wxPython
Even with a wheel, you might need some additional dependencies. In my different attempts to build or just get the wheel going, I needed one or more of these:
- sudo apt-get install libsdl1.2-dev libwebkitgtk3.0 libwebkitgtk3.0-dev gstreamer-1.0 libgstreamer-plugins-base1.0-dev v4l-utils freeglut3-dev libgtk-3-dev libglw1-mesa libglw1-mesa-dev python-dev
I think the wheel might only need libsdl1.2-dev on Ubuntu 16.04, but your situation may be different. Again, this was a pain to figure out, so good luck!
YMMV. Feel free to email me if you run into trouble or discover any neat tricks.
If you don't have ffmpeg in your PATH and you want to import videos, you will need to put a static FFMPEG executable in the install_dir/bin directory. Have a look at how I do it in the extractable compiled releases if you can't figure it out. On Windows, you can copy the exe from one of those releases, or just download the latest static build right from the FFMPEG site.
Once you have everything set up, client.pyw and server.py should look for and run off client.db and server.db just like the executables. They will look in the 'db' directory by default, or anywhere you point them with the "-d" parameter, just like the executables.
I develop hydrus on and am most experienced with Windows, so the program is much more stable and reasonable on that. I do not have as much experience with Linux or OS X, so I would particularly appreciate your Linux/OS X bug reports and any informed suggestions.
Unlike most software people, I am more INFJ than INTP/J. My coding style is unusual and unprofessional, and everything is pretty much hacked together. Please look through the source if you are interested in how things work and ask me if you don't understand something. I'm constantly throwing new code together and then cleaning and overhauling it down the line.
I work strictly alone, so while I am very interested in detailed bug reports or suggestions for good libraries to use, I am not looking for pull requests. Everything I do is WTFPL, so feel free to fork and play around with things on your end as much as you like.