# Interfacing with Python - PIL import error

**URL:** <https://mworks.discourse.group/t/interfacing-with-python-pil-import-error/996>\
**Category:** Support\
**Created:** [June 21, 2024, 7:50pm UTC](https://mworks.discourse.group/t/interfacing-with-python-pil-import-error/996 "2024-06-21T19:50:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![skmar](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@skmar](https://mworks.discourse.group/u/skmar)\
**Post date:** [June 21, 2024, 7:50pm UTC](https://mworks.discourse.group/t/interfacing-with-python-pil-import-error/996/1 "2024-06-21T19:50:17Z")

</div>

Hi Chris,

I am trying to run some Python code through MWorks, and am running into issues installing packages, specifically regarding the file: \_imaging.cpython-39-darwin.so in the PIL package.

The issue seemed related to [this](https://mworks.discourse.group/t/new-mworks-python/272) one regarding ctypes, but the importlib.util solution did not work for me (gave a similar error as “have ‘x86\_64’, need ‘arm64’”).

I am using Python 3.9, and have tried MWorks 0.11 and 0.12.1, running on macOS Sonoma 14.3.1. The Python script runs fine outside of MWorks. Any ideas?

Thank you!

 ![Screenshot 2024-06-21 at 3.39.25 PM](https://canada1.discourse-cdn.com/flex031/uploads/mworks/original/1X/f71b467457563b0b0c2f7984dfafcb912aeafe6c.png)

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [June 24, 2024, 1:41pm UTC](https://mworks.discourse.group/t/interfacing-with-python-pil-import-error/996/2 "2024-06-24T13:41:09Z")

</div>

Hi Sol,

It looks like you have an x86\_64 (Intel) build of Python, but you’re trying to use it with an arm64 (Apple Silicon) MWServer process. That isn’t going to work.

The best solution would be to download and install an Apple Silicon [build of Anaconda](https://www.anaconda.com/download/success), and use that with MWorks. Alternatively, you can force MWServer to run as an Intel process via [Rosetta 2](https://support.apple.com/en-us/HT211861). However, this does degrade performance somewhat, so the first approach is preferable.

Cheers,  
Chris

---

<div class="post-metadata">

**Author:** ![skmar](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@skmar](https://mworks.discourse.group/u/skmar)\
**Post date:** [June 24, 2024, 4:41pm UTC](https://mworks.discourse.group/t/interfacing-with-python-pil-import-error/996/3 "2024-06-24T16:41:10Z")

</div>

This worked, thank you!

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [June 27, 2024, 9:10pm UTC](https://mworks.discourse.group/t/interfacing-with-python-pil-import-error/996/4 "2024-06-27T21:10:30Z")

</div>


