Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with direnv (only supports virtualenv) #15

Closed
caesar opened this issue Sep 10, 2022 · 4 comments · Fixed by #16
Closed

Doesn't work with direnv (only supports virtualenv) #15

caesar opened this issue Sep 10, 2022 · 4 comments · Fixed by #16

Comments

@caesar
Copy link
Contributor

caesar commented Sep 10, 2022

I know the Readme says you don't want contributions, so feel free to ignore… that said, this is certainly a critical bug for me, so I thought I'd open an issue anyhow.

Regardless of input, when I click Generate, the app gives an output of "image error".
It doesn't give any more details about what the error might be. I've tried running in dev mode in the hopes of some debug output either on the CLI or in the web console, but there's nothing.

Copying the displayed command and manually running it from the terminal from within the SD directory works fine.

I suspect (but have no evidence yet) that this is related to the fact that my installation of SD is using pyenv via direnv (as opposed to virtualenv, as shown in the guide linked from the readme). Perhaps whatever method the app is using to run the python command doesn't load the pyenv.
That's all I can think of anyway… I'll try and do some more debugging when I get a chance.

@breadthe
Copy link
Owner

Thanks for letting me know. Bugfix contributions are certainly welcome.

What you're saying is concerning but I would need a way to reproduce this issue before I can look into it.

I'm sure there are many ways to install Stable Diffusion. This app is build around this method. Did you follow those instructions or something else?

If you look at main.rs you'll notice starting at line 73 that it calls the source venv/bin/activate command to activate the venv before the actual SD command.

I think the best way to debug it is to run the command in the terminal first, as shown in the guide above. If that works, then the app should also work (I hope 😬 ). Keep me posted!

@caesar
Copy link
Contributor Author

caesar commented Sep 10, 2022

I'm sure there are many ways to install Stable Diffusion. This app is build around this method. Did you follow those instructions or something else?

I followed those instructions, except that, as noted above, I used pyenv (via direnv) instead of virtualenv (simply because that's what I always use).

If you look at main.rs you'll notice starting at line 73 that it calls the source venv/bin/activate command to activate the venv before the actual SD command.

Aha! As I suspected then, my use of pyenv/direnv instead of virtualenv is the issue.
I wonder what it would take to add support for pyenv as well… I'll look into it.

In the meantime the workaround I guess is to use virtualenv (or just use the app to generate prompts and copy-paste them into the terminal).

@breadthe
Copy link
Owner

I'm not a python dev so I'm not sure what are the implications and pros/cons of using pyenv vs direnv but I wouldn't mind supporting both. There needs to be some sort of check for one or the other before invoking it.

@caesar
Copy link
Contributor Author

caesar commented Sep 10, 2022

I've got this working by detecting the presence of either venv/bin/activate or .direnv and calling the appropriate command. I'll clean it up a bit and send a PR.

@caesar caesar changed the title "image error" Doesn't work with direnv (only supports virtualenv) Sep 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants