title: How to bundle a python server with pyinstaller for AppStore as 64bit only?
body: <p><strong>Context:</strong></p>
  
  <p>I am trying to put an electron app on the App Store. The app features a web frontend and a python backend. Nothing fancy so far.</p>
  
  <p>The backend however features a separate server written in python. This server is a standalone application.</p>
  
  <p>The electron app bundles the main app together with the python standalone server.</p>
  
  <p><strong>The problem:</strong></p>
  
  <p>When building the server as an executable I use pyinstaller on a python 3.5 development environment. Upon uploading to the AppStore I receive the following error: </p>
  
  <pre><code>1 package(s) were not uploaded because they had problems:
  /var/folders/39/3v0phzy173s3qxkbxzvcpd5c0000gn/T/82AB662A-44C8-41E9-A213-8BF672F3DF10/1443777291.itmsp - Error Messages:
      ERROR ITMS-90240: "Unsupported Architectures. Your executable contained the following disallowed architectures: '[i386 (in com.ShapeRobotics.FableMac.pkg/Payload/Fable.app/Contents/Resources/app/app/app/server/AppKit._AppKit.so, com.ShapeRobotics.FableMac.pkg/Payload/Fable.app/Contents/Resources/app/app/app/server/AppKit._inlines.so, com.ShapeRobotics.FableMac.pkg/Payload/Fable.app/Contents/Resources/app/app/app/server/CoreFoundation._CoreFoundation.so, com.ShapeRobotics.FableMac.pkg/Payload/Fable.app/Contents/Resources/app/app/app/server/CoreFoundation._inlines.so, com.ShapeRobotics.FableMac.pkg/Payload/Fable.app/Contents/Resources/app/app/app/server/Foundation._Foundation.so, com.ShapeRobotics.FableMac.pkg/Payload/Fable.app/Contents/Resources/app/app/app/server/Foundation._inlines.so, com.ShapeRobotics.FableMac.pkg/Payload/Fable.app/Contents/Resources/app/app/app/server/PIL._imaging.so, com.ShapeRobotics.FableMac.pkg/Payload/Fable.app/Contents/Resources/app/app/app/server/PIL._imagingtk.so, com.ShapeRobotics.FableMac.pkg/Payload/Fable.app/Contents/Resources/app/app/app/server/PIL._webp.so, com.ShapeRobotics.FableMac.pkg/Payload/Fable.app/Contents/Resources/app/app/app/server/libjpeg.9.dylib, com.ShapeRobotics.FableMac.pkg/Payload/Fable.app/Contents/Resources/app/app/app/server/libopenjp2.2.1.0.dylib, com.ShapeRobotics.FableMac.pkg/Payload/Fable.app/Contents/Resources/app/app/app/server/libtiff.5.dylib, com.ShapeRobotics.FableMac.pkg/Payload/Fable.app/Contents/Resources/app/app/app/server/libwebp.7.dylib, com.ShapeRobotics.FableMac.pkg/Payload/Fable.app/Contents/Resources/app/app/app/server/libwebpdemux.2.dylib, com.ShapeRobotics.FableMac.pkg/Payload/Fable.app/Contents/Resources/app/app/app/server/libwebpmux.3.dylib, com.ShapeRobotics.FableMac.pkg/Payload/Fable.app/Contents/Resources/app/app/app/server/libz.1.2.11.dylib, com.ShapeRobotics.FableMac.pkg/Payload/Fable.app/Contents/Resources/app/app/app/server/objc._objc.so)]'. New apps submitted to the Mac App Store must support 64-bit starting January 2018, and Mac app updates and existing apps must support 64-bit starting June 2018."
  </code></pre>
  
  <p>We tried building the server using this:</p>
  
  <pre><code>pyinstaller server.spec --distpath ../app/app --noconfirm
  </code></pre>
  
  <p>It didn't work.</p>
  
  <p>Another incantation I use to bundle the python server trying to force 64bit is:</p>
  
  <pre><code>arch -64 python ~/anaconda3/envs/shape/bin/pyinstaller server.spec -s --osx-bundle-identifier com.ShapeRobotics.FableMac --distpath ../app/app --noconfirm"
  </code></pre>
  
  <p><strong>Why I'm sure it's the server:</strong></p>
  
  <p>I was successful in signing the app and getting it uploaded to the AppStore w/o the server packed in.</p>
  
  <p>After packing in the server the 'i386' architecture error popped up.</p>
  
  <p>Consequently my efforts so far have been focused to eliminate any shred of 32bit code in the server.</p>
  
  <p>I assume that in order to do this I must properly configure the .spec file used by pyInstaller. </p>
  
  <p><strong>Does this make sense?</strong></p>
  
  <p><strong>Is there a way to configure the spec file to force exclusive 64bit on anything bundled inside?</strong></p>
  
  <p><strong>Is there some clear cut way to make the AppStore upload not vomit the 'i386' error?</strong></p>
  
  <p>Thank you!</p>