invoke-ai / InvokeAI

Invoke is a leading creative engine for Stable Diffusion models, empowering professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry leading WebUI, and serves as the foundation for multiple commercial products.
https://invoke-ai.github.io/InvokeAI/
Apache License 2.0
23.7k stars 2.43k forks source link

Permission error MacOS #692

Closed norcalskeptic closed 1 year ago

norcalskeptic commented 2 years ago

Struggling to help my friend install on his Mac.

Made it all the way through install, but when trying to run dream.py get the following error:

(ldm) The-Void-Mirror:stable-diffusion JasonM$ python scripts/dream.py --full_precision Traceback (most recent call last): File "/Users/JasonM/stable-diffusion/scripts/dream.py", line 12, in import ldm.dream.readline File "/Users/JasonM/stable-diffusion/ldm/dream/readline.py", line 123, in readline.read_history_file(histfile) PermissionError: [Errno 13] Permission denied

I'm not familiar with MacOS, did my best to help him but can't seem to get past this step, would appreciate any help.

Screen_Shot_2022-09-18_at_10 08 31_PM

Thanks!

tildebyte commented 2 years ago

Guessing, here, but check the location and permissions thereof for '~/.dream_history'. If it doesn't exist, try creating it.

Note; IDK the level of *nix proficiency here, but '~' represents the users's home directory, so the permissions issue isn't there (the system would be too fouled up to use if so). There's something going on with the '.dream_history' dir in the user's home directory.

psychedelicious commented 2 years ago

Hi @norcalskeptic , is this still an issue?

Kirkman commented 1 year ago

I'm experiencing a very similar issue on an M1 2020 MacBook Air. I can get the web UI to run, but not the command line version.

Here's the error message:

screenshotx

As far as I can tell, opt.outdir is resolving to outputs/img-samples/. I tried creating outputs/img-samples/.invoke_history and setting 777 permissions, but the error is still occurring.

I believe the issue is probably Mac/readline specific. I see other Mac users have reported the same Operation not permitted error with readline in other contexts. Just like the author of that question, when I check the contents of outputs/img-samples/.invoke_history, I see:

_HiStOrY_V2_
Kirkman commented 1 year ago

After further research, it appears that the Mac needs gnureadline rather than readline.

I was able to get the command line to load correctly after:

  1. Installing gnureadline via pip
  2. Changing readline.py as follows:
    try:
    import gnureadline as readline
    readline_available = True
    except:
    try:
        import readline
        readline_available = True
    except (ImportError,ModuleNotFoundError):
        readline_available = False
psychedelicious commented 1 year ago

@Kirkman Thanks for troubleshooting. I'm also on an M1 Macbook - and many of our users are as well - but this seems to be a very rare issue. I cannot recreate it.

I'm very skeptical that gnureadline is needed - see the big STOP blurb on the package details here: https://pypi.org/project/gnureadline/

How did you install invokeai and set up its venv? I wonder if something funky happened along the way...

Kirkman commented 1 year ago

I used pyenv to install Python 3.9 and create a virtualenv. Then I followed the pip instructions under the manual install.

But I have noticed some oddities about the way pyenv's virtualenvs are functioning. So, yes, it's possible there's something funky going on (or that I screwed up).

What I can say for sure is that before switching to gnureadline, I absolutely could not get the command line to work (though the web UI works fine). After making changes to use gnureadline, the Invoke command line works.

psychedelicious commented 1 year ago

@Kirkman Ok, thanks. Given the big warning on the gnureadline PyPi homepage, I don't think we should change the dependency, but I'm not a python-y person. Paging @tildebyte

tildebyte commented 1 year ago

...who in turn is paging @lstein. I helped figure out how to get readline going on Windows, but I don't have a clue on MacOS...

psychedelicious commented 1 year ago

Sorry @Kirkman , I don't think we have any idea on how to fix this for your specific case. I think your installation is... unique, let's say... for unknown reasons. Glad you found a fix though and I'll remember this issue if we see this come up again.