AUTOMATIC1111 / stable-diffusion-webui-tensorrt

MIT License
311 stars 20 forks source link

Can't install Pycuda #6

Closed theoretischer closed 1 year ago

theoretischer commented 1 year ago

Every time i try to install pycuda it just outputs this:

              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'pycuda.cuda' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'pycuda.cuda' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'pycuda.cuda' to be distributed and are
              already explicitly excluding 'pycuda.cuda' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html

              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

I have tried updating wheel, pip and other things but nothing helped. am i missing something?

MoreColors123 commented 1 year ago

Having the same or a similar problem, my log starts like this:

venv "C:\programs\stable-diffusion-webui_RT\venv\Scripts\Python.exe" Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] Version: v1.3.0-72-gb957dcfe Commit hash: b957dcfece29c84ac0cfcd5a69475ff8684c531f Installing requirements Error running install.py for extension C:\programs\stable-diffusion-webui_RT\extensions\stable-diffusion-webui-tensorrt. Command: "C:\programs\stable-diffusion-webui_RT\venv\Scripts\python.exe" "C:\programs\stable-diffusion-webui_RT\extensions\stable-diffusion-webui-tensorrt\install.py" Error code: 1 stdout: Installing pycuda

stderr: Traceback (most recent call last): File "C:\programs\stable-diffusion-webui_RT\extensions\stable-diffusion-webui-tensorrt\install.py", line 30, in install() File "C:\programs\stable-diffusion-webui_RT\extensions\stable-diffusion-webui-tensorrt\install.py", line 23, in install launch.run_pip(f'install pycuda', "pycuda") File "C:\programs\stable-diffusion-webui_RT\modules\launch_utils.py", line 124, in run_pip return run(f'"{python}" -m pip {command} --prefer-binary{index_url_line}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}", live=live) File "C:\programs\stable-diffusion-webui_RT\modules\launch_utils.py", line 101, in run raise RuntimeError("\n".join(error_bits)) RuntimeError: Couldn't install pycuda. Command: "C:\programs\stable-diffusion-webui_RT\venv\Scripts\python.exe" -m pip install pycuda --prefer-binary Error code: 1 stdout: Collecting pycuda Using cached pycuda-2022.2.2.tar.gz (1.7 MB) Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Preparing metadata (pyproject.toml): started Preparing metadata (pyproject.toml): finished with status 'done' Collecting mako Using cached Mako-1.2.4-py3-none-any.whl (78 kB) Collecting appdirs>=1.4.0 Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB) Collecting pytools>=2011.2 Using cached pytools-2014.2-py2.py3-none-any.whl (51 kB) Collecting decorator>=3.2.0 Using cached decorator-5.1.1-py3-none-any.whl (9.1 kB) Requirement already satisfied: MarkupSafe>=0.9.2 in c:\programs\stable-diffusion-webui_rt\venv\lib\site-packages (from mako->pycuda) (2.1.2) Building wheels for collected packages: pycuda Building wheel for pycuda (pyproject.toml): started Building wheel for pycuda (pyproject.toml): finished with status 'error' Failed to build pycuda

stderr: error: subprocess-exited-with-error

Building wheel for pycuda (pyproject.toml) did not run successfully. exit code: 1

merc4derp commented 1 year ago

Contrary to the readme, it seems you do need cuda toolkit installed for pycuda.

theoretischer commented 1 year ago

I think this kind of worked but now i get error:

Error loading script: trt.py
Traceback (most recent call last):
  File "C:\Software\stable-diffusion-webui\beta\stable-diffusion-webui\modules\scripts.py", line 263, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "C:\Software\stable-diffusion-webui\beta\stable-diffusion-webui\modules\script_loading.py", line 10, in load_module
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Software\stable-diffusion-webui\beta\stable-diffusion-webui\extensions\stable-diffusion-webui-tensorrt\scripts\trt.py", line 11, in <module>
    import pycuda.driver as cuda
ModuleNotFoundError: No module named 'pycuda.driver'
theoretischer commented 1 year ago

Ok i just removed pycuda and let it reinstall itself and now it works. Thanks to @merc4derp, it really jut was the toolkit

MoreColors123 commented 1 year ago

If I may ask: Where exactly did you remove pycuda?