Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors importing Pod from hikaru on latest version #38

Open
aantn opened this issue Mar 27, 2024 · 3 comments
Open

Errors importing Pod from hikaru on latest version #38

aantn opened this issue Mar 27, 2024 · 3 comments

Comments

@aantn
Copy link
Contributor

aantn commented Mar 27, 2024

Hi @haxsaw,
I'm having some trouble importing the latest version of hikaru. I've tested on python3.9 and python3.11, both on an M1 Mac.

On python3.11:

$  python3.11 -m pip install --upgrade hikaru
Requirement already satisfied: hikaru in /opt/homebrew/lib/python3.9/site-packages (1.3.0)
Requirement already satisfied: hikaru-model-25>=1.1.0 in /opt/homebrew/lib/python3.9/site-packages (from hikaru) (1.1.1)
Requirement already satisfied: hikaru-model-26>=1.1.0 in /opt/homebrew/lib/python3.9/site-packages (from hikaru) (1.1.1)
Requirement already satisfied: hikaru-model-27>=1.1.0 in /opt/homebrew/lib/python3.9/site-packages (from hikaru) (1.1.1)
Requirement already satisfied: hikaru-model-28>=1.1.0 in /opt/homebrew/lib/python3.9/site-packages (from hikaru) (1.1.0)
Requirement already satisfied: hikaru-codegen>=1.1.0 in /opt/homebrew/lib/python3.9/site-packages (from hikaru) (1.1.0)
Requirement already satisfied: hikaru-core>=1.1.0 in /opt/homebrew/lib/python3.9/site-packages (from hikaru-codegen>=1.1.0->hikaru) (1.1.1)
...

$ python3.11
Python 3.11.6 (main, Nov  2 2023, 04:39:43) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from hikaru.model.rel_1_25 import Pod, ObjectMeta, PodSpec
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'Pod' from 'hikaru.model.rel_1_25' (unknown location)

On python3.9:

$ python3.9 -m pip install --upgrade hikaru
Requirement already satisfied: hikaru in /opt/homebrew/lib/python3.9/site-packages (1.3.0)
Requirement already satisfied: hikaru-model-25>=1.1.0 in /opt/homebrew/lib/python3.9/site-packages (from hikaru) (1.1.1)
Requirement already satisfied: hikaru-model-26>=1.1.0 in /opt/homebrew/lib/python3.9/site-packages (from hikaru) (1.1.1)
Requirement already satisfied: hikaru-model-27>=1.1.0 in /opt/homebrew/lib/python3.9/site-packages (from hikaru) (1.1.1)
Requirement already satisfied: hikaru-model-28>=1.1.0 in /opt/homebrew/lib/python3.9/site-packages (from hikaru) (1.1.0)
Requirement already satisfied: hikaru-codegen>=1.1.0 in /opt/homebrew/lib/python3.9/site-packages (from hikaru) (1.1.0)
Requirement already satisfied: hikaru-core>=1.1.0 in /opt/homebrew/lib/python3.9/site-packages (from hikaru-codegen>=1.1.0->hikaru) (1.1.1)
...

$ python3.9
>>> from hikaru.model.rel_1_25 import Pod, ObjectMeta, PodSpec
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/homebrew/lib/python3.9/site-packages/hikaru/model/rel_1_25/__init__.py", line 33, in <module>
    from .deprecations import *
  File "/opt/homebrew/lib/python3.9/site-packages/hikaru/model/rel_1_25/deprecations.py", line 1, in <module>
    from hikaru.generate import add_deprecations_for_release
ModuleNotFoundError: No module named 'hikaru.generate'

Any ideas?

@haxsaw
Copy link
Owner

haxsaw commented Mar 27, 2024

That passes odd. I'll have a look later today.

@haxsaw
Copy link
Owner

haxsaw commented Mar 27, 2024

So I'm suspecting the problem is the use of --upgrade on a pre-1.1.0 installation of Hikaru. A fresh install seems to work just fine, but if I upgrade 1.0.1 to the recent install the import breaks as you describe above. I suspect it has to do with the change of the 'model' subpackage as it has become a namespace package and the machinery for that has changed. I still need to investigate it more deeply to see why this isn't working properly and it may involve some dark incantations on the setup.py to set things appropriately. In the meantime it would be good to know if doing a full install instead fixes your issue, as I had no problems on a Mac with a fresh install. Can you give that a go?

@aantn
Copy link
Contributor Author

aantn commented Mar 28, 2024

Yes, that fixes the problem, thank you! I actually don't mind much about the specific bug here - was just trying to reproduce #39 on a clean install.

Thank you for the extremely fast response as always!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants