1

Looking for some help with an issue I am having with psycopg2 and Python3. I am trying to use the sql library from psycopg2 that is available in version 2.7.1. When trying to use

from psycopg2 import sql

I get the error message unresolved reference 'sql'

I am using Xubuntu Linux 16.04 LTS and when issuing the command

pip show psycopg2

in the terminal I get:

Name: psycopg2

Version: 2.7.1
Summary: psycopg2 - Python-PostgreSQL Database Adapter

Home-page: http://initd.org/psycopg/

Author: Federico Di Gregorio

Author-email: fog@initd.org

License: LGPL with exceptions or ZPL

Location: /home/bigdaddy/.local/lib/python3.5/site-packages

Requires:

So it appears to be installed in my system. Also in Pycharm when I go to File -> Settings -> Project Interpreter.. I see psycopg2 2.7.1 installed there as well. Any ideas of what is going on and why I am unable to use the psycopg2 sql functionality in my project? Everything appears to be installed to me it seems. Thanks for any help.

J2112O
  • 636
  • 3
  • 11
  • 24

1 Answers1

1

That is a common issue in PyCharm, follow those instructions: Unresolved reference issue in PyCharm and you will eliminate the problem!

For the case that the link does not work:

  1. Right click on your root project folder.
  2. In the tab that appears, find the Mark Directory as.
  3. In the expansion window that shows up, click the Sources root
John Moutafis
  • 22,254
  • 11
  • 68
  • 112
  • Thanks for your time and answers and link. I am still having this issue after following the suggestion you provided and other things found in the link. One thing I did try that I previously have not, was File -> Invalidate Caches/Restart but still no luck. I will keep digging. – J2112O Mar 26 '17 at 21:28