stable-diffusion
stable-diffusion copied to clipboard
Failure creating conda env on OSX amd64 - ResolvePackageNotFound: cudatoolkit=11.3
Following the guide in the README.md
, I attempted the following command and received an error:
conda env create -f environment.yaml
Collecting package metadata (repodata.json): done
Solving environment: failed
ResolvePackageNotFound:
- cudatoolkit=11.3
Machine Details
- Macbook Pro, AMD64, macOS 12.5.1
-
conda
installed throughhomebrew
withbrew install --cask miniconda
I am receiving this error as well via the miniconda installer.
+1 I'm having this issue on an Intel mac
having this problem as well
and the newest version of cudatoolkit for osx64 is 9.0 (check HERE).
I tried to set "- cudatoolkit=9.0" in environment.yaml and got this error:
Traceback (most recent call last):
File "scripts/txt2img.py", line 346, in <module>
main()
File "scripts/txt2img.py", line 242, in main
model = load_model_from_config(config, f"{opt.ckpt}")
File "scripts/txt2img.py", line 65, in load_model_from_config
model.cuda()
File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/pytorch_lightning/core/mixins/device_dtype_mixin.py", line 127, in cuda
return super().cuda(device=device)
File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 688, in cuda
return self._apply(lambda t: t.cuda(device))
File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 578, in _apply
module._apply(fn)
File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 578, in _apply
module._apply(fn)
File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 578, in _apply
module._apply(fn)
[Previous line repeated 1 more time]
File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 601, in _apply
param_applied = fn(param)
File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 688, in <lambda>
return self._apply(lambda t: t.cuda(device))
File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/cuda/__init__.py", line 210, in _lazy_init
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled
and the newest version of cudatoolkit for osx64 is 9.0 (check HERE).
I tried to set "- cudatoolkit=9.0" in environment.yaml and got this error:
Traceback (most recent call last): File "scripts/txt2img.py", line 346, in <module> main() File "scripts/txt2img.py", line 242, in main model = load_model_from_config(config, f"{opt.ckpt}") File "scripts/txt2img.py", line 65, in load_model_from_config model.cuda() File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/pytorch_lightning/core/mixins/device_dtype_mixin.py", line 127, in cuda return super().cuda(device=device) File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 688, in cuda return self._apply(lambda t: t.cuda(device)) File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 578, in _apply module._apply(fn) File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 578, in _apply module._apply(fn) File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 578, in _apply module._apply(fn) [Previous line repeated 1 more time] File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 601, in _apply param_applied = fn(param) File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 688, in <lambda> return self._apply(lambda t: t.cuda(device)) File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/cuda/__init__.py", line 210, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled
this patch will https://github.com/ModeratePrawn/stable-diffusion-cpu/pull/1/files run on CPU when GPU is not enabled. it will take approx an hour to generate results
and the newest version of cudatoolkit for osx64 is 9.0 (check HERE). I tried to set "- cudatoolkit=9.0" in environment.yaml and got this error:
Traceback (most recent call last): File "scripts/txt2img.py", line 346, in <module> main() File "scripts/txt2img.py", line 242, in main model = load_model_from_config(config, f"{opt.ckpt}") File "scripts/txt2img.py", line 65, in load_model_from_config model.cuda() File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/pytorch_lightning/core/mixins/device_dtype_mixin.py", line 127, in cuda return super().cuda(device=device) File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 688, in cuda return self._apply(lambda t: t.cuda(device)) File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 578, in _apply module._apply(fn) File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 578, in _apply module._apply(fn) File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 578, in _apply module._apply(fn) [Previous line repeated 1 more time] File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 601, in _apply param_applied = fn(param) File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 688, in <lambda> return self._apply(lambda t: t.cuda(device)) File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/cuda/__init__.py", line 210, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled
this patch will https://github.com/ModeratePrawn/stable-diffusion-cpu/pull/1/files run on CPU when GPU is not enabled. it will take approx an hour to generate results
it works! and as you said, it's extremely slow..
Same issue here. macOS 12.5.1 Intel i7 AMD Radeon R9 M395.
+1
I have this error both with anaconda
and with miniconda
. 😐
Getting this as well. Looks like the issue is that there's no 11.3 build for Mac yet, even though the package on anaconda says 11.3, the mac build is stuck at 9.0 and has been for a year. Does this mean no one has been able to set up SD locally on a Mac at all? I'm new to all this and that seems unlikely. There must be a workaround then that doesn't involve using CPU only?
Same issue here +1
+1 same issue on a Mac M1 with anaconda.
According to the NVIDIA website, it looks like cudatoolkit is no longer supported on Mac:
NVIDIA® CUDA Toolkit 11.3 no longer supports development or running applications on macOS. While there are no tools which use macOS as a target environment, NVIDIA is making macOS host versions of these tools that you can launch profiling and debugging sessions on supported target platforms.
https://developer.nvidia.com/nvidia-cuda-toolkit-11_3_0-developer-tools-mac-hosts
and the newest version of cudatoolkit for osx64 is 9.0 (check HERE). I tried to set "- cudatoolkit=9.0" in environment.yaml and got this error:
Traceback (most recent call last): File "scripts/txt2img.py", line 346, in <module> main() File "scripts/txt2img.py", line 242, in main model = load_model_from_config(config, f"{opt.ckpt}") File "scripts/txt2img.py", line 65, in load_model_from_config model.cuda() File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/pytorch_lightning/core/mixins/device_dtype_mixin.py", line 127, in cuda return super().cuda(device=device) File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 688, in cuda return self._apply(lambda t: t.cuda(device)) File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 578, in _apply module._apply(fn) File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 578, in _apply module._apply(fn) File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 578, in _apply module._apply(fn) [Previous line repeated 1 more time] File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 601, in _apply param_applied = fn(param) File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 688, in <lambda> return self._apply(lambda t: t.cuda(device)) File "/Users/rathinho/opt/miniconda3/envs/ldm/lib/python3.8/site-packages/torch/cuda/__init__.py", line 210, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled
this patch will https://github.com/ModeratePrawn/stable-diffusion-cpu/pull/1/files run on CPU when GPU is not enabled. it will take approx an hour to generate results
So how to use these file : https://github.com/ModeratePrawn/stable-diffusion-cpu/pull/1/files? Replace some of the files in stable diffusion ? Thanks
I assume this is related to PyTorch using Cuda. But there is now in PyTorch this: https://pytorch.org/blog/introducing-accelerated-pytorch-training-on-mac/
Which uses Apple's Metal APIs to work on GPU. I'm not sufficiently familiar with PyTorch or stable-diffusion to fix this issue myself. (Was just trying out stable-diffusion and couldn't set up the conda env like the OP).
If anyone has any suggestions or pointers, I'm happy to work on this. But I do need some starting guidance.
Running into this issue as well. Is there any workaround?
cudatoolkit on mac is at version 9.0. Appears that the best method may be to try to deploy the environment to a remote server which has the correct hardware. Still learning though..
I just got past this issue doing the following:
- Install the latest version of
cudatoolkit
withconda install -c anaconda cudatoolkit
- Edit
environment.yaml
and replacecudatoolkit
's version from 11.3 to the version just installed (mine was 9.0) - Rerun
conda env create -f environment.yaml
and it should get to the end. - Run
conda activate ldm
I'm stuck now in the next step:
After obtaining the stable-diffusion-v1-*-original weights, link them
- How/where do you obtain the weights?
- In this command
ln -s <path/to/model.ckpt> models/ldm/stable-diffusion-v1/model.ckpt
where ispath/to/model.ckpt
or an example?
https://github.com/CompVis/stable-diffusion/issues/309#issue-1381207452
The solution suggested by @julianj did not work for me. Here is the result which I got after running conda install -c anaconda cudatoolkit
:
Collecting package metadata (current_repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. Collecting package metadata (repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- cudatoolkit
Current channels:
- https://conda.anaconda.org/anaconda/osx-arm64
- https://conda.anaconda.org/anaconda/noarch
- https://conda.anaconda.org/pytorch/osx-arm64
- https://conda.anaconda.org/pytorch/noarch
- https://conda.anaconda.org/conda-forge/osx-arm64
- https://conda.anaconda.org/conda-forge/noarch
- https://repo.anaconda.com/pkgs/main/osx-arm64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/osx-arm64
- https://repo.anaconda.com/pkgs/r/noarch
To search for alternate channels that may provide the conda package you're looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
So I did the same as suggested above, got a lot of links to download it but all are failing and showing same message.
I just got past this issue doing the following:
- Install the latest version of
cudatoolkit
withconda install -c anaconda cudatoolkit
- Edit
environment.yaml
and replacecudatoolkit
's version from 11.3 to the version just installed (mine was 9.0)- Rerun
conda env create -f environment.yaml
and it should get to the end.- Run
conda activate ldm
I'm stuck now in the next step:
After obtaining the stable-diffusion-v1-*-original weights, link them
- How/where do you obtain the weights?
- In this command
ln -s <path/to/model.ckpt> models/ldm/stable-diffusion-v1/model.ckpt
where ispath/to/model.ckpt
or an example?
The weights can be found here: https://huggingface.co/CompVis
Got the same issue here with my 2019 Intel Mac Ventura 13.2.1. However, after several temptations of adjusting the codes, Conda in terminal asked me if I would downgrade a bunch of packages to download cudatoolkit ( not sure which version ). I typed y then the downloading succeeded, whereas it still showed the same error while creating an env for stable diffusion file.
Someone needs to port PyTorch's new macOS support to this project.
Same same M1 mac no cudatoolkit package (edited dependency to 9.0) -> package no longer supported for macOS -> STUCK
update mac system to the latest. I find,
The solution provided by @julianj works for me.
My machine info is
MacBook Pro (13-inch, 2020, Two Thunderbolt 3 ports)
1.4 GHz Quad-Core Intel Core i5
Intel Iris Plus Graphics 645 1536 MB
Now I'm trying to obtain the weights.
Got this error as well.
5 months since the last post and it's still not possible to install stable diffusion locally on a mac?
Trying to use pytoch and cudatoolkit for Meta AudioCraft AI. Machine MacBook Pro , Chip Apple M1 Max. Same issue, no solution, thanks for posting this issue.