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

[BUG] 'Point' object layout differs from 'Point' #92

Closed
jeertmans opened this issue Nov 28, 2024 Discussed in #91 · 4 comments · Fixed by #93
Closed

[BUG] 'Point' object layout differs from 'Point' #92

jeertmans opened this issue Nov 28, 2024 Discussed in #91 · 4 comments · Fixed by #93
Labels
bug Something isn't working

Comments

@jeertmans
Copy link
Owner

Reposted message from @gdambic.

Discussed in #91

Originally posted by gdambic November 28, 2024
Hello,

I get an error when trying to use a simple scene and I am not sure what I am doing wrong. Here are the steps to reproduce:

  1. Create a new venv, Python 3.12
  2. Install differt2d: pip install differt2d
  3. Add code:
from differt2d.scene import Scene
scene = Scene.square_scene()

When run, I get:

C:\path\.venv\Scripts\python.exe C:\path\main.py 
Traceback (most recent call last):
  File "C:\path\main.py", line 3, in <module>
    scene = Scene.square_scene()
            ^^^^^^^^^^^^^^^^^^^^
  File "C:\path\.venv\Lib\site-packages\differt2d\scene.py", line 742, in square_scene
    tx = Point(xy=jnp.asarray(tx_coords, dtype=float))
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\path\.venv\Lib\site-packages\equinox\_module.py", line 594, in __call__
    object.__setattr__(self, "__class__", cls)
TypeError: __class__ assignment: 'Point' object layout differs from 'Point'

What am I doing wrong?

@jeertmans jeertmans added the bug Something isn't working label Nov 28, 2024
@jeertmans
Copy link
Owner Author

Hi @gdambic, could you provide information of your local Python environment? I will try to reproduce this myself locally.

@gdambic
Copy link

gdambic commented Nov 29, 2024

Hi, @jeertmans,
thank you for your quick reply!
I use PyCharm 2024.1 (Community Edition):

Build #PC-241.14494.241, built on March 28, 2024
Runtime version: 17.0.10+8-b1207.12 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 4068M
Cores: 12
Registry: ide.experimental.ui=true

I use Python 3.12.2 as the interpreter, with a dedicated virtualenv for the project. I only installed "pip install differt2d" and it installed the following dependencies:

absl-py==2.1.0
beartype==0.19.0
chex==0.1.87
contourpy==1.3.1
cycler==0.12.1
differt-core==0.0.17
DiffeRT2d==0.3.4
equinox==0.11.9
etils==1.11.0
fonttools==4.55.0
jax==0.4.35
jaxlib==0.4.35
jaxtyping==0.2.36
kiwisolver==1.4.7
matplotlib==3.9.2
ml_dtypes==0.5.0
numpy==2.1.3
opt_einsum==3.4.0
optax==0.2.4
packaging==24.2
pillow==11.0.0
pyparsing==3.2.0
python-dateutil==2.9.0.post0
scipy==1.14.1
setuptools==75.6.0
six==1.16.0
toolz==1.0.0
typing_extensions==4.12.2

Please let me know if you need any more info.

Thank you so much,
Goran

@jeertmans jeertmans changed the title [BUG] Point' object layout differs from 'Point' [BUG] 'Point' object layout differs from 'Point' Nov 29, 2024
jeertmans added a commit that referenced this issue Nov 29, 2024
@jeertmans
Copy link
Owner Author

Thanks! I managed to reproduce the bug, and it looks like one of the upstream dependencies decided to change how class inheritance work. I fixed this in #93, and will hopefully merge and release this soon if the CI is happy :-)

@jeertmans
Copy link
Owner Author

Hi @gdambic, can you check that installing differt2d==0.3.5 fixes your issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants