BrokenSource / DepthFlow

🌊 Image to → 2.5D Parallax Effect Video. A Free and Open Source ImmersityAI alternative
https://brokensrc.dev
GNU Affero General Public License v3.0
323 stars 21 forks source link

Issue when trying to run Broken Depthflow #8

Closed dey-d closed 7 months ago

dey-d commented 7 months ago

Hi,

First, thanks so much for making this, looks like it's got a lot of potential however I'm unable to get it to run.

I'm getting an AttributeError and Binary doesnt exist or was not foubnd on PATh as shown in the following when trying to run broken depthflow. I've tried both on my M1 Mac and Linux. x86.

Thanks!

ERROR │ ▸ Binary doesn't exist or was not found on PATH (/Users/deepdey/Library/Caches/pypoetry/virtualenvs/depthflow-E2DdtqXj-py3.10/bin/main)

. . .

Users/deepdey/Media_Local/depthflow2/BrokenSource/Broken/main.py )

C++ projects if self.is_cpp: log.error("C++ projects are not supported yet")

Avoid reinstalling on future runs reinstall = False

Detect bad return status, reinstall virtualenv and retry once if (status.returncode != 0) and (not reinstall): log.warning(f"Detected bad Return Status ({status.returncode}) for the Project ({self.name}) at ({self.path})") if self.is_python: log.warning(f"• Python Virtual Environment: ({venv})") log.warning(f"• Command: {tuple(status.args)}")

  Prompt user for action
  import rich.prompt
  answer = rich.prompt.Prompt.ask(
      f"• Action: Run poetry (i)nstall, poetry (l)ock, (r)einstall venv, (e)xit or nothing (enter), then retry",
      choices=["r", "e", "p", "l", ""],

AttributeError: 'NoneType' object has no attribute 'returncode'

Tremeschin commented 7 months ago

This feels like an edge case I didn't think for the manager script

My best guess is that the command poetry install failed to run on the directory Projects/DepthFlow, not creating the execution script at the virtual environment

Interestingly enough, it worked for the monorepo 🧐

You can try opening a terminal on Projects/DepthFlow and running poetry install then poetry run main (depthflow arguments) directly, I can't do much if poetry install is failing

Do you remember if it properly installed // does running directly works?

Thanks for the feedback and testing on Apple Silicon (probably first person to do so) !

dey-d commented 7 months ago

Hey thanks for your response. I think you're right that poetry didnt install properly however looks like torch is failing when I try do that. Will see if I can install torch manually otherwise will have a go to see if I can install on my Windows PC with GPU.

(base) deepdey@M1AIR DepthFlow % poetry install Installing dependencies from lock file

Package operations: 33 installs, 0 updates, 0 removals

• Installing torch (2.0.1+cpu): Failed

RuntimeError

Unable to find installation candidates for torch (2.0.1+cpu)

at /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/poetry/installation/chooser.py:73 in choose_for 69│ 70│ links.append(link) 71│ 72│ if not links: → 73│ raise RuntimeError(f"Unable to find installation candidates for {package}") 74│ 75│ # Get the best link 76│ chosen = max(links, key=lambda link: self._sort_key(package, link)) 77│

Cannot install torch.

Tremeschin commented 7 months ago

I reproduced the original issue to some extent, I'm working on making detection smarter in cases like this when the installation fails mid way without even creating entry point scripts

As for torch failing, PyTorch website just say to use default torch and torchvision but without the /cpu source url, I will add that on as a command depthflow poe mac see below

Both CUDA and this Mac version does not need extra source urls, can you paradoxically try depthflow poe cuda to install the standard torch and torchvision, which should include binaries for mac and running depthflow?

I think it's best to make this cuda+mac standard one the default, and make the cpu version optional

Sidenote: I don't have any Apple hardware to test the code, I'm hoping the situation isn't further bad

Tremeschin commented 7 months ago

Just commited a potential fix to everything, it requires running git pull on the Monorepo, ShaderFlow and DepthFlow

It is automated with broken submodules --pull but there was a command preprocessing error commit fix, you can:

Then retry running DepthFlow, no further depthflow poe command required probably

Thanks for the patience!

dey-d commented 7 months ago

Thank you for looking into this!

On to the next error now, seems to be failing on installing dearpygui.

In the meantime, I was playing around with it Windows PC earlier which was working :)


• Installing dearpygui (1.10.1): Failed

RuntimeError

Unable to find installation candidates for dearpygui (1.10.1)

• Installing audioread (3.0.1) • Installing dearpygui (1.10.1): Failed

RuntimeError

Unable to find installation candidates for dearpygui (1.10.1)

• Installing altair (5.2.0) • Installing audioread (3.0.1) • Installing dearpygui (1.10.1): Failed

RuntimeError

Unable to find installation candidates for dearpygui (1.10.1)

at ~/Library/Caches/pypoetry/virtualenvs/broken-source-VCTKzA0w-py3.10/lib/python3.10/site-packages/poetry/installation/chooser.py:73 in choose_for 69│ 70│ links.append(link) 71│ 72│ if not links: → 73│ raise RuntimeError(f"Unable to find installation candidates for {package}") 74│ 75│ # Get the best link 76│ chosen = max(links, key=lambda link: self._sort_key(package, link)) 77│

Cannot install dearpygui.

• Installing fastapi (0.109.2) • Installing ffmpy (0.3.2) • Installing glfw (2.7.0) • Installing gradio-client (0.10.1) • Installing imageio-ffmpeg (0.4.9) • Installing imgui (2.0.0) • Installing importlib-resources (6.1.1) • Installing matplotlib (3.8.3) • Installing mido (1.3.2) • Installing moderngl-window (2.4.4) • Installing numpy-quaternion (2022.4.4) • Installing opensimplex (0.4.5) • Installing orjson (3.9.15) • Installing pydub (0.25.1) • Installing pygame (2.5.2) • Installing python-multipart (0.0.9) • Installing regex (2023.12.25) • Installing ruff (0.2.2) • Installing safetensors (0.4.2) • Installing semantic-version (2.10.0) • Installing soundcard (0.4.2) • Installing tokenizers (0.15.2) • Installing torchvision (0.15.2) • Installing uvicorn (0.27.1) • Installing broken-source (2024.2.6 /Users/deepdey/Media_Local/depthflow/BrokenSource) │Broken ├┤184246ms├┤ERROR │ ▸ Binary doesn't exist or was not found on PATH (/Users/deepdey/Library/Caches/pypoetry/virtualenvs/depthflow-JimRC-QZ-py3.10/bin/main) │Broken ├┤184247ms├┤WARNING│ ▸ Potential partial installation detected for the Project (DepthFlow), a installation retry is recommended {(r) option} │Broken ├┤184248ms├┤WARNING│ ▸ Detected bad Return Status (1) for the Project (DepthFlow) at (/Users/deepdey/Media_Local/depthflow/BrokenSource/Projects/DepthFlow) │Broken ├┤184248ms├┤WARNING│ ▸ • Python Virtual Environment: (/Users/deepdey/Library/Caches/pypoetry/virtualenvs/depthflow-JimRC-QZ-py3.10) • Action: Run {poetry (i)nstall}, {poetry (l)ock}, {(r)einstall venv}, {(e)xit} or {(enter) nothing}, then retry [r/e/p/l/] (retry):

Tremeschin commented 7 months ago

In the meantime, I was playing around with it Windows PC earlier which was working :)

Great 👍


On to the next error now, seems to be failing on installing dearpygui.

Ah! I don't see Apple Silicon arm64 wheels distributions on PyPI of it yet, but it seems that it's being actively worked on [1] [2]

I'm not using dearpygui at the moment, so I'll remove it from the requirements

Can you run broken submodules --pull and try running depthflow again? I've commited the changes

Tremeschin commented 7 months ago

One note if you'll render video files from the projects

I'm not sure if imageio-ffmpeg's bundle of FFmpeg will install/work, it might use Apple's Rosetta to translate the x86 instructions to ARM, but there's some unwanted overhead. I haven't "automated" or documented enough this

Not sure how familiar the Mac world/you are with Homebrew (would love feedback), can install a native version if needed with:

On Windows you can run winget install ffmpeg (is run automatically by the newer irm (url) | iex installation script), should have winget available on any recent version of W10 and W11

FFprobe is only required if rendering scenes with audio files on ShaderFlow, but it's a nice-to-have nevertheless, for DepthFlow only FFmpeg is required to encode the raw OpenGL rendered frames to a video

dey-d commented 7 months ago

Maybe let's leave it for now, I keep running into new issues and you don't have the hardware to test. I'll use on PC for now.

Excited for what you've got to come on this project, would be cool to see what you future plans are for it? Are you adding to PyPi?

broken-source-py3.10) (base) deepdey@M1AIR BrokenSource % broken depthflow
│DepthFlow ├┤ 3816ms├┤INFO │ ▸ _ ____ │DepthFlow ├┤ 3816ms├┤INFO │ ▸ | \ _ _ | |_| |_ | | | │DepthFlow ├┤ 3816ms├┤INFO │ ▸ | | | |/ \ '_ | | ' | | | |/ \ \ /\ / / │DepthFlow ├┤ 3816ms├┤INFO │ ▸ | || | / |) | || | | | | | | () \ V V / │DepthFlow ├┤ 3816ms├┤INFO │ ▸ |___/ \| ./ _|| ||| ||\/ _/_/ │DepthFlow ├┤ 3816ms├┤INFO │ ▸ |_| │DepthFlow ├┤ 3816ms├┤INFO │ ▸ │DepthFlow ├┤ 3816ms├┤INFO │ ▸ Made with ❤️ by BrokenSource, Version: (2024.2.6) │DepthFlow ├┤ 3816ms├┤INFO │ ▸ Development version @ Python 3.10.13 │DepthFlow ├┤ 3816ms├┤INFO │ ▸ │DepthFlow ├┤ 3898ms├┤INFO │ ▸ │ 1├┤DepthFlowScene │ Changing backend to SombreroBackend.GLFW │Broken ├┤ 4913ms├┤WARNING│ ▸ Detected bad Return Status (-11) for the Project (DepthFlow) at (/Users/deepdey/Media_Local/d2/BrokenSource/Projects/DepthFlow) │Broken ├┤ 4913ms├┤WARNING│ ▸ • Python Virtual Environment: (/Users/deepdey/Library/Caches/pypoetry/virtualenvs/depthflow-NEyLe7CL-py3.10) │Broken ├┤ 4913ms├┤WARNING│ ▸ • Arguments: ('/Users/deepdey/Library/Caches/pypoetry/virtualenvs/depthflow-NEyLe7CL-py3.10/bin/main',) • Action: Run {poetry (i)nstall}, {poetry (l)ock}, {(r)einstall venv}, {(e)xit} or {(enter) nothing}, then retry [r/e/p/l/] (retry):

Tremeschin commented 7 months ago

Maybe let's leave it for now, I keep running into new issues and you don't have the hardware to test. I'll use on PC for now.

Oh, yes, hehe, this new error is some segfault on ModernGL / glcontext / glfw probably due some trickery I'm doing on the code but works on Windows / Linux. Will eventually make it less cursed in the medium future

Nevertheless, we made progress and found one edge case. Yea, from now onwards it's hard(er) to bounce messages to debug it, would be better to have the hardware, as we're entering the specifics and there's a whole code base of potential small issues


Excited for what you've got to come on this project, would be cool to see what you future plans are for it? Are you adding to PyPi?

Long story short I have the name placeholder on PyPI, I'm working on some architecture enhancements on ShaderFlow for now that will take some time (multi pass shaders, better audio processing classes), do plan having it all on PyPI

Will move many of the DepthFlow code to ShaderFlow itself, to have it easily accessible on shaders, and make amazing dynamic music visualization videos with it !

I also wanted to make it a non greedy service, but web dev and scalability is not my best area, I have some gradio prototypes tho



Thanks a lot for getting in touch and helping ! Glad it's working on your other PC

Tremeschin commented 7 months ago

Hey friend !

If you're up to one last test on macOS, I've un-cursed substantial parts of the shader engine code, if the segfault was related to some of it, it might work now

Apparently stuff that once worked still works™™

dey-d commented 7 months ago

Hey mate, no worries. I'm not at home today but can check for you later tonight or tomorrow morning (I'm in the UK). Will let you know.