0

I just get sqlalchemy with pip doing

pip install sqlalchemy

When I import a simple Class from sqlalchemy like this in a python console

from sqlalchemy import Column

I get this error

from sqlalchemy import Column
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sqlalchemy.py", line 5, in <module>
    from sqlalchemy import Column, Integer, Unicode, UnicodeText, String
ImportError: cannot import name Column

I have the same error on an OSX and an Ubuntu environment. On the SQLAlchemy website support section there is no references about this issues. Is it something related to my Python environment?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
matt
  • 1,046
  • 1
  • 13
  • 26

2 Answers2

11

You named your own script sqlalchemy.py or have another python file by that name in the same directory and it is masking the library. Rename that file.

You can see this in your traceback; the script imported a local file sqlalchemy.py (no path), which then tried to import itself again.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
0
from sqlalchemy.schema import Column

sqlalchemy.schema.Column

The Demz
  • 7,066
  • 5
  • 39
  • 43