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

cannot import name 'FieldValidationInfo' from 'pydantic' #2172

Open
Sanglorian opened this issue Dec 22, 2023 · 6 comments · Fixed by #2173
Open

cannot import name 'FieldValidationInfo' from 'pydantic' #2172

Sanglorian opened this issue Dec 22, 2023 · 6 comments · Fixed by #2173

Comments

@Sanglorian
Copy link
Collaborator

Describe the bug
I downloaded the latest flatpak and tried to run on Linux Mint. It installed, but when I tried to run it, I got the following error message:

pygame 2.4.0 (SDL 2.0.16, Python 3.9.18)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "/app/bin/org.tuxemon.Tuxemon.py", line 7, in <module>
    from tuxemon import main, prepare
  File "/app/share/Tuxemon/tuxemon/main.py", line 10, in <module>
    from tuxemon.states.persistance.load_menu import LoadMenuState
  File "/app/share/Tuxemon/tuxemon/states/persistance/__init__.py", line 3, in <module>
    from .load_menu import LoadMenuState
  File "/app/share/Tuxemon/tuxemon/states/persistance/load_menu.py", line 8, in <module>
    from tuxemon import prepare, save
  File "/app/share/Tuxemon/tuxemon/save.py", line 18, in <module>
    from tuxemon.client import LocalPygameClient
  File "/app/share/Tuxemon/tuxemon/client.py", line 14, in <module>
    from tuxemon import networking, prepare, rumble
  File "/app/share/Tuxemon/tuxemon/networking.py", line 16, in <module>
    from tuxemon.npc import NPC
  File "/app/share/Tuxemon/tuxemon/npc.py", line 14, in <module>
    from tuxemon.battle import Battle, decode_battle, encode_battle
  File "/app/share/Tuxemon/tuxemon/battle.py", line 9, in <module>
    from tuxemon.db import OutputBattle
  File "/app/share/Tuxemon/tuxemon/db.py", line 15, in <module>
    from pydantic import (
ImportError: cannot import name 'FieldValidationInfo' from 'pydantic' (/app/lib/python3.9/site-packages/pydantic/__init__.cpython-39-x86_64-linux-gnu.so)

Desktop (please complete the following information):

  • OS: Linux Mint 21.1 Cinnamon
  • Python Version 3.10.6
@JaskRendix
Copy link
Collaborator

yeah, FieldValidationInfo has been deprecated: https://docs.pydantic.dev/latest/concepts/validators/
fix on the way

@Sanglorian
Copy link
Collaborator Author

I'm now getting a similar error message from the latest flatpak:

pygame 2.4.0 (SDL 2.0.16, Python 3.9.18)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "/app/bin/org.tuxemon.Tuxemon.py", line 7, in <module>
    from tuxemon import main, prepare
  File "/app/share/Tuxemon/tuxemon/main.py", line 10, in <module>
    from tuxemon.states.persistance.load_menu import LoadMenuState
  File "/app/share/Tuxemon/tuxemon/states/persistance/__init__.py", line 3, in <module>
    from .load_menu import LoadMenuState
  File "/app/share/Tuxemon/tuxemon/states/persistance/load_menu.py", line 8, in <module>
    from tuxemon import prepare, save
  File "/app/share/Tuxemon/tuxemon/save.py", line 18, in <module>
    from tuxemon.client import LocalPygameClient
  File "/app/share/Tuxemon/tuxemon/client.py", line 14, in <module>
    from tuxemon import networking, prepare, rumble
  File "/app/share/Tuxemon/tuxemon/networking.py", line 16, in <module>
    from tuxemon.npc import NPC
  File "/app/share/Tuxemon/tuxemon/npc.py", line 14, in <module>
    from tuxemon.battle import Battle, decode_battle, encode_battle
  File "/app/share/Tuxemon/tuxemon/battle.py", line 9, in <module>
    from tuxemon.db import OutputBattle
  File "/app/share/Tuxemon/tuxemon/db.py", line 15, in <module>
    from pydantic import (
ImportError: cannot import name 'ValidationInfo' from 'pydantic' (/app/lib/python3.9/site-packages/pydantic/__init__.cpython-39-x86_64-linux-gnu.so)

@Sanglorian Sanglorian reopened this Dec 29, 2023
@Sanglorian
Copy link
Collaborator Author

I've tested by uninstalling and reinstalling the flatpak: I get this warning message:

Warning: While pulling runtime/org.freedesktop.Platform.GL.default/x86_64/21.08 from remote flathub: Error reading data from TLS socket: Error decoding the received TLS packet.

Then the same import error. I note the error message refers to "python3.9" but I've confirmed that I have Python 3.10:

$ python3 --version
Python 3.10.12

@JaskRendix
Copy link
Collaborator

JaskRendix commented Dec 30, 2023

Hi @Murmele , do you think this error can be triggered by some old requirement in https://github.com/flathub/org.tuxemon.Tuxemon/blob/master/python3-requirements.json?

I tried to update this part with the new packages, but I don't know how it works, if both need to be tar.gz or whl, etc., because there are two other dependency in pydantic 2.4:

dependencies:

I don't know if these need to be added.

        {
            "name": "python3-pydantic",
            "buildsystem": "simple",
            "build-commands": [
                "pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"pydantic>=2.4.0\" --no-build-isolation"
            ],
            "sources": [
                {
                    "type": "file",
                    "url": "https://files.pythonhosted.org/packages/82/ed/8ccf53a0ed10bf8fc8877b5833b40f5f99093cadfe6632b8892f74aead0f/typing_extensions-4.6.1-py3-none-any.whl",
                    "sha256": "558bc0c4145f01e6405f4a5fdbd82050bd221b119f4bf72a961a1cfd471349d6"
                },
                {
                    "type": "file",
                    "url": "https://files.pythonhosted.org/packages/4c/9b/e5d3fab077b3e1f7574fbe9b6bdd19d7b047bf2746495501f26757872763/pydantic-2.4.0.tar.gz",
                    "sha256": "54216ccb537a606579f53d7f6ed912e98fffce35aff93b25cd80b1c2ca806fc3"
                }
            ]
        }

pygame-ce 2.3.2 is missing: https://pypi.org/project/pygame-ce/#files

@Murmele
Copy link
Contributor

Murmele commented Dec 31, 2023

Hi @Murmele , do you think this error can be triggered by some old requirement in https://github.com/flathub/org.tuxemon.Tuxemon/blob/master/python3-requirements.json?

I tried to update this part with the new packages, but I don't know how it works, if both need to be tar.gz or whl, etc., because there are two other dependency in pydantic 2.4:

dependencies:

* 'typing-extensions>=4.6.1',

* 'annotated-types>=0.4.0',  ----> https://pypi.org/project/annotated-types/0.4.0/#files

* "pydantic-core==2.10.0",    ---> https://pypi.org/project/pydantic-core/2.10.0/#files

I don't know if these need to be added.

        {
            "name": "python3-pydantic",
            "buildsystem": "simple",
            "build-commands": [
                "pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"pydantic>=2.4.0\" --no-build-isolation"
            ],
            "sources": [
                {
                    "type": "file",
                    "url": "https://files.pythonhosted.org/packages/82/ed/8ccf53a0ed10bf8fc8877b5833b40f5f99093cadfe6632b8892f74aead0f/typing_extensions-4.6.1-py3-none-any.whl",
                    "sha256": "558bc0c4145f01e6405f4a5fdbd82050bd221b119f4bf72a961a1cfd471349d6"
                },
                {
                    "type": "file",
                    "url": "https://files.pythonhosted.org/packages/4c/9b/e5d3fab077b3e1f7574fbe9b6bdd19d7b047bf2746495501f26757872763/pydantic-2.4.0.tar.gz",
                    "sha256": "54216ccb537a606579f53d7f6ed912e98fffce35aff93b25cd80b1c2ca806fc3"
                }
            ]
        }

pygame-ce 2.3.2 is missing: https://pypi.org/project/pygame-ce/#files

Hi,

did you try to update by using the updateRequirements.sh script?

@JaskRendix
Copy link
Collaborator

JaskRendix commented Dec 31, 2023

@Murmele I did it, opened a PR, let's see if it works flathub/org.tuxemon.Tuxemon#3

I tried to bump pydantic to the last version as well as adding maturin among the requirements, still fails

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

Successfully merging a pull request may close this issue.

3 participants