Failed creating Parallels driver: Parallels Virtualization SDK is not installed

Svpernova09

Bit poster
I have previously used this M1 system with Version 17.1.1 to build Ubuntu 20.04 images from the bento template https://github.com/chef/bento/blob/main/packer_templates/ubuntu/ubuntu-20.04-arm64.json

system: 1st gen M1 Mac Mini 16GB
macOS: Monterey 12.3 (21E230)
Parallels: Version 17.1.2 (51548)
Packer Version: 1.8.0


Command output:

```
packer build --only=parallels-iso ubuntu-20.04-arm64.json
parallels-iso: output will be in this color.

Build 'parallels-iso' errored after 1 millisecond 431 microseconds: Failed creating Parallels driver: Parallels Virtualization SDK is not installed

==> Wait completed after 1 millisecond 476 microseconds

==> Some builds didn't complete successfully and had errors:
--> parallels-iso: Failed creating Parallels driver: Parallels Virtualization SDK is not installed

==> Builds finished but no artifacts were created.
```

I have uninstalled and reinstalled Parallels, rebooting in between. I've also tried installing the Parallels SDK from the DMG download and via brew, here's an example:

```
└── brew reinstall --cask parallels-virtualization-sdk

==> Downloading https://download.parallels.com/desk...rallelsVirtualizationSDK-17.1.1-51537-mac.dmg
Already downloaded: /Users/halo/Library/Caches/Homebrew/downloads/58beb8960bce34dcbc9e08392905cddf263e0fdb20d344cfcffd28f74ef9df5c--ParallelsVirtualizationSDK-17.1.1-51537-mac.dmg
==> Uninstalling Cask parallels-virtualization-sdk
==> Uninstalling packages; your password may be necessary:
com.parallels.pkg.sdk
==> Purging files for version 17.1.1-51537 of Cask parallels-virtualization-sdk
==> Installing Cask parallels-virtualization-sdk
==> Running installer for parallels-virtualization-sdk; your password may be necessary.
Package installers may write to any location; options such as `--appdir` are ignored.
installer: Package name is
installer: Installing at base path /
installer: The install was successful.
parallels-virtualization-sdk was successfully installed!
```

This comment seems to think it's Python related https://github.com/chef/bento/pull/1374#issuecomment-1079791274

I tried a few things to poke at the Python version but I couldn't get `prlsdkapi` installed into Python 3.8. I tried a few different python versions with no luck. Suggestions?
 
After poking around a bit more[1], my issue does indeed seem to be related to the python library symlink.
The trick was that the instructions earlier in this thread about linking from python 3.8 needs to be changed to 3.9 - probably because of macOS version differences, since it is tied to the system python. This is probably going to break again when macOS rolls over to python 3.10, so it would be ideal if the installer (either Parallels proper or the SDK) could figure out how to create the symlink properly or otherwise place/look at/in the correct location for the library.

Code:
sudo ln -s /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prlsdkapi.pth \ 
     /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/prlsdkapi.pth

Also helpful would be a more informative error message - "python library xxx not found at /some/path/to/a/library" rather than the more generic (and really, misleading) "the SDK is not installed"

[1] https://github.com/hashicorp/packer-plugin-parallels/issues/36
 
Sadly this is now broken _again_ for me. It was fixed for a while and is no longer working with newer versions of Parallels and MacOS 12.

I am running version 18.0.2-53077 for both Parallels and Parallels Virtualization SDK.
Packer is version 1.8.3 (latest stable). This includes version 1.0.3 of the Parallels plugin for Packer.

I tried the more recent workaround of:
`sudo ln -s /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prlsdkapi.pth /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/prlsdkapi.pth`

...but that did not fix the problem for me (note the version of 3.9 instead of the aforementioned 3.8). That workaround was mentioned on the Packer Parallels plugin GitHub project here: https://github.com/hashicorp/packer-plugin-parallels/issues/36#issuecomment-1246209535.
 
This is also broken in macOS 13 Ventura with Packer 1.8.3 and Parallels Virtualization SDK 18.0.2-53077.

The fix mentioned by other people resolved it for me too:
Code:
sudo ln -s /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prlsdkapi.pth /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/prlsdkapi.pth
 
This is also broken in macOS 13 Ventura with Packer 1.8.3 and Parallels Virtualization SDK 18.0.2-53077.
The fix mentioned by other people resolved it for me too:
Code:
sudo ln -s /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prlsdkapi.pth /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/prlsdkapi.pth
 
packer uses specifically /usr/bin/python3 and it might not be linked to python under /Library/Developer/CommandLineTools...
If previous symlinks didn't work for you. The following command would probably work in any case.

Code:
PTH_FILE_SRC="$(find /Library/Frameworks/Python.framework -type f -name 'prlsdkapi.pth')"
PTH_FILE_DEST_DIR=$(/usr/bin/python3 -c 'import sys;print([s for s in sys.path if "site-packages" in s][0])')
sudo ln -s "${PTH_FILE_SRC}" "${PTH_FILE_DEST_DIR}/prlsdkapi.pth"
 
You can work around it by setting PYTHONPATH. You may have to adjust this based on the versions you have installed. Just check the path before copy/pasting this:

Code:
PYTHONPATH=/Library/Frameworks/ParallelsVirtualizationSDK.framework/Versions/10/Libraries/Python/3.7 packer build -only=parallels-iso.vm ...
 
You can work around it by setting PYTHONPATH. You may have to adjust this based on the versions you have installed. Just check the path before copy/pasting this:

Code:
PYTHONPATH=/Library/Frameworks/ParallelsVirtualizationSDK.framework/Versions/10/Libraries/Python/3.7 packer build -only=parallels-iso.vm ...
Awesome solution as it doesn't involve tinkering with host symlinks.
 
This is still a bug/problem, and the error message "Parallels Virtualization SDK is not installed" is still as misleading as it was before, because clearly the package is installed.

Code:
Build 'parallels-iso.debian_12' errored ...: Failed creating Parallels driver: Parallels Virtualization SDK is not installed

Package is installed:

Code:
$ pkgutil --pkgs | grep parallels
com.parallels.pkg.sdk

$ brew info parallels-virtualization-sdk
==> parallels-virtualization-sdk: 18.3.1-53614
https://www.parallels.com/products/desktop/download/
/opt/homebrew/Caskroom/parallels-virtualization-sdk/18.3.1-53614 (2 files, 44.3MB)

Happy to update this post if I turn out to be wrong, but the symlink does not appear to be having any effect, so either it isn't the solution or something else has broken. Symlink exists as follows:

Code:
/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/prlsdkapi.pth 
    -> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prlsdkapi.pth
 
Back
Top