tortoise / pypika-tortoise

Forked from pypika and streamline just for tortoise-orm
Apache License 2.0
7 stars 10 forks source link

ImportError when pypika is also installed #6

Open jorenham opened 2 years ago

jorenham commented 2 years ago

When pypika and pypika-tortoise are both installed, both are installed within the same site-packages directory (see https://github.com/tortoise/pypika-tortoise/issues/5). This causes an ImportError, because dialects/__init__.py is imported by upstream pypika's __init__.py, instead of its own dialects.py:

File "/myproject/.venv/lib/python3.10/site-packages/tortoise/__init__.py", line 11, <module>
from pypika import Table
File "/myproject/.venv/lib/python3.10/site-packages/pypika/__init__.py", line 34, <module>
from pypika.dialects import (

dialects: <module 'pypika.dialects' from '/myproject/.venv/lib/python3.10/site-packages/pypika/dialects/__init__.py'>

ImportError:
cannot import name 'ClickHouseQuery' from 'pypika.dialects' (/myproject/.venv/lib/python3.10/site-packages/pypika/dialects/__init__.py)

Please rename this package.

And if you've watched "the Fly", you'll know the disastrous consequences of merging two species 😉 .