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

Windows 10 installation problem #1264

Closed
PasF opened this issue Oct 27, 2022 · 10 comments
Closed

Windows 10 installation problem #1264

PasF opened this issue Oct 27, 2022 · 10 comments

Comments

@PasF
Copy link

PasF commented Oct 27, 2022

Describe your environment

Describe the bug
Tried to install thanks to conda and pyenv on Windows 10, same error every time:

(invokeai) C:\Users\w00t\Desktop\ai_art\InvokeAI>python scripts\preload_models.py
NOTE: Redirects are currently not supported in Windows or MacOs.
Traceback (most recent call last):
  File "C:\Users\w00t\anaconda3\envs\invokeai\lib\site-packages\transformers\utils\import_utils.py", line 1002, in _get_module
    return importlib.import_module("." + module_name, self.__name__)
  File "C:\Users\w00t\anaconda3\envs\invokeai\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\w00t\anaconda3\envs\invokeai\lib\site-packages\transformers\models\clip\modeling_clip.py", line 27, in <module>
    from ...modeling_utils import PreTrainedModel
  File "C:\Users\w00t\anaconda3\envs\invokeai\lib\site-packages\transformers\modeling_utils.py", line 79, in <module>
    from accelerate import dispatch_model, infer_auto_device_map, init_empty_weights
  File "C:\Users\w00t\anaconda3\envs\invokeai\lib\site-packages\accelerate\__init__.py", line 7, in <module>
    from .accelerator import Accelerator
  File "C:\Users\w00t\anaconda3\envs\invokeai\lib\site-packages\accelerate\accelerator.py", line 27, in <module>
    from .checkpointing import load_accelerator_state, load_custom_state, save_accelerator_state, save_custom_state
  File "C:\Users\w00t\anaconda3\envs\invokeai\lib\site-packages\accelerate\checkpointing.py", line 24, in <module>
    from .utils import (
  File "C:\Users\w00t\anaconda3\envs\invokeai\lib\site-packages\accelerate\utils\__init__.py", line 96, in <module>
    from .launch import PrepareForLaunch, _filter_args, get_launch_prefix
  File "C:\Users\w00t\anaconda3\envs\invokeai\lib\site-packages\accelerate\utils\launch.py", line 25, in <module>
    import torch.distributed.run as distrib_run
  File "C:\Users\w00t\anaconda3\envs\invokeai\lib\site-packages\torch\distributed\run.py", line 386, in <module>
    from torch.distributed.launcher.api import LaunchConfig, elastic_launch
  File "C:\Users\w00t\anaconda3\envs\invokeai\lib\site-packages\torch\distributed\launcher\__init__.py", line 10, in <module>
    from torch.distributed.launcher.api import (  # noqa: F401
  File "C:\Users\w00t\anaconda3\envs\invokeai\lib\site-packages\torch\distributed\launcher\api.py", line 15, in <module>
    from torch.distributed.elastic.agent.server.api import WorkerSpec
  File "C:\Users\w00t\anaconda3\envs\invokeai\lib\site-packages\torch\distributed\elastic\agent\server\__init__.py", line 40, in <module>
    from .local_elastic_agent import TORCHELASTIC_ENABLE_FILE_TIMER, TORCHELASTIC_TIMER_FILE
  File "C:\Users\w00t\anaconda3\envs\invokeai\lib\site-packages\torch\distributed\elastic\agent\server\local_elastic_agent.py", line 19, in <module>
    import torch.distributed.elastic.timer as timer
  File "C:\Users\w00t\anaconda3\envs\invokeai\lib\site-packages\torch\distributed\elastic\timer\__init__.py", line 44, in <module>
    from .file_based_local_timer import FileTimerClient, FileTimerServer, FileTimerRequest  # noqa: F401
  File "C:\Users\w00t\anaconda3\envs\invokeai\lib\site-packages\torch\distributed\elastic\timer\file_based_local_timer.py", line 63, in <module>
    class FileTimerClient(TimerClient):
  File "C:\Users\w00t\anaconda3\envs\invokeai\lib\site-packages\torch\distributed\elastic\timer\file_based_local_timer.py", line 81, in FileTimerClient
    def __init__(self, file_path: str, signal=signal.SIGKILL) -> None:
AttributeError: module 'signal' has no attribute 'SIGKILL'. Did you mean: 'SIGILL'?

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\w00t\Desktop\ai_art\InvokeAI\scripts\preload_models.py", line 6, in <module>
    from transformers import CLIPTokenizer, CLIPTextModel
  File "<frozen importlib._bootstrap>", line 1075, in _handle_fromlist
  File "C:\Users\w00t\anaconda3\envs\invokeai\lib\site-packages\transformers\utils\import_utils.py", line 993, in __getattr__
    value = getattr(module, name)
  File "C:\Users\w00t\anaconda3\envs\invokeai\lib\site-packages\transformers\utils\import_utils.py", line 992, in __getattr__
    module = self._get_module(self._class_to_module[name])
  File "C:\Users\w00t\anaconda3\envs\invokeai\lib\site-packages\transformers\utils\import_utils.py", line 1004, in _get_module
    raise RuntimeError(
RuntimeError: Failed to import transformers.models.clip.modeling_clip because of the following error (look up to see its traceback):
module 'signal' has no attribute 'SIGKILL'

To Reproduce
Steps to reproduce the behavior:

  1. Follow https://github.com/invoke-ai/InvokeAI/blob/main/docs/installation/INSTALL_WINDOWS.md
  2. Run python scripts\preload_models.py on step 7

Expected behavior
I don't know but not an error.

@n00mkrad
Copy link

Replacing SIGKILL with SIGTERM might work.

@PasF
Copy link
Author

PasF commented Oct 27, 2022

It worked, changed \invokeai\lib\site-packages\torch\distributed\elastic\timer\file_based_local_timer.py

def __init__(self, file_path: str, signal=signal.SIGKILL)
to
def __init__(self, file_path: str, signal=signal.SIGTERM)

Thanks !

@UnicodeTreason
Copy link

Confirmed, hacky workaround works.
What's the root cause here?
I assume sometime in the last few weeks a newer version of pytorch has been added which includes this SIGKILL bug.
I'm outta my depth here a little but maybe:
65b1468
Which has allowed
pytorch/pytorch#85427
To squeeze its way in.

@UnicodeTreason
Copy link

These updated modules also caused my install to fail to detect CUDA entirely.
Forcing my environment.yml back to the following (And rebuilding the cuda environment) resolved both issues for me:

dependencies:
  - python>=3.9
  - pip>=22.2
  - cudatoolkit=11.3
  - pytorch=1.11.0
  - torchvision=0.12.0
  - numpy=1.19.2

@GifCo
Copy link

GifCo commented Oct 28, 2022

I can confirm I have the same issue on Win 10 with Cuda. Fresh install with pew or with Conda both fail with the module 'signal' has no attribute 'SIGKILL'

I am able to get a working install thanks to UnicodeTreason by adding:

torch==1.11.0

to requirments-lin-win-colab-CUDA.txt

Edit: also need to specify CudaToolkit otherwise torch will use CPU. Was unable to get CU 11.6 so had to downgrade to CU 11.3. Make sure you also change the --extra-index-url to point to v 11.3

--extra-index-url https://download.pytorch.org/whl/cu113

torch==1.12.0+cu113

@n00mkrad
Copy link

n00mkrad commented Oct 28, 2022

Seems like a Pytorch developer accidentally added a Linux-only command into a script.
SIGTERM (terminate) is basically what a program receives when you send CTRL+C to cancel something in a CLI.
Linux has some more like SIGTERM, but those do not work on Windows.

I guess for now users will have to rollback and/or wait for a fix. Or, of course, patch it themselves (you can just find-and-replace signal.SIGKILL with signal.SIGTERM and it should work).

@sveken
Copy link

sveken commented Oct 31, 2022

Same issue on Windows 11,
Changing to SIGTERM resolved it

@bkonkle
Copy link

bkonkle commented Nov 3, 2022

Changing the lines in requirements-lin-win-colab-CUDA.txt to this worked for me on Windows 11 in PowerShell with Python 3.10 installed via the Microsoft Store and using pew for my virtualenv:

--extra-index-url https://download.pytorch.org/whl/cu116 --trusted-host https://download.pytorch.org
torch==1.12.1+cu116

Then I activated my virtual environment:

pew workon invokeai

And ran pip to update dependencies:

pip install -r requirements-lin-win-colab-CUDA.txt

@desis123
Copy link

desis123 commented Nov 9, 2022

It worked, changed \invokeai\lib\site-packages\torch\distributed\elastic\timer\file_based_local_timer.py

def __init__(self, file_path: str, signal=signal.SIGKILL) to def __init__(self, file_path: str, signal=signal.SIGTERM)

Thanks !

I was having the same issue from another project, and your solution worked like a charm, it saved my days .

@psychedelicious
Copy link
Collaborator

We sorted this issue last week. I don't recall the specific PR or version, but at least in the upcoming v2.2 this is sorted.

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

8 participants