apple / ml-stable-diffusion

Stable Diffusion with Core ML on Apple Silicon
MIT License
16.79k stars 935 forks source link

no such module 'PackageDescription' #68

Open spaceexperiment opened 1 year ago

spaceexperiment commented 1 year ago

I have Apple Swift version 5.7.2, xcode-select version 2396. and Ventura 13.1

when I run swift run StableDiffusionSample "a photo of an astronaut riding a horse on mars" --resource-path models/coreml-stable-diffusion-v1-4_original_compiled --seed 93 --output-path /Users/jibril/stablediffusion/output I get this error

.../Package.swift:4:8: error: no such module 'PackageDescription'
import PackageDescription
mjankowski commented 1 year ago

I think the --resource-path argument here is looking for the Resources directory which would have been created during the previous conversion step. This is easy to overlook in the readme, I did the same thing at first. If you re-run the conversion step with the --bundle-resources-for-swift-cli enabled, it should work.

khakimjanovich commented 1 year ago

I have the same issue. And --bundle-resources-for-swift-cli didn't fix the problem

mextex commented 1 year ago

The following command fixed it for me: sudo xcode-select --switch /Applications/Xcode.app The problem was that xcode-select --print-path pointed to "CLI tools" instead of pointing to "Xcode.app". As described here: https://forums.kodeco.com/t/server-error-no-such-module-packagedescription/177438

RucktFinity commented 1 year ago

I came across this error: error: no such module 'PackageDescription' import PackageDescription with a different package I was using. Using: sudo xcode-select --switch /Applications/Xcode.app worked for me.