FIXED: SSL Python Module Missing from Apple Silicon Build

Hey! I’ve been working on a plugin to run stable diffusion in TouchDesigner that uses an API and it’s been working fine on all versions except for the Apple Silicone version of TouchDesigner2022.3103 on an M1 (same with 1 build earlier).

I tried using the python requests library and get the error: “Can’t connect to HTTPS URL because the SSL module is not available”. Digging deeper I opened up a brand new project, went into the text port and ran import ssl and got “no such file”. Running import ssl on the intel version does work correctly.

I know I could just manually install the ssl library and add it to my path, but I’ve been doing a lot of workarounds to only use the python libraries that come pre-packed in TD so that people can start using the component right away without python experience. Any help would be greatly appreciated.

Best,
Torin

Also, you all are doing amazing work :slight_smile:

Hey @tblankensmith

I just gave it a try from the textport in a blank project and it seems fine:

python >>> import ssl
python >>> ssl
<module 'ssl' from '/Applications/TouchDesigner.2022.31030.arm64_DEV.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py'>

are you loading another python environment ? from homebrew or anaconda ?

Thanks,
Michel

Hi Michel

That’s interesting. I tested a clean install of TouchDesigner for Apple Silicone. The person who’s computer I ran it on isn’t a developer so they haven’t installed any developer tools or modified their path. I’ve had at least 3 people on an M1 run into this.

Is there any system info I can pass along, or tests that I can run?

Best
T

OS version number + detailed hardware can always be useful.

I’m checking with the team internally for the issue to be tested on different hardware.

Best,
Michel

Hey @JetXS,

I think I found something. It looks like TD’s python environment is searching for ssl through brew even though brew is not installed on the computer.

Here’s the error message I get on the computer when I run import ssl:

python >>> import ssl
ImportError: dlopen(/Applications/TouchDesigner.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload/_ssl.cpython-39-darwin.so, 0x0002): Library not loaded: /opt/homebrew/opt/openssl@1.1/lib/libssl.1.1.dylib
  Referenced from: /Applications/TouchDesigner.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload/_ssl.cpython-39-darwin.so
  Reason: tried: '/opt/homebrew/opt/openssl@1.1/lib/libssl.1.1.dylib' (no such file), '/usr/local/lib/libssl.1.1.dylib' (no such file), '/usr/lib/libssl.1.1.dylib' (no such file)
python >>>

When I run brew in the terminal I get this:

brew
zsh: command not found: brew 

zsh isn’t installed either.

There’s no .bash_profile, .bashrc, or .zshrc on the computer either.

Here’s the computer spec:

Mac OS Monterey 12.2.1
Apple M1 Max

Here’s the error I receive:

python >>> import ssl
ImportError: dlopen(/Applications/TouchDesigner-Experimental.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload/_ssl.cpython-39-darwin.so, 0x0002): Library not loaded: '/opt/homebrew/opt/openssl@1.1/lib/libssl.1.1.dylib'
  Referenced from: '/Applications/TouchDesigner-Experimental.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload/_ssl.cpython-39-darwin.so'
  Reason: tried: '/opt/homebrew/opt/openssl@1.1/lib/libssl.1.1.dylib' (no such file), '/usr/local/lib/libssl.1.1.dylib' (no such file), '/usr/lib/libssl.1.1.dylib' (no such file)
python >>> ssl
Traceback (most recent call last):
  File "<Textport>", line 1
NameError: name 'ssl' is not defined

Mac M1 Pro 12.5.1
TD 2022.22650
Brew installed, and I’ve installed libssl1.1

Contents of /opt/homebrew/opt/openssl@1.1/lib/:

/opt/homebrew/opt/openssl@1.1/lib
libcrypto.1.1.dylib	libssl.1.1.dylib

Just updated TD to 2022.31030, same error when importing SSL. I also had an issue with my .zshrc but updated the path to point to libssl1.1 instead of libssh3, which I downgraded earlier to match the lib TD was trying to load.

Got openssl to work on Mac 12.5.1. In Terminal:

  1. brew uninstall --ignore-dependencies openssl@1.1
  2. brew install openssl@1.1
  3. brew link --force openssl@1.1
  4. echo ‘export PATH=“/opt/homebrew/opt/openssl@1.1/bin:$PATH”’ >> ~/.zshrc
  5. source ~/.zshrc
  6. Test in TD using the Textport. import ssl - Expected result, newline with no errors

This solved my issues! M2 Apple silicone. Thank you!!

1 Like

This is very strange. There was an issue with that .so, but we fixed it last year. Can you .zip your TouchDesigner.app folder and share it with us (dropbox or something). You definitely should not need to install homebrew or do any path tricks to get this to work.

1 Like

I’ve found the issue and this should be fixed in builds 2022.31280 and later.
Thanks for the report and your patience.

1 Like

Thanks Malcolm!

Had the same issue. Posting my details in case it helps improve future versions.(skip if you’re looking for a diff solution than the one mentioned above)

Mac M1 Max Laptop
TD v2022.31030
Issue started while running Monterey 12.3, upgraded to 12.6.3 with no improvement.

First Noticed the issue when trying to gather APIs for an Interactive HQ Tutorial.
Received error:
“urllib3.exceptions.SSLError: Can’t connect to HTTPS URL because the SSL module is not available.”

My project before this (which could have changed my clean new mac system) involved hooking up an Oak-D depth cam using Pycharms to make a Python3.10 Virtual Environment. Before encountering the SSL error I did turn on “Python 64-bit Module Path” in preferences and selected my system level instal of Python 3.10 But that shouldn’t have been accessing the virtual environment (I assume?). But got the same errors after turning that back off, which (again, assuming) should just then be using the clean TD version. Either way, the solution above fixed things here as well. THANKS ALL!

Hi, I am having issues with the stable diffusion plug in. It was working initially but when I updated my TD to the latest version (2023.11340) I am getting this error. I have a Mac book 2019, OS Monterey. I am not sure how to fix this. Thank you.

We’ve fixed this issue that occurs on Intel macs. The next build we have will include it. sorry about that.