<div dir="ltr"><div dir="ltr">Now that I have it working, I recall that the runtime challenge for a portable/embeddable distro on Linux is in the system configuration handling.  This has always been a complicated fundamental behavior which has prevented or complicated many "portability" cases in the past.   </div><div dir="ltr"><br></div><div>There are many projects which have managed to ship portable/relocatable python installations in the past.  Maybe looking at them will be helpful in deciding how to deal with the situation here.</div><div dir="ltr"><div><br clear="all"><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Gerald R. Wiltse<br><a href="mailto:jerrywiltse@gmail.com" target="_blank">jerrywiltse@gmail.com</a></div></div><div dir="ltr"><br></div></div></div></div></div></div></div></div></div></div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 3, 2019 at 1:02 PM Gerald Wiltse <<a href="mailto:jerrywiltse@gmail.com">jerrywiltse@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I have it working on linux now.  Is now a good time to open a ticket on Issue Tracker?<div><br clear="all"><div><div dir="ltr" class="gmail-m_2893040466649050419gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Gerald R. Wiltse<br><a href="mailto:jerrywiltse@gmail.com" target="_blank">jerrywiltse@gmail.com</a></div></div><div dir="ltr"><br></div></div></div></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 3, 2019 at 11:55 AM Gerald Wiltse <<a href="mailto:jerrywiltse@gmail.com" target="_blank">jerrywiltse@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Ok, disregard previous message.  I fixed the PYTHONPATH in my command and the .pyc files and .  I also saw that python36._pth is specifically only supported by windows. <div><br></div><div>Now i'm moved on to the following error: </div><div><br></div><div>zipimport.ZipImportError: can't decompress data; zlib not available<div><br></div><div>I'm on Ubuntu.  I've definitely got zlib1g-dev package installed, and I've recompiled a number of times trying to get it to work.  I've tried Ubuntu 16 and 18.  </div><div><br></div><div>Is this just a limitation on linux?</div><div><br clear="all"><div><div dir="ltr" class="gmail-m_2893040466649050419gmail-m_-8660878265511107931gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Gerald R. Wiltse<br><a href="mailto:jerrywiltse@gmail.com" target="_blank">jerrywiltse@gmail.com</a></div></div><div dir="ltr"><br></div></div></div></div></div></div></div></div></div></div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 2, 2019 at 4:29 PM Gerald Wiltse <<a href="mailto:jerrywiltse@gmail.com" target="_blank">jerrywiltse@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Just an update based on testing.  If I zip the modules up into python36.zip (whether in .py or .pyc form) the linux binary does not find them.  If I copy them into the embedded root, alongside the python executable, it finds them as expected. <div><br></div><div>This just makes it seem more like an issue where Linux binary does not respect .zip file as a source of modules. <br><div><br clear="all"><div><div dir="ltr" class="gmail-m_2893040466649050419gmail-m_-8660878265511107931gmail-m_7989670256409503106gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Gerald R. Wiltse<br><a href="mailto:jerrywiltse@gmail.com" target="_blank">jerrywiltse@gmail.com</a></div></div><div dir="ltr"><br></div></div></div></div></div></div></div></div></div></div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 2, 2019 at 2:56 PM Gerald Wiltse <<a href="mailto:jerrywiltse@gmail.com" target="_blank">jerrywiltse@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>With minimal patching of tools/msi/make_zip.py, I was able to create an equivalent zip package on Linux.  It doesn't work out of the box of course.  I had to do two commands </div><div><br></div><div>My biggest concern is that even if the layout is "correct" on linux, the python runtime might not actually support being run like this on Linux.  Perhaps the code for using python36.zip as a landmark and source of modules is only implemented on Windows.  Do you know if that is the case?</div><div><br class="gmail-m_2893040466649050419gmail-m_-8660878265511107931gmail-m_7989670256409503106gmail-m_-2697648913527887337gmail-Apple-interchange-newline">    tmp$ export LD_LIBRARY_PATH=$(pwd) </div>    tmp$ export PYTHONHOME=$(pwd)<div>    tmp$ export PYTHONPATH=$(pwd) <br></div><div><div>    tmp$ ./python</div><div>    Fatal Python error: Py_Initialize: Unable to get the locale encoding<br></div><div>    ModuleNotFoundError: No module named 'encodings'</div><div><br></div><div>    Current thread 0x00007fdde9eb1680 (most recent call first):</div><div>    Aborted (core dumped)</div></div><div><br></div><div>Here's the full directory structure, error, and patch I created. Any additional feedback would be great.</div><div><br></div><div><a href="https://gist.github.com/solvingj/87305e0f70e14d738d6989ba2f41352f" target="_blank">https://gist.github.com/solvingj/87305e0f70e14d738d6989ba2f41352f</a>  <br></div><div><br clear="all"><div><div dir="ltr" class="gmail-m_2893040466649050419gmail-m_-8660878265511107931gmail-m_7989670256409503106gmail-m_-2697648913527887337gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Gerald R. Wiltse<br><a href="mailto:jerrywiltse@gmail.com" target="_blank">jerrywiltse@gmail.com</a></div></div><div dir="ltr"><br></div></div></div></div></div></div></div></div></div></div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 2, 2019 at 11:24 AM Gerald Wiltse <<a href="mailto:jerrywiltse@gmail.com" target="_blank">jerrywiltse@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I've successfully automated the build of the embedded zip on Windows for 3.6 on my internal CI using tools/msi script.  </div><div><br></div><div>Moving onto linux, can you please summarize the primary challenges/differences for creating the embeddable zip for linux?</div><br clear="all"><div><div dir="ltr" class="gmail-m_2893040466649050419gmail-m_-8660878265511107931gmail-m_7989670256409503106gmail-m_-2697648913527887337gmail-m_1310715669642776505gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Gerald R. Wiltse<br><a href="mailto:jerrywiltse@gmail.com" target="_blank">jerrywiltse@gmail.com</a></div></div><div dir="ltr"><br></div></div></div></div></div></div></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 1, 2019 at 2:47 PM Gerald Wiltse <<a href="mailto:jerrywiltse@gmail.com" target="_blank">jerrywiltse@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Yes, I'll help with this, and I try to get signed up with an account for the issue tracker ASAP. </div><div><br></div><div>I've just started trying to build create the embeddable package for windows locally (all from source).  Once I have that automated, I'll take a naive stab at the Linux layout.  I'm sure i'll soon hit the additional complications you're talking about and come back to you with questions. </div><br clear="all"><div><div dir="ltr" class="gmail-m_2893040466649050419gmail-m_-8660878265511107931gmail-m_7989670256409503106gmail-m_-2697648913527887337gmail-m_1310715669642776505gmail-m_-1209354490252600647gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Gerald R. Wiltse<br><a href="mailto:jerrywiltse@gmail.com" target="_blank">jerrywiltse@gmail.com</a></div></div><div dir="ltr"><br></div></div></div></div></div></div></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 1, 2019 at 1:57 PM Steve Dower <<a href="mailto:steve.dower@python.org" target="_blank">steve.dower@python.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 01May2019 1305, Gerald Wiltse wrote:<br>
> That does help, thanks so much for the fast response!  I now see how <br>
> it's executed on Azure pipelines also, so that should be enough for me <br>
> to reverse engineer the rest.<br>
> <br>
> Followup questions if you have time:<br>
> 1. It seems that directory doesn't exist in the 3.6 branches/tags, so it <br>
> must have been done a different way back then.  Do you think it's <br>
> back-portable to 3.6?<br>
<br>
Yep, it should work with 3.6. There were scripts under Tools/msi back <br>
then that did the same thing, but with the Store app I rewrote it to be <br>
more flexible.<br>
<br>
> 2. One of our objectives is to effectively create a nearly identical <br>
> embeddable package for linux. Do you think the layout code is generic <br>
> enough to be modified to create a linux equivalent?<br>
<br>
Probably not, it's under the "PC" directory because it is entirely <br>
CPython specific.<br>
<br>
I'd love to be able to have a similar embeddable distro for Linux (and <br>
macOS), and I'll be investing some of my time in working towards this, <br>
but it's far more complicated than simply laying out the right files. If <br>
you're interested in helping with this, then we're in the right place to <br>
discuss it, but we'll likely have to move to the issue tracker at some <br>
point once we figure out who else wants/needs to be involved.<br>
<br>
> Obviously, there are many alternative methods and documents for creating <br>
> "embeddable" pythons on linux, but the windows package has all the <br>
> characteristics we want, and of course we'd like our Windows and Linux <br>
> process build and packaging processes to be as similar as possible, so <br>
> it seems attractive to try to port this layout script to linux.<br>
<br>
"make install" already does the same thing, but the install location <br>
matters at build time, so it's a little more complex to make it work as <br>
an embedded runtime. I'm sure there are people who know how to make it <br>
work though.<br>
<br>
Cheers,<br>
Steve<br>
</blockquote></div>
</blockquote></div>
</blockquote></div></div></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>