1

I want to use python-sql as per this link. python-sql project home. I install sql using "pip install sql", and it goes as planned. However, when I place the import at the top of my module;

from sql import *
from sql.aggregate import *
from sql.conditional import *

PyCharm indicates that sql.aggregate could not be resolved. If I try to execute the code, I get an error

ImportError: No module named 'sql.aggregate'; 'sql' is not a package

I've done a lot of searching on it and can't find what I am doing wrong. I'm a Python newbe, so I hope it is something simple - but I couldn't find anything in the docs about installation.

(Edit : system setup) - MS Windows 7 - Python 34 - Virtual Machine

6
  • You appear to have a sql.py file somewhere; e.g. a module, not a package. What does import sql; print(sql.__file__) say is being imported? Commented Jan 8, 2015 at 16:44
  • @AnirudhaAgashe Yes, I am using a virtual machine. I guess I should have mentioned that in my setup. I'll add that now. Commented Jan 8, 2015 at 17:01
  • @MartijnPieters I get "C:\Python34\lib\site-packages\sql.py". Originally, PyCharm installed it for me. I tried pip uninstall, and a reinstall but it doesn't seem to help. Commented Jan 8, 2015 at 17:01
  • @SteveJ: ah, yes, because sql on PyPI is a different project. Commented Jan 8, 2015 at 17:02
  • @MartijnPieters : Sorry, I swim on the shallow end of the python pool. What does that mean for me? Commented Jan 8, 2015 at 17:05

1 Answer 1

1

You need to install python-sql, not sql:

pip install python-sql

sql is a different project altogether.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you, that did the trick. In an effort to learn how to fish, how would I have known that on my own (so that I don't have to ask the same question in the future.)
@SteveJ: the project didn't document this, so I looked at the name key in their setup.py file; that is used to register with PyPI.
@SteveJ: the fact that your sql.py file was found in site-packages indicated it was probably installed via pip, and indeed there was a PyPI page for a project named sql (found by typing in pypi.python.org/pypi/ into my browser then adding sql).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.