invoke-ai / InvokeAI

InvokeAI 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, supports terminal use through a CLI, and serves as the foundation for multiple commercial products.
https://invoke-ai.github.io/InvokeAI/
Apache License 2.0
22.78k stars 2.35k forks source link

Can't pip install realesrgan on M1 #316

Closed user799595 closed 1 year ago

user799595 commented 2 years ago

Looks like it tries to build numpy from source.

Build output (too long to include here): https://gist.github.com/user799595/7544428976415caa49fc134edaa8cb4d

Related: https://github.com/xinntao/Real-ESRGAN/issues/425

yousifa commented 2 years ago

The reason is it requires numpy-1.20.3 which is unsupported with the python version required for this repo.

yousifa commented 2 years ago

Here is a temporary fix until cog.yaml file is fixed on GFPGAN's repo.

Clone gfpgan repo and install locally:

git clone git@github.com:TencentARC/GFPGAN.git
cd GFPGAN
pip install basicsr facexlib
pip install -r requirements.txt
python setup.py develop

Then you can run pip install realesrgan successfully.

cgodley commented 2 years ago

I was able to switch to python 3.10.4 with no problems:

diff --git a/environment-mac.yaml b/environment-mac.yaml
index 44cd1ef..c0cc6ca 100644
--- a/environment-mac.yaml
+++ b/environment-mac.yaml
@@ -3,7 +3,7 @@ channels:
   - pytorch-nightly
   - conda-forge
 dependencies:
-  - python==3.9.13
+  - python==3.10.4
   - pip==22.2.2

   # pytorch-nightly, left unpinned

Then I ran: conda env update -f environment-mac.yaml --prune

user799595 commented 2 years ago

@cgodley numpy-1.20.3 doesn't seem to work any better with 3.10.4 for me

user799595 commented 2 years ago

Here is a temporary fix until cog.yaml file is fixed on GFPGAN's repo.

Clone gfpgan repo and install locally:

git clone git@github.com:TencentARC/GFPGAN.git
cd GFPGAN
pip install basicsr facexlib
pip install -r requirements.txt
python setup.py develop

Then you can run pip install realesrgan successfully.

This fixed the installation error for me, thank you.

stillmatic commented 2 years ago

try using the requirements.txt setup here: https://github.com/lstein/stable-diffusion/issues/302#issue-1359489755

user799595 commented 2 years ago

Thanks @stillmatic

Did you ever figure out the RuntimeError: expected scalar type BFloat16 but found Float error?

stillmatic commented 2 years ago

RuntimeError: expected scalar type BFloat16 but found Float is fixed by #319