LOL yes indeed :)

Turns out in the end I just had to unset __PYTHON_LAUNCHER__ (which is 
apparently a Mac-specific security thing that's set by the system python).  
The other two flags (CMAKE and LIBRARY_PATH) are apparently ignored.

One weird thing still: although this now works if I use ansible to copy the 
script to the host:

export PATH=/opt/brew/bin:$PATH
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
export PYTHON_CONFIGURE_OPTS="--enable-framework"
unset __PYVENV_LAUNCHER__
pyenv install 3.9.5

and then use the command module to execute it:

```
- name: Install python 3 (with shared libaries for reticulate)
  command: "{{ homebrew_prefix }}/bin/bash scoobydoo.sh"
  environment:
    PATH: "{{ homebrew_prefix }}/bin:{{ ansible_env.PATH }}"
```

Unfortunately, when I try to execute it in one step:

```
- name: Install python 3 (with shared libaries for reticulate)
  shell: |
    export PATH=/opt/brew/bin:$PATH
    eval "$(pyenv init --path)"
    eval "$(pyenv init -)"
    export PYTHON_CONFIGURE_OPTS="--enable-framework"
    unset __PYTHON_LAUNCHER__
    pyenv install 3.9.5
   environment:
    PATH: "{{ homebrew_prefix }}/bin:{{ ansible_env.PATH }}"
```

I get the same error as before.  (And of course I can't use the pyenv 
module directly because it also generates the same error (and I don't know 
how to unset __PYTHON_LAUNCHER__ in that case.  So for now my solution is 
necessarily:

  1. create the script on the host (copy module)
  2. execute the script on the host (command module)

Not elegant, but functional at least!


On Saturday, 1 January 2022 at 17:09:38 UTC-8 [email protected] wrote:

> On Sat, Jan 1, 2022 at 7:47 PM maspotts <[email protected]> wrote:
> >
> > Quick reply to my own thread: I should have kept at this before posting, 
> because I just tried adding this to my script (based on a comparison of the 
> envs):
> >
> > unset LIBRARY_PATH
> > unset __PYVENV_LAUNCHER__
> > unset CPATH
>
> Also known as "environment specific chicanery". I'm glad you were able
> to resolve this.
>
> > and now the ansible install works! I'll zero in on the culprit now, but 
> basically this is resolved for me now.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b4a77b6b-eb21-439c-8b34-eb697623372cn%40googlegroups.com.

Reply via email to