Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent "Symbol not found" errors on Mac #6761 #6825

Merged
merged 1 commit into from Apr 16, 2020

Conversation

pdurbin
Copy link
Member

@pdurbin pdurbin commented Apr 15, 2020

What this PR does / why we need it:

I was getting errors like this:

(venv) murphy:installer pdurbin$ python testit.py 
Traceback (most recent call last):
  File "testit.py", line 2, in <module>
    import psycopg2
  File "/Users/pdurbin/github/iqss/dataverse/scripts/installer/venv/lib/python3.7/site-packages/psycopg2/__init__.py", line 50, in <module>
    from psycopg2._psycopg import (                     # noqa
ImportError: dlopen(/Users/pdurbin/github/iqss/dataverse/scripts/installer/venv/lib/python3.7/site-packages/psycopg2/_psycopg.cpython-37m-darwin.so, 2): Symbol not found: _PQsslAttribute
  Referenced from: /Users/pdurbin/github/iqss/dataverse/scripts/installer/venv/lib/python3.7/site-packages/psycopg2/_psycopg.cpython-37m-darwin.so
  Expected in: flat namespace
 in /Users/pdurbin/github/iqss/dataverse/scripts/installer/venv/lib/python3.7/site-packages/psycopg2/_psycopg.cpython-37m-darwin.so

Which issue(s) this PR closes:

None

Special notes for your reviewer:

I got this tip from https://stackoverflow.com/a/58443768/19464

After installing the second package, psycopg2-binary, I was able to run the test script and get this output:

(venv) murphy:installer pdurbin$ python testit.py 
(4388, 'DataFile', 'file://1717f8f1341-710ffaf39b55')
(4387, 'Dataset', 'file://10.5072/FK2/Q3LUGL')
(4386, 'Dataverse', None)
(4385, 'DataFile', 'file://1717f8a42b4-272bd20eface')
(4384, 'Dataset', 'file://10.5072/FK2/NURRRR')
(4383, 'Dataverse', None)
(4382, 'DataFile', 'file://1717f7bd76f-0c4d131cb54e')
(4381, 'Dataset', 'file://10.5072/FK2/F9DAPZ')
(4380, 'Dataverse', None)
(4379, 'DataFile', 'file://1717f700b32-15e4e9f6ef7f')
(venv) murphy:installer pdurbin$ 

Suggestions on how to test this:

Here's the test script from @landreev

#!/usr/bin/env python3
import psycopg2
import os
Host = "localhost"
Port = 5432
Database = "dvndb"
Username = "dvnapp"
Password = "secret"
conn_string = "host='"+Host+"' dbname='"+Database+"' user='"+Username+"' password='"+Password+"'"
conn = psycopg2.connect(conn_string)
cursor = conn.cursor()
dataverse_query="SELECT id, dtype, storageidentifier FROM dvobject ORDER BY id DESC LIMIT 10"
cursor.execute(dataverse_query)
records = cursor.fetchall()
for rec in records:
    print(rec)

Does this PR introduce a user interface change?:

No

Is there a release notes update needed for this change?:

No

Additional documentation:

No

@coveralls
Copy link

Coverage Status

Coverage remained the same at 19.661% when pulling 3b0dcfa on 6761-psycopg2 into ed5a575 on 6761-payara-installer-update.

@landreev
Copy link
Contributor

I don't think you installed a "second package" - you installed psycopg2-binary, instead of building psycopg2 from sources. It's not an additional requirement, is what I'm trying to say.
I don't think it makes sense to have both in the requirements.txt. It should be one of the two, and then maybe a line in README_python.txt, saying that "if you're having trouble getting psycopg2 to work, consider installing [the other] instead."
Maybe the binary version should be our first choice though. Because it's more likely to work for more people? (but I don't think it's guaranteed to work for everyone/on all distributions).

From https://pypi.org/project/psycopg2-binary/:
The binary package is a practical choice for development and testing but in production it is advised to use the package built from sources.

Copy link
Contributor

@landreev landreev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just going to take it and edit as needed. thanks.

IQSS/dataverse (TO BE RETIRED / DELETED in favor of project 34) automation moved this from Code Review 🦁 to QA 🔎✅ Apr 16, 2020
@landreev landreev merged commit 5a41c1c into 6761-payara-installer-update Apr 16, 2020
IQSS/dataverse (TO BE RETIRED / DELETED in favor of project 34) automation moved this from QA 🔎✅ to Done 🚀 Apr 16, 2020
@djbrooke djbrooke added this to the Dataverse 5 milestone Apr 16, 2020
@kcondon kcondon deleted the 6761-psycopg2 branch April 16, 2020 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants