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

ModuleNotFoundError #5

Closed
DrakeFruit opened this issue Aug 19, 2022 · 5 comments
Closed

ModuleNotFoundError #5

DrakeFruit opened this issue Aug 19, 2022 · 5 comments

Comments

@DrakeFruit
Copy link

Traceback (most recent call last):
File "scripts/dream.py", line 277, in
main()
File "scripts/dream.py", line 39, in main
from ldm.simplet2i import T2I
ModuleNotFoundError: No module named 'ldm.simplet2i'

I get this error on run and ive followed the proper instructions, im not sure what to do here.

@1blackbar
Copy link

1blackbar commented Aug 19, 2022

Move dream.py from scripts to main folder , one step higher in folder structure, so its nexxt to main,py
IMO thats should be default structure for windows version
If that wont work move all files from script sfolder to where main.py is
That solved this error for me

@lstein
Copy link
Collaborator

lstein commented Aug 19, 2022

Hopefully 1blackbar's solution will work. Python running on Windows is a little mysterious to me. @DrakeFruit, if you have the chance, could you also try opening dream.py in Notepad and remove the very first line which starts with #!/usr/bin/env python? This is a Linux thing and may be confusing the Windows interpreter.

@lstein lstein closed this as completed Aug 19, 2022
@green-s
Copy link

green-s commented Aug 19, 2022

This is happening to me too. Running python ./scripts/txt2img.py --prompt x works fine in the original repo, but python ./scripts/dream.py throws this error unless I move it out into the main directory. Removing the shebangs didn't help.

Running python -m scripts.dream seems to work though.

I don't work with Python much but I'm pretty sure that when you run a script, it's only supposed to add the directory of the script to the pythonpath, not the current directory, so I'm surprised the scripts/ setup works at all. From what I gather you're supposed to do something like this with a setup like that:

import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))

Adding that to the top of dream.py does seem to fix it.

@DrakeFruit
Copy link
Author

thanks, I did everything you all suggested and was confused why it wasn't working, turns out that simplet2i was actually missing somehow.

@lstein
Copy link
Collaborator

lstein commented Aug 20, 2022 via email

rabidcopy pushed a commit to rabidcopy/stable-diffusion that referenced this issue Sep 17, 2022
Fix install issues, README instructions should work out-of-the-box now
austinbrown34 pushed a commit to cognidesign/InvokeAI that referenced this issue Dec 30, 2022
Fix install issues, README instructions should work out-of-the-box now
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

No branches or pull requests

4 participants