When I started up a project with “vagrant up”, everything was fine. But when I typed in “vagrant provision”, I encountered this error:
System info:
Ansible 2.7.1; Vagrant 2.2.14; Darwin
Trellis 1.0.3: April 30th, 2019
---------------------------------------------------
MODULE FAILURE
See stdout/stderr for the exact error
Traceback (most recent call last):
File "<stdin>", line 113, in <module>
File "<stdin>", line 105, in _ansiballz_main
File "<stdin>", line 48, in invoke_module
File "/usr/lib/python3.6/imp.py", line 235, in load_module
return load_source(name, filename, file)
File "/usr/lib/python3.6/imp.py", line 170, in load_source
module = _exec(spec, sys.modules[name])
File "<frozen importlib._bootstrap>", line 618, in _exec
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in
_call_with_frames_removed
File "/tmp/ansible_setup_payload_1p7_kmoy/__main__.py", line 127, in
<module>
ImportError: attempted relative import with no known parent package
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: attempted relative import with no known parent package
fatal: [default]: FAILED! => {"changed": false, "module_stdout": "", "rc": 1}
to retry, use: --limit @/Users/kiki/Code/project/trellis/dev.retry
PLAY RECAP *********************************************************************
default : ok=2 changed=0 unreachable=0 failed=1
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 78 leaked semaphore objects to clean up at shutdown
warnings.warn('resource_tracker: There appear to be %d '
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
I looked in my folders at /usr/lib/
and I don’t see python3 folder in this location. I can only find python2.7 folder. I even ran brew install python to install the latest version and I can see that it’s downloading to /usr/local/lib/
where I can see two folders, python2.7 and python3.9.
So the conclusion I got was that Ansible was trying to find python3 in wrong folder? So I think I have 2 options:
- try to brew install python in
/usr/lib
- try to fix the Ansible’s path to point to or find in
usr/local/lib
- or copy the python3 folder from
/usr/local/lib
to/usr/lib
So how do I do either one of the options or which is the best/alternative option?
Do I type in the command line “ansible_python_interpreter = usr/local/lib
”?
My ansible version is 2.7.1.
My pip3 version is pip 21.0.1 from /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip (python 3.9)