CADWRDeltaModeling/pyhecdss

Error when importing pyhecdss

alinabi opened this issue · 3 comments

  • pyhecdss version: 1.1.2
  • Python version: 3.8.8
  • Operating System: Linux (Nixos 20.09)

Description

I am trying to build pyhecdss from source. The build succeeds, but when I try to import the package I get an ImportError, potentially caused by a circular import. However, I cannot pinpoint where the circular import is happening.

What I Did

    Python 3.8.8 (default, Feb 19 2021, 11:04:50)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyhecdss
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nix/store/qbdyd3h28ar3ayx854pdmqjm6j60nvgn-python3.8-pyhecdss-1.1.2/lib/python3.8/site-packages/pyhecdss/__init__.py", line 1, in <module>
    from .pyhecdss import *
  File "/nix/store/qbdyd3h28ar3ayx854pdmqjm6j60nvgn-python3.8-pyhecdss-1.1.2/lib/python3.8/site-packages/pyhecdss/pyhecdss.py", line 2, in <module>
    from . import pyheclib
ImportError: cannot import name 'pyheclib' from partially initialized module 'pyhecdss' (most likely due to a circular import) (/nix/store/qbdyd3h28ar3ayx854pdmqjm6j60nvgn-python3.8-pyhecdss-1.1.2/lib/python3.8/site-packages/pyhecdss/__init__.py)                                                                                                                                                                           >>>                                       

@alinabi I am not sure why this was working before. In anycase, importing * in the init.py is probably the cause. Please see the commit and test against the latest commit.
If it works, lets close this issue. Thanks

Trying to import pyhecdss through Google Colab and getting the same circular error message:

ImportError Traceback (most recent call last)
in
1 import pandas as pd
2 import numpy as np
----> 3 import pyhecdss

1 frames
/content/drive/MyDrive/Python_Ideas/pyhecdss/pyhecdss/pyhecdss.py in
1 import collections
----> 2 from .import pyheclib
3 import pandas as pd
4 import numpy as np
5 import os

ImportError: cannot import name 'pyheclib' from partially initialized module 'pyhecdss' (most likely due to a circular import) (/content/drive/MyDrive/Python_Ideas/pyhecdss/pyhecdss/init.py)

@vdemchuk-dwr How are you installing pyhecdss into Google Colab ? I have never done that myself. Anyways pyhecdss is not as simple as most python packages as it is wrapping a C library. So at the very least the platform that runs Google Collab (i.e. Linux?) may be different from the compiled operating systems for pyhecdss (windows and linux redhat 5)