Skip to content

[BUG] optree on Windows on ARM64 #182

Description

Required prerequisites

What version of OpTree are you using?

0.13.1

System information

Installation: pip (please check problem description)

Python: 3.12.8 (Windows ARM64)

Platform: Windows ARM64

Optree Version: 0.13.1

Problem description

Windows ARM64 version of optree has a problem on import.

optree-0.13.1-cp313-cp313-win_arm64.whl

If you install it with regular command (by wheel file):

pip install optree

or to prevent any cache

pip install optree --no-cache-dir

ImportError: cannot import name '_C' from partially initialized module 'optree' (most likely due to a circular import)

If you install it via source code (Visual Studio C++ Build Tools are installed in system):

pip install --no-binary optree optree

or

pip install --no-binary optree optree --no-cache-dir

It is successfully being installed and working without any problem.

Reproducible example code

import optree

Traceback

Traceback (most recent call last):
  File "main.py", line 1, in <module>
    import optree
  File "__init__.py", line 17, in <module>
    from optree import accessor, dataclasses, functools, integration, typing
  File "site-packages\optree\accessor.py", line 36, in <module>
    from optree import _C
ImportError: cannot import name '_C' from partially initialized module 'optree' (most likely due to a circular import) (optree\__init__.py)

Expected behavior

It should import optree without any problem.

Additional context

Most probably there is a problem on generation of Windows ARM64 wheel.

Until fixing the issue, as a workaround, you might also consider to remove optree-0.13.1-cp313-cp313-win_arm64.whl from wheel list to force build on Windows ARM64.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions