Automated python funscript generator help with installing

Hi
i am not used to Github. But i would really like to try this software : honato / Funscript generator · GitLab
Could someone smarter than me take 4 minutes and dumb it down to an idiots level on how to install it.

Step by step would be nice.
Maybe its the difficult english words i dont understand or maybe i am just stupid.so please dont use to fancy technical words.

Thanks in advance

what is your operating system

hmm…? Windows noob edition xD like me :joy:

1 Like

If on windows and you can use WSL it will significantly increase the odds you get this to work.

if you want to use windows you will need to download miniconda 3

  • hold windows key tap r type powershell hit enter
  • paste each line in one by one
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -o miniconda.exe
start /wait "" miniconda.exe /S
del miniconda.exe
  • if you get an error its probably because you dont have curl. google how to download and install curl
  • it could also be the execution policy. thats the case then copy and paste this into the powershell window
Set-ExecutionPolicy RemoteSigned
  • once thats done open windows search

  • search for environment variables.
    click the env variables button, highlight path then click edit
    image

  • Youll see in my screenshot below i have the paths to specific conda folders. You need to find those same folder paths on your system and add them here. If this part is confusing and you need more help just google how to add conda to PATH

Once this is done close out of all those windows and open up a windows terminal. — -

  • windows key plus r type cmd hit enter

in the terminal type

conda
  • If this doesnt come back with anything you failed to put it on PATH. Punish yourself. When youre done punishing yourself then go back and try again

  • make a folder on your desktop and name it “generator”

  • open the generator folder

  • in the windows file explorer address bar type

cmd

then hit enter. this will open a terminal in the “generator” folder.
in the terminal type:

git clone https://gitlab.com/honato/funscript-generator.git

If you get an error its probably because you dont have git. Google “how to download and install git on windows 10/11”

once thats done
type this in the same terminal

cd funscript-generator

then type the following line by line as you need:

conda create --name gen python==3.10
yes
conda activate gen

you should now see this on the terminal. (gen) means youre in an activated virtual environment named “gen”

(gen)C:\users\yourname\desktop\generator:

If so then type:

conda install pyopencl

When that is done you need to

  • open the generator folder in file explorer and open the file thats named ‘requirements.txt’.
  • Delete the line that says ‘pyopencl’.
  • file and save
    The resulting requirements.txt file should be this:
opencv-python
numpy
tqdm
scipy
gradio
imutils==0.5.4

back in the terminal type

pip install -r requirements.txt

This should finish WITHOUT ERROR. If you get an error its because you most likely need cuda toolkit and or a c/cpp compiler. Cuda toolkit isnt too bad but if its a c compiler, I am not willing to help a beginner install that for no compensation, it would take all day and i’d end up wanting to kill you.

Anyways if it finishes then congrats you’re done. to run it you can enter python funscript_gui.py in the same terminal.

Later on to run it you need to:
enter a terminal in the generator folder
make sure the “gen” conda env is activated

conda activate gen

then type

 python funscript_gui.py

that should open the ui, which looks like this on my machine:

Hi

When i try to insert the start wait “” miniconda etc

i get this message

Start-Process : Cannot validate argument on parameter ‘ArgumentList’. The argument is null or empty. Provide an argumen
t that is not null or empty, and then try the command again.
At line:1 char:13

  • start /wait “” miniconda.exe /S

when i try to insert Set-ExecutionPolicy RemoteSigned

11:27

It says acces denied to registrykey HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsof
t.PowerShell nekas. To change the execution policy for the default (LocalMachine) scope, start Windows PowerShell with
the “Run as administrator” option. To change the execution policy for the current user, run “Set-ExecutionPolicy -Scope
CurrentUser”.

Showing all messages

windows key tap r type powershell hold control + shift then hit enter

now youre in admin powershell and try to execute the commands

you can also install miniconda3 through this link https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe

youll still need to verify the PATH though as it sometimes just doesnt do it

you may also need to install windows terminal. This might be why you cant execute the second line.

in microsoft store download windows terminal. then open it with windows key tap r type wt hit enter

Thank you, I consider myself a noob and it took all day but I got it all working. Do you think it’s slower or better to generate the Debug video or is it just a nice to have?

Hi. The debug video just shows the tracking really. Which with the new version looks pretty damn neat to me at least. If you ever played a virtualboy before you will recognize it instantly. the documentation for the project sucks currently so I would suggest using the gui.py for launching. it has (I believe ;-.- ) all the configurable options on it now. yesterday is a bit hazy so I may have forgotten some stuff.

Generating it does slow down the script by quite a bit and it’s not really needed unless you intend to mess with the script.the settings in the gui only effect the funscript generation portion and not the tracking so it will be the same regardless.

1 Like

Hi. Thank you for giving them a hand. I will say though ana/mini/conda tends to cause more problems than it’s worth in my experience. some packages just refuse to work. a straight python venv handles the job a lot easier and faster though conda does have the perk of being able to call the env from anywhere.

For anyone else who finds this thread and needs some help a more direct approach would be to download and install python 3.10

Install it and follow elevens guide for setting up the path variable. close and reopen your terminal and type python --version if it comes back with 3.10 you’re good to go. If not then you probably need to double check that the path is pointing to the proper location.
From there navigate to the folder where you want to have the script set up at.

Once you’re there click on your address bar in explorer and type cmd and hit enter. This will open a terminal in the current directory. If you have git installed you can run the command

git clone honato / Funscript generator · GitLab
If you don’t have git you can download the zip where you want it. Directory structure matters though so make sure they are unzipped correctly.
that will make a new directory with the project files.
cd funscript-generator
Now you can make a venv (virtual environment. pretty much an isolated environment. This helps a lot with package conflicts and such.)
python -m venv venv (if you have more than one version of python installed try python3.10 -m venv venv)

venv\scripts\activate
This will activate the enviroment and you can now install the requirements.

pip install -r requirements.txt

After that finishes you should be good to go.
py main.py (input video) (output directory) --(any args you want to try)
I would suggest using the gui though.

py gui.py

that will give you a link to open up (it’s on your local system only.) and you should be good to go.

edit: Oh and if things aren’t working right please report it on the main thread. Suggestions for improvements and bug reports are welcome.

Not only do I heavily disagree about your opinion with conda, you can call the env from anywhere with conda or venv, but also your solution, in this instance, doesn’t work.

You’re probably not aware of this because youre using linux or a Mac. On a windows system the package “pyopencl” doesn’t want to play nicely with pip.

After trying a few different versions of python. I decided I didnt want to go down the python dependency chasing rabbit hole and just used conda which was a direct install without any hiccups. This is the simplest solution for the time being.

Hi again
I am very greatful for your patience and knowledge.
I have come i bit closer to a sulotion but have somer errors

I can not find Library\mingw-w64\bin
i can not find Library\usr\bin

i found and added the other 3

everything else worked until the last action

I wrote conda activate gen. no problem
then i wrote python funscript_gui.py and this error comes up

python: can’t open file ‘C:\Users\durra\Desktop\Generator\funscript_gui.py’: [Errno 2] No such file or directory

But i clearly have the file in my folder

That’s weird then because I’m on windows running through a py venv. I made a new venv to test it and it worked fine.

pip freeze pips.txt
colorama==0.4.6
numpy==2.1.0
opencv-python==4.10.0.84
platformdirs==4.2.2
pyopencl==2024.2.7
pytools==2024.1.13
scipy==1.14.1
tqdm==4.66.5
typing_extensions==4.12.2
py --version
Python 3.10.11

What version of python are you using? The only other thing I could think of that might be why it’s working for me and not others would be compilers but it isn’t building it so that wouldn’t make sense.
If I ever figure out docker i’ll put it up there so nothing can break between systems.

It may sound silly but open up the terminal and go to the directory with the script and enter dir please. post the output please. You can send it in a message if you would like.

mingw is a cpp compiler. which you may be able to get lucky and pip install it.

I would highly suggest watching a video on how to install that. as it can be deceptively difficult

If the terminal/system cant find that file make sure the terminal is in the same directory as said file. hence the dir command suggestion. if it isnt move the terminal into that same folder and try again.

hello again
this is the error message i received when i inserted “python funscript_gui.py”

File “C:\Users\durra\Desktop\generator\funscript_gui.py”, line 2, in
from Funscript import run_script
ModuleNotFoundError: No module named 'Funscript

My directory looks like this:

Directory of C:\Users\durra\Desktop\generator

2024-08-26 10:27 .
2024-08-26 10:18 …
2024-08-26 10:23 funscript
2024-08-26 10:23 4 079 funscript_gui.py
2024-08-26 10:23 5 616 Gui.py
2024-08-26 10:23 3 357 main.py
2024-08-26 10:23 pytorch edition
2024-08-26 10:23 3 636 README.md
2024-08-26 10:30 59 requirements.txt
2024-08-26 10:23 video_processing
5 File(s) 16 747 bytes
5 Dir(s) 877 002 739 712 bytes free

when you share tracebacks if you can share the entire terminal in a txt thatd help. it looks like youre not in an activate envionment

conda activate gen

cancel that. it looks like he updated the repo and broke the code. I can fix it one sec

replace your main.py with this. Make sure to change its extension from txt to .py
main.txt (3.3 KB)

then replace funscript_gui.py with this
funscript_gui.txt (4.0 KB)

If you dont want to do that then you will need to open your own main.py copy and paste this over the top of lines 1-12

import argparse
from video_processing.motion_extraction import extract_motion_vectors_opencv
from funscript.processor import process_motion_data
from funscript.generator import create_funscript
from imutils import check_opencv_version
import os
import cv2
os.environ['PYOPENCL_COMPILER_OUTPUT'] = '1'

def run_script(input_video, output_folder, reduction_factor, generate_debug=False, invert=False, look_ahead=2, timing_offset=0, amplification=1):
    check_opencv_version()

then in funscript_gui.py you need to change line 2 from
from Funscript import run_script
to

from main import run_script

then save it and run the command again python funscript_gui.py

When i do this i get this message

(gen) C:\Users\durra\Desktop\generator>python funscript_gui.py
Traceback (most recent call last):
File “C:\Users\durra\Desktop\generator\funscript_gui.py”, line 2, in
from main import run_script
File “C:\Users\durra\Desktop\generator\main.py”, line 2, in
from video_processing.motion_extraction import extract_motion_vectors_opencv
File “C:\Users\durra\Desktop\generator\video_processing\motion_extraction.py”, line 3, in
import pyopencl as cl
ModuleNotFoundError: No module named 'pyopencl

Try this
conda install conda-forge::pyopencl
then run the gui.py script. not funscript_gui.py

what exactly do i write to run gui.py script?

i wrote python gui.py

and got this message

(gen) C:\Users\durra\Desktop\generator> python gui.py
ImportError: DLL load failed while importing multiarray_umath: Det går inte att hitta den angivna modulen.
Traceback (most recent call last):
File “C:\Users\durra\Desktop\generator\gui.py”, line 1, in
import gradio as gr
File "C:\Users\durra\miniconda3\envs\gen\lib\site-packages\gradio_init
.py", line 3, in
import gradio.simple_templates
File "C:\Users\durra\miniconda3\envs\gen\lib\site-packages\gradio_simple_templates_init
.py", line 1, in
from .simpledropdown import SimpleDropdown
File “C:\Users\durra\miniconda3\envs\gen\lib\site-packages\gradio_simple_templates\simpledropdown.py”, line 6, in
from gradio.components.base import Component, FormComponent
File “C:\Users\durra\miniconda3\envs\gen\lib\site-packages\gradio\components_init_.py”, line 40, in
from gradio.components.native_plot import BarPlot, LinePlot, NativePlot, ScatterPlot
File “C:\Users\durra\miniconda3\envs\gen\lib\site-packages\gradio\components\native_plot.py”, line 16, in
import pandas as pd
File “C:\Users\durra\miniconda3\envs\gen\lib\site-packages\pandas_init_.py”, line 62, in
from pandas.core.api import (
File “C:\Users\durra\miniconda3\envs\gen\lib\site-packages\pandas\core\api.py”, line 1, in
from pandas.libs import (
File "C:\Users\durra\miniconda3\envs\gen\lib\site-packages\pandas_libs_init
.py", line 17, in
import pandas._libs.pandas_datetime # noqa: F401 # isort: skip # type: ignore[reportUnusedImport]
ImportError: numpy._core.multiarray failed to import