[bug]: Unable to Install InvokeAI 2.3.0 on Windows 10 using Installer
Is there an existing issue for this?
- [X] I have searched the existing issues
OS
Windows
GPU
cuda
VRAM
12GB
What happened?
This may be similar to another issue, https://github.com/invoke-ai/InvokeAI/issues/2612 , but it appears to be a different error.
I have tried updating my previous 2.5 installation and doing a fresh installation with both failing when installing Pytorch with the following error:
──────────────────────────────────────────────── Installing PyTorch 🔥 ──────────────────────────────────────────────── Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu117 ERROR: Could not find a version that satisfies the requirement torch (from versions: none) ERROR: No matching distribution found for torch Traceback (most recent call last): File "C:\Console\InvokeAI\InvokeAI-Installer\lib\main.py", line 50, in
inst.install(**args.dict) File "C:\Console\InvokeAI\InvokeAI-Installer\lib\installer.py", line 179, in install self.instance.install( File "C:\Console\InvokeAI\InvokeAI-Installer\lib\installer.py", line 232, in install self.install_torch(extra_index_url, find_links) File "C:\Console\InvokeAI\InvokeAI-Installer\lib\installer.py", line 247, in install_torch pip[ File "C:\Users\user\AppData\Local\Temp\invokeai-installer-tmp0olxkqlt\Lib\site-packages\plumbum\commands\modifiers.py", line 145, in rand cmd( File "C:\Users\user\AppData\Local\Temp\invokeai-installer-tmp0olxkqlt\Lib\site-packages\plumbum\commands\base.py", line 113, in call return self.run(args, **kwargs)[1] ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Temp\invokeai-installer-tmp0olxkqlt\Lib\site-packages\plumbum\commands\base.py", line 252, in run return p.run() ^^^^^^^ File "C:\Users\user\AppData\Local\Temp\invokeai-installer-tmp0olxkqlt\Lib\site-packages\plumbum\commands\base.py", line 215, in runner return run_proc(p, retcode, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Temp\invokeai-installer-tmp0olxkqlt\Lib\site-packages\plumbum\commands\processes.py", line 304, in run_proc return _check_process(proc, retcode, timeout, stdout, stderr) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Temp\invokeai-installer-tmp0olxkqlt\Lib\site-packages\plumbum\commands\processes.py", line 17, in _check_process proc.verify(retcode, timeout, stdout, stderr) File "C:\Users\user\AppData\Local\Temp\invokeai-installer-tmp0olxkqlt\Lib\site-packages\plumbum\machines\base.py", line 27, in verify raise ProcessExecutionError( plumbum.commands.processes.ProcessExecutionError: Unexpected exit code: 1 Command line: | 'C:\Console\InvokeAI.venv\Scripts\pip.exe' install --require-virtualenv torch torchvision --force-reinstall --extra-index-url https://download.pytorch.org/whl/cu117 = was unexpected at this time.
I then tried updating my existing installation with pip install invokeai.
All requirements were successfully installed, but it failed to run with invoke.bat with the error Original error was: No module named 'numpy.core._multiarray_umath'. I was able to fix this by updating numpy from 1.23.5 to 1.24.2.
Next attempt it failed importing Pillow: ImportError: cannot import name '_imaging' from 'PIL' (C:\Console\InvokeAI\.venv\Lib\site-packages\PIL\__init__.py). I was able to resolve that by uninstalling and reinstalling Pillow 9.4.0.
Finally, it failed on PyTorch again and I could find a way to progress further. I tried reinstalling PyTorch manually, but it did not help.
ImportError: Failed to load PyTorch C extensions:
It appears that PyTorch has loaded the `torch/_C` folder
of the PyTorch repository rather than the C extensions which
are expected in the `torch._C` namespace. This can occur when
using the `install` workflow. e.g.
$ python setup.py install && python -c "import torch"
This error can generally be solved using the `develop` workflow
$ python setup.py develop && python -c "import torch" # This should succeed
or by running Python from a different directory.
Screenshots
No response
Additional context
No response
Contact Details
No response
Is there a chance access to https://download.pytorch.org/whl/cu117 is blocked from your location?
I have the same problem, don't know why that link would be blocked as I have previously successfully installed InvokeAI, both update and installing fresh to the same location give the same error, installing fresh to a different location also give the same error. I have a 3060 12 GB GPU if that makes any difference (AMD64 CPU).
What happens when you click this link? https://download.pytorch.org/whl/cu117/torch-1.13.1%2Bcu117-cp310-cp310-win_amd64.whl
are you able to download this .whl file?
Yes, I'm able to download it.
I don't have any blocks on pytorch either. The download link works fine.
I haven't had a lot of time to dig into this, but the issue seems to be the installer is creating a virtualenv with the wrong version of Python. If I activate the venv and check the python version it is 3.11, which I don't believe is supported by PyTorch yet.
I did a test and manually created a virtualenv using python 3.10 and was able to install invokeai using pip and get to the command line interface after running it with the invokeai command.
I've never used virtualenv programmatically to create environments so I'm not sure if it is possible to set the python version there, possibly with the prompt parameter of venv.create().
I'm on Windows 11 btw, so the same problem is there.
Cyperium, if you activate your virtual environment and type python --version what version is it showing? I am curious if your installation is running Python 3.11 as well.
If you aren't familiar with working with Python and virtual environment, you can activate it by opening a command prompt, browsing to your InvokeAI folder and running the activate.bat file that should be located atInvokeAI/.venv/Scripts/activate.bat. If it worked, you should see the (.venv) at the beginning of the your command prompt before the path. Then you can just run the python --version command.
Yes, it says 3.11.0
It looks like we have the same issue. If you don't use Python 3.11 for a specific purpose, you could try downgrading to Python 3.10 or maybe adjusting your system environment variables so Python 3.10 is the default version of Python.
Otherwise, you could try a manual installation. What worked for me was opening a command prompt and browsing to the folder I wanted to install InvokeAI. Then running the following commands one line at a time:
python pip install virtualenv
virtualenv .venv --python=python3.10
call .venv/Scripts/activate.bat
python --version
pip install invokeai
invokeai-configure
invokeai --web
You can find more info about this method in this part of the documentation: https://invoke-ai.github.io/InvokeAI/installation/020_INSTALL_MANUAL/
That seems to work, it is installing now, yeah python versions is a mess that I never really figured out.
@delizin excellent, yes, this is exactly the problem
I don't have a Windows system to test with - could you please do me a favour and check if you can run python3.10 directly even if you have python3.11 installed? i.e. from your terminal run python3.10 and see if that's a valid command.
We could modify the installer script to call it explicitly, instead of python3 which may refer to 3.11.
I've never used virtualenv programmatically to create environments so I'm not sure if it is possible to set the python version there, possibly with the prompt parameter of venv.create()
it's not, because you're already inside a running python process at that point, and it will use the venv module from its standard lib. (the prompt argument just allows you to give a custom name to the (.venv) prompt you see in your shell). If you import venv while in a python 3.11 process, that's the venv you get. However, if we can prove that python3.10 is a reliable name for the executable, we can enforce python 3.10 that way, and that would solve the issue.
@ebr Unfortunately, those commands do not work on my system. It could be configured to work like that by modifying the system environment variables, but there doesn't seem to be an out of the box method for calling specific versions of python with a standard installation.
I think a good alternative would be to create the virtualenv using the install.bat instead of in install.py on Windows systems.
We could add a check to see if a temp venv already exists in Installer.bootstrap() and use the one created by the install.bat if it does exist or continue with mktemp_venv() if it doesn't. Theoretically, then it should be using Python 3.10 when it creates the next venv in Installer.app_venv().
I got this error when it tried to restart InvokeAI after installing all the models: ** An error occurred while attempting to initialize the model: "[Errno 2] No such file or directory: 'E:\InvokeAI\onfigure'" ** This can be caused by a missing or corrupted models file, and can sometimes be fixed by (re)installing the models.
I'm reinstalling the models now, this time I'm installing all the models and not just the recommended ones, I don't know if this is related to this issue though.
@cyperium I don't think that is related to this issue. It looks like it is missing the C in configure. I don't have a InvokeAI/Configure directory as part of my install and I'm not sure where that error is coming from. Perhaps a path in one a preexisting config file is wrong somewhere? You could try a find in files for InvokeAI\onfigure and see if you can locate the culprit.
Yeah, I figured that it probably wasn't related to this issue, I don't have that directory either, maybe something became corrupt when I tried to reinstall it before, for all I know it might work as well cause I've only been in the installation all the time. Will try your suggestion, thanks.
Edit: It just finished installing all the models and now it seems to work.
I think a good alternative would be to create the virtualenv using the install.bat instead of in install.py on Windows systems
We used to have fairly elaborate batch and shell installer scripts, but made the decision to move as much of that logic as possible into python to minimize platform-specific maintenance burdens. So we're unlikely to shift back to bootstrapping the installer in .bat/.sh.
But it does look like our handling of incompatible python versions isn't robust enough. We detect that a compatible python exists, but we don't ensure that it is in fact the one that is used at install time, which affects systems that have both 3.10 and 3.11 installed. By addressing that I think we can solve the issue across all platforms - this isn't Windows-specific.
Thanks for investigating - this is very helpful.
@cyperium : E:\InvokeAI\onfigure looks incredibly odd. Did you use the exact installation steps posted by @delizin above? Somehow your path is mangled in a way I haven't see before.
Edit: please ignore, I typed the reply before seeing your latest messages. Leaving this in case you got notified:)
Well, I thought I had solved it by redownloading all the models, but then I got some path errors, but I recognised that I had all the directories at another path so I just copied them to where it thought it should be :D, then I got it working. I think it installed the model config files at the wrong path to begin with.
Something else to keep in mind when using the manual install method, when it starts up make sure that is using CUDA (if you have a CUDA capable GPU) and not CPU.
It should look like this when starting InvokeAI:
>> Using device_type cuda
In my case it installed the CPU version of PyTorch instead of the CUDA version by default. Uninstalling torch with pip uninstall torch and reinstalling with pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117 fixed in my case. You can get platform specific instructions for installing PyTorch here: https://pytorch.org/get-started/locally/
Yup, it uses the CPU, very slow, will install the GPU one asap!
Your method of installing torchvision worked for me too. Thanks!
Do you know how to make a .bat file so that it doesn't disappear as soon as I start it?
As it is now I have to go into the scripts folder and open the cmd then first activate and start it using invokeai --web, I would like to have a .bat file to start it, it was ages ago that I used .bat file but that's not the behavior I was expecting.
(sorry for hijacking this btw)
Making the bat file is really simple, just open notepad and enter in the commands just like you would into the command prompt, in this case it would be:
call .venv\Scripts\activate.bat
invokeai --web
Then save it with a .bat extension. Just make sure your bat file name is not named invokeai.bat or it will make an infinite loop since it will see that file first.
Thanks, that worked! I tried before but then the command window just disappeared, maybe I didn't use "call activate", I just had "activate" there. Thank you, now I'm all set :)
There has been no activity in this issue for 14 days. If this issue is still being experienced, please reply with an updated confirmation that the issue is still being experienced with the latest release.