Hmmm, I did tis on both Mac and Linux node. It helped on my Linux node but 
not on the Mac, that is, I don't the Failed to import the required Python 
library (psycopg2) on the Linux node, but I still get it on the Mac.

$ python3 -m pip install psycopg2-binary

Defaulting to user installation because normal site-packages is not 
writeable

Collecting psycopg2-binary

  Using cached 
psycopg2_binary-2.8.6-cp38-cp38-macosx_10_9_x86_64.macosx_10_9_intel.macosx_10_10_intel.macosx_10_10_x86_64.whl
 
(1.5 MB)

Installing collected packages: psycopg2-binary

Successfully installed psycopg2-binary-2.8.6

On Tuesday, June 15, 2021 at 4:43:19 PM UTC-4 zil...@gmail.com wrote:

> Per 
> https://stackoverflow.com/questions/33866695/error-installing-psycopg2-on-macos-10-9-5,
>  
> installing Postgres should've installed it? That's why I mentioned that I 
> did install it.
>
> Chris
>
> On Tuesday, June 15, 2021 at 4:42:26 PM UTC-4 weiye...@gmail.com wrote:
>
>> Pip install pyscopg2 --user. I think 
>>
>> Get Outlook for iOS <https://aka.ms/o0ukef>
>> ------------------------------
>> *From:* ansible...@googlegroups.com <ansible...@googlegroups.com> on 
>> behalf of zil...@gmail.com <zil...@gmail.com>
>> *Sent:* Wednesday, June 16, 2021 8:40:37 AM
>> *To:* Ansible Project <ansible...@googlegroups.com>
>> *Subject:* Re: [ansible-project] Failed to import the required Python 
>> library (psycopg2) 
>>  
>> I was reading that installing Postgres (why I mentioned I installed in 
>> both my Mac and Linux node) would've installed the module, but apparently 
>> not. 
>>
>> Chris
>>
>> On Tuesday, June 15, 2021 at 11:30:30 AM UTC-4 weiye...@gmail.com wrote:
>>
>> Install that python module psycopg2 on the local machine. You haven’t got 
>> the dependency installed
>>
>> Get Outlook for iOS <https://aka.ms/o0ukef>
>> ------------------------------
>> *From:* ansible...@googlegroups.com <ansible...@googlegroups.com> on 
>> behalf of zil...@gmail.com <zil...@gmail.com>
>> *Sent:* Wednesday, June 16, 2021 3:27:53 AM
>> *To:* Ansible Project <ansible...@googlegroups.com>
>> *Subject:* [ansible-project] Failed to import the required Python 
>> library (psycopg2) 
>>  
>> On Ubuntu Linux node
>>
>> $ ansible --version
>>
>> ansible [core 2.11.1] 
>>
>>   config file = /home/jenkins/.ansible.cfg
>>
>>   configured module search path = 
>> ['/home/jenkins/.ansible/plugins/modules', 
>> '/usr/share/ansible/plugins/modules']
>>
>>   ansible python module location = 
>> /home/jenkins/.local/lib/python3.8/site-packages/ansible
>>
>>   ansible collection location = 
>> /home/jenkins/.ansible/collections:/usr/share/ansible/collections
>>
>>   executable location = /home/jenkins/.local/bin/ansible
>>
>>   python version = 3.8.0 (default, Feb 25 2021, 22:10:10) [GCC 8.4.0]
>>
>>   jinja version = 2.10
>>
>>   libyaml = False
>>
>> On my Macbook
>>
>> $ ansible --version
>>
>> ansible 2.10.8
>>
>>   config file = /Users/user/.ansible.cfg
>>
>>   configured module search path = 
>> ['/Users/user/.ansible/plugins/modules', 
>> '/usr/share/ansible/plugins/modules']
>>
>>   ansible python module location = 
>> /usr/local/Cellar/ansible/3.3.0/libexec/lib/python3.9/site-packages/ansible
>>
>>   executable location = /usr/local/bin/ansible
>>
>>   python version = 3.9.4 (default, Apr  5 2021, 01:50:46) [Clang 12.0.0 
>> (clang-1200.0.32.29)]
>> I have installed postgresql on BOTH ny Linux node and my Mac.
>>
>> I'm testing this task, where I want to run the query on a Windows host. 
>>
>> - *name*: Run a query
>>
>>   *postgresql_query*:
>>
>>     *login_host*: "{{ ansible_hostname }}"
>>
>>     *login_password*: "{{ pg_db_password }}"
>>
>>     *db*: "pg_user"
>>
>>     *query*: "SELECT * from pg_user"
>>
>>   *delegate_to*: localhost
>>
>> And I get the following when running the playbook either on my Macbook, 
>> or on a Linux node.
>>
>> TASK [qa-db-backup : Run a query] 
>> ********************************************** fatal: [10.227.xx.xx -> 
>> localhost]: FAILED! => {"changed": false, "msg": "Failed to import the 
>> required Python library (psycopg2) on linux-node-0's Python 
>> /usr/local/bin/python. Please read the module documentation and install it 
>> in the appropriate location. If the required library is installed, but 
>> Ansible is using the wrong Python interpreter, please consult the 
>> documentation on ansible_python_interpreter"} 
>>
>> Any clues?
>>
>> Thanks,
>>
>> Chris
>>
>> -- 
>> 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 ansible-proje...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/49f98c01-1655-45e2-92d3-93a1047fbac5n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/49f98c01-1655-45e2-92d3-93a1047fbac5n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> -- 
>> 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 ansible-proje...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/df7a803a-8f87-4fe3-ad72-858da51ac4d1n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/df7a803a-8f87-4fe3-ad72-858da51ac4d1n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1724334e-bd5e-407a-81b8-f49564e6cb60n%40googlegroups.com.

Reply via email to