Closed Bug 1515741 Opened 6 years ago Closed 6 years ago

Python 3 installation on mac os

Categories

(Infrastructure & Operations :: RelOps: Puppet, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1521535

People

(Reporter: chmanchester, Unassigned)

References

Details

I'm working on getting an initial version of macOS PGO stood up in taskcluster. Because we're cross-compiling the mac builds we need to run this as three separate tasks, with the middle task running the build on native mac hardware in order to generate a profile. I'm hitting some issues related to the python 3 installation on these machines: the first is that /usr/bin/python3 doesn't exist on these machines, so scripts that start with "#!/usr/bin/python3 -u" aren't able to run. There is a python 3 installation present at "/tools/python36/bin/python3.6", however there appear to be some system libraries missing as using this immediately fails when attempting to import lzma.
We should probably change run-task/fetch-content/etc to use "#!/usr/bin/env python3" instead of hardcoding a path. Though there's some current discussion about python3 not being available on the $PATH in bug 1507488. So probably the only issue here is the failing lzma import (if it's due to a system library missing).
Hi Callek, is this something you can help us out with?
Flags: needinfo?(bugspam.Callek)
I'm not great with mac package creation, :catlee is this something you can help find an owner for? I suspect we just need to ensure the mac equiv of liblzma-dev is installed prior to building py3
Flags: needinfo?(bugspam.Callek) → needinfo?(catlee)

(In reply to Chris Manchester (:chmanchester) from comment #0)

I'm working on getting an initial version of macOS PGO stood up in
taskcluster. Because we're cross-compiling the mac builds we need to run
this as three separate tasks, with the middle task running the build on
native mac hardware in order to generate a profile.

catlee and I talked a bit about this recently; we're going to need to create a dedicated pool of minis for this, so that there remains a separation between lvl1 and lvl3 systems. right now, it's one big pool.

I'm hitting some issues related to the python 3 installation on these
machines: the first is that /usr/bin/python3 doesn't exist on these
machines, so scripts that start with "#!/usr/bin/python3 -u" aren't able to
run. There is a python 3 installation present at
"/tools/python36/bin/python3.6", however there appear to be some system
libraries missing as using this immediately fails when attempting to import
lzma.

:dragrom, you did most of the work around python 3, can you help out here?

Flags: needinfo?(catlee) → needinfo?(dcrisan)

(In reply to Kendall Libby [:fubar] (he/him) from comment #4)

(In reply to Chris Manchester (:chmanchester) from comment #0)

I'm working on getting an initial version of macOS PGO stood up in
taskcluster. Because we're cross-compiling the mac builds we need to run
this as three separate tasks, with the middle task running the build on
native mac hardware in order to generate a profile.

catlee and I talked a bit about this recently; we're going to need to create a dedicated pool of minis for this, so that there remains a separation between lvl1 and lvl3 systems. right now, it's one big pool.

I'm hitting some issues related to the python 3 installation on these
machines: the first is that /usr/bin/python3 doesn't exist on these
machines, so scripts that start with "#!/usr/bin/python3 -u" aren't able to
run. There is a python 3 installation present at
"/tools/python36/bin/python3.6", however there appear to be some system
libraries missing as using this immediately fails when attempting to import
lzma.

The python3 is installed on /tools/python36/bin/python3.6 and have symlink: /usr/local/bin/python3.
https://tools.taskcluster.net/groups/TVm9HJWEQ8-ile2bokAA6A/tasks/TVm9HJWEQ8-ile2bokAA6A/runs/0/logs/public%2Flogs%2Flive_backing.log

The PATH from the environment used by generic-worker is not the same with PATH used by OSX. To fix this, I created the bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1507488.

Please give me more details about missing libraries.

:dragrom, you did most of the work around python 3, can you help out here?

Flags: needinfo?(dcrisan) → needinfo?(cmanchester)

(In reply to Dragos Crisan [:dragrom] from comment #5)

Please give me more details about missing libraries.

Certainly. Thank you for your help. The issue can by seen in this try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=9563948446bfeec6b0d4b12189291ccaf599a4b8&selectedJob=218074339

Running just import lzma should reproduce the issue.

Flags: needinfo?(cmanchester)

Hello Dragos, is comment 6 enough to go from? Is this something you're able to work on?

Flags: needinfo?(dcrisan)

(In reply to Chris Manchester (:chmanchester) from comment #7)

Hello Dragos, is comment 6 enough to go from? Is this something you're able to work on?

run on OSX the following tests:

import lzma

  • the output
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/tools/python36/lib/python3.6/lzma.py", line 27, in <module>
    from _lzma import *
    ModuleNotFoundError: No module named '_lzma'

  • run help('lzma')
    problem in lzma - ModuleNotFoundError: No module named '_lzma'

  • run help('_lzma')
    No Python documentation found for '_lzma'.
    Use help() to get the interactive help utility.
    Use help(str) for help on the str class.

from what I saw, module lzma is installed on /tools/python36/lib/python3.6/.

[root@t-yosemite-r7-380.test.releng.mdc1.mozilla.com ~]# find / -name lzma*
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
/tools/python36/lib/python3.6/pycache/lzma.cpython-36.opt-1.pyc
/tools/python36/lib/python3.6/pycache/lzma.cpython-36.opt-2.pyc
/tools/python36/lib/python3.6/pycache/lzma.cpython-36.pyc
/tools/python36/lib/python3.6/lzma.py

Looking over _lzma, no module found in OSX:
[root@t-yosemite-r7-380.test.releng.mdc1.mozilla.com ~]# find / -name _lzma*
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory

Looking on linux workers, and running the following command: find / -name _lzma*, I received the following result:

/usr/lib/python3.5/lib-dynload/_lzma.cpython-35m-x86_64-linux-gnu.so

Looks like python3.6.5 standard package for OSX not have lzma support. need to create a custom dmg file to add lzma support.

Opened https://bugzilla.mozilla.org/show_bug.cgi?id=1521535

Depends on: 1521535
Flags: needinfo?(dcrisan)

The dependent bug mentioned in comment 8 took care of this. Thanks all!

Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.