thesps / conifer

Fast inference of Boosted Decision Trees in FPGAs
Apache License 2.0
48 stars 27 forks source link

`ImportError: cannot import name 'backends'` when importing conifer #42

Closed achoum closed 1 year ago

achoum commented 1 year ago

Hi,

Importing conifer after having installed it from pip (using pip install conifer) raises an error.

Here are the details:

Python v3.10.6

Conifer v0.4

Content of conifer_test.py file:

import conifer

On Windows

Traceback (most recent call last):
  File "G:\projects\work\test_conifer\conifer_test.py", line 1, in <module>
    import conifer
  File "G:\projects\work\test_conifer\conifer.py", line 2, in <module>
    from conifer import backends
ImportError: cannot import name 'backends' from partially initialized module 'conifer' (most likely due to a circular import) (G:\projects\work\test_conifer\conifer.py)

On Linux WSL2

achoum@abc:/mnt/g/projects/work/test_conifer$ python3 conifer_test.py
Traceback (most recent call last):
  File "/mnt/g/projects/work/test_conifer/conifer_test.py", line 1, in <module>
    import conifer
  File "/mnt/g/projects/work/test_conifer/conifer.py", line 2, in <module>
    from conifer import backends
ImportError: cannot import name 'backends' from partially initialized module 'conifer' (most likely due to a circular import) (/mnt/g/projects/work/test_conifer/conifer.py)

Cheers :)

thesps commented 1 year ago

Hi, I wasn't able to recreate this error! I made a new conda environment with Python 3.10.6, pip install conifer, then import conifer without complaint.

Could it be this conifer.py file, what's in there? The conifer package itself doesn't have a file with that name.

achoum commented 1 year ago

Hi, Thanks for quickly looking at it. You diagnostic was correct, I has a file named conifer.py in current directory. This is embarrassing :). Cheers,