bmaltais / kohya_ss

Apache License 2.0
9.38k stars 1.21k forks source link

Problem while installing: error: metadata-generation-failed #2686

Open MigWin opened 1 month ago

MigWin commented 1 month ago

Hello,

when trying to install through the setup.bat file I get the above error.

The last few CMD command lines shows the following:

     C:\Users\xxxxxxx\AppData\Local\Temp\pip-install-f69r6qpi\matplotlib_87a8f6ec90754de98c8ad2b0bf87f131\src\_backend_agg.h(348): warning C4244: "Argument": Konvertierung von "size_t" in "double", m”glicher Datenverlust
      ninja: build stopped: subcommand failed.
      Activating VS 17.10.5
      INFO: automatically activated MSVC compiler environment
      INFO: autodetecting backend as ninja
      INFO: calculating backend command to run: "C:\Users\xxxxxxxxx\AppData\Local\Temp\pip-build-env-vhg1e8p8\normal\Scripts\ninja.EXE"
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

[notice] A new release of pip available: 22.2.1 -> 24.2
[notice] To update, run: python.exe -m pip install --upgrade pip
10:38:43-885750 INFO     Requirements from requirements_windows.txt installed.
"The command 'accelerate' is either misspelled or could not be found."

It says, theres a newer version of pip available.. but when I run "pip --version" it shows that I already have installed 24.2. Is there anybody who has a bit of time to help me? :)

b-fission commented 1 month ago

What version of python are you using? It might be older than expected. Update your version of python 3.10 (such as 3.10.11) and try again.

The pip version can be different between your system's python and the venv that was created by kohya_ss. If you run pip by itself, that will only affect the system's copy.

You can upgrade the venv's copy of pip by running venv\scripts\python.exe -m pip install --upgrade pip

MigWin commented 1 month ago

What version of python are you using? It might be older than expected. Update your version of python 3.10 (such as 3.10.11) and try again.

The pip version can be different between your system's python and the venv that was created by kohya_ss. If you run pip by itself, that will only affect the system's copy.

You can upgrade the venv's copy of pip by running venv\scripts\python.exe -m pip install --upgrade pip

I am using 3.10.11^^ But will try to update to a somewhat newer version and post an update here :)

Thank you.

b-fission commented 1 month ago

It looks like matplotlib currently doesn't have Windows binaries for their latest version. If you run pip with --prefer-binary it will install their previous version without needing to compile from source.

venv\scripts\pip.exe install --prefer-binary matplotlib

After that's installed, do setup option 1 again. Everything else should install without issue.

MigWin commented 1 month ago

It looks like matplotlib currently doesn't have Windows binaries for their latest version. If you run pip with --prefer-binary it will install their previous version without needing to compile from source.

venv\scripts\pip.exe --prefer-binary matplotlib

After that's installed, do setup option 1 again. Everything else should install without issue.

Thank you so much for your effort. You are replying faster than I can try things out^^

So first: venv\scripts\python.exe -m pip install --upgrade pip

solved the pip message :) I googled like hours for an solution^^ But like you said, that didnt solve the error.

I have than upgraded from py 3.10.11 to python 3.11.0 which also still prints the same error.

Now I've tried to run venv\scripts\pip.exe --prefer-binary matplotlib like you said, but this also just prints a new error :/ no such option: --prefer-binary

I googled for that error and found this thread saying the --prefer-binary isnt working in Py 3.x but only in 2.x https://stackoverflow.com/questions/61734206/how-can-i-use-prefer-binary-with-pip-in-python-3

From my understanding he is saying only thing which can be done in py3 is: pip3 install --only-binary

However at the bottom of the post they are saying: Question: How can I get a similar automated behavior but in Python/pip 3?

Solution: Pip is not Python - upgrade pip to vs. 20.X and use --prefer-binary

--So now I am completly lost and confused as we just have upgraded my pip with your prompt to 24.2... do you think I should downgrade again to 20.x? Or should I try something like venv\scripts\pip.exe --only-binary matplotlib? I'm a bit afraid that I will mess up thing even more, so I will wait for your answer before trying anything^^

--edit-- okay I just found out the guy from the stackoverflow thread was also a bit confused and mixed up Py3 with Pip3 so I guess the thread makes no sense.. but that still doesnt solve my no such option: --prefer-binary Error :/

b-fission commented 1 month ago

I have than upgraded from py 3.10.11 to python 3.11.0 which also still prints the same error.

You'll need to keep using python 3.10.11 because kohya_ss has a version check which blocks other python versions. I'm sure that'll change in the future, but 3.10 is a must for now.

If you've created the venv using python 3.11, I highly recommend deleting the venv folder. It will be created again when you run setup.bat

Now I've tried to run venv\scripts\pip.exe --prefer-binary matplotlib like you said, but this also just prints a new error :/ no such option: --prefer-binary

My bad, I forgot to put the word "install" in the command. This should be correct: venv\scripts\pip.exe install --prefer-binary matplotlib

So just run setup.bat, leave it and run the command above, and if that worked then do setup option 1.

MigWin commented 1 month ago

I have than upgraded from py 3.10.11 to python 3.11.0 which also still prints the same error.

You'll need to keep using python 3.10.11 because kohya_ss has a version check which blocks other python versions. I'm sure that'll change in the future, but 3.10 is a must for now.

If you've created the venv using python 3.11, I highly recommend deleting the venv folder. It will be created again when you run setup.bat

Now I've tried to run venv\scripts\pip.exe --prefer-binary matplotlib like you said, but this also just prints a new error :/ no such option: --prefer-binary

My bad, I forgot to put the word "install" in the command. This should be correct: venv\scripts\pip.exe install --prefer-binary matplotlib

So just run setup.bat, leave it and run the command above, and if that worked then do setup option 1.

Oh dear god, what a long journey :D So I deleted the venv folder, installed py 3.10.11 again, used your prompt and started the setup. You were completly right, that solved the issue, thank you so much!

However, after starting khoya I got an error saying my install folder contains too many spaces^^ So I moved everything, deleted the venv again and started all over. Now I am downloading everything for the third time at around 1mbit/s (I live in a very rural area^^). I guess this will take a while, but I am sure everything will succeed now.

Again, thank you so much! I am convinced I would NEVER have solved this alone.