[GH-ISSUE #509] PydanticImportError #395

Closed
opened 2026-02-26 12:21:28 +03:00 by kerem · 7 comments
Owner

Originally created by @Mina4ever on GitHub (Nov 30, 2024).
Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/509

Originally assigned to: @Mina4ever on GitHub.

Quick Checks

  • [Y] I have read the help post
  • [Y] I have searched other issues, looking for an issue similar to mine
  • [Y] I have made sure my application/script runs before trying to package

Describe the bug

Trying to open the extracted exe and I am facing below error
"pydantic.errors.PydanticImportError: BaseSettings has been moved to the pydantic-settings package. See https://docs.pydantic.dev/2.10/migration/#basesettings-has-moved-to-pydantic-settings for more details."

To Reproduce

Steps to reproduce the behavior (install dependencies, do this in the auto-py-to-exe UI):

1-run auto-py-to-exe on python command
2-Select py file from GUI and process
3-Trying to open the extracted exe and I am facing below error
"pydantic.errors.PydanticImportError: BaseSettings has been moved to the pydantic-settings package. See https://docs.pydantic.dev/2.10/migration/#basesettings-has-moved-to-pydantic-settings for more details."

# If you have example code, please provide a minimal reproducible example:
# https://stackoverflow.com/help/minimal-reproducible-example

print("Hello World")

Expected behavior

I want the exe file to be executed correctly but it generates the error "pydantic.errors.PydanticImportError: BaseSettings has been moved to the pydantic-settings package. See https://docs.pydantic.dev/2.10/migration/#basesettings-has-moved-to-pydantic-settings for more details.", I tryed to modify the source code but it written by pyc not py

Your Environment:

  • Python version (Python 3.11.10):
  • auto-py-to-exe version (2.44.4):
  • PyInstaller version (6.11.1):
  • Eel version (0.18.1):
Originally created by @Mina4ever on GitHub (Nov 30, 2024). Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/509 Originally assigned to: @Mina4ever on GitHub. **Quick Checks** - [Y] I have read the [help post](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe) - [Y] I have [searched other issues](https://github.com/brentvollebregt/auto-py-to-exe/issues?q=is%3Aissue+), looking for an issue similar to mine - [Y] I have made sure my application/script runs before trying to package **Describe the bug** Trying to open the extracted exe and I am facing below error "pydantic.errors.PydanticImportError: `BaseSettings` has been moved to the `pydantic-settings` package. See https://docs.pydantic.dev/2.10/migration/#basesettings-has-moved-to-pydantic-settings for more details." **To Reproduce** _Steps to reproduce the behavior (install dependencies, do this in the auto-py-to-exe UI):_ 1-run auto-py-to-exe on python command 2-Select py file from GUI and process 3-Trying to open the extracted exe and I am facing below error "pydantic.errors.PydanticImportError: `BaseSettings` has been moved to the `pydantic-settings` package. See https://docs.pydantic.dev/2.10/migration/#basesettings-has-moved-to-pydantic-settings for more details." ```python # If you have example code, please provide a minimal reproducible example: # https://stackoverflow.com/help/minimal-reproducible-example print("Hello World") ``` **Expected behavior** I want the exe file to be executed correctly but it generates the error "pydantic.errors.PydanticImportError: `BaseSettings` has been moved to the `pydantic-settings` package. See https://docs.pydantic.dev/2.10/migration/#basesettings-has-moved-to-pydantic-settings for more details.", I tryed to modify the source code but it written by pyc not py **Your Environment:** - Python version (`Python 3.11.10`): - auto-py-to-exe version (`2.44.4`): - PyInstaller version (`6.11.1`): - Eel version (`0.18.1`):
kerem 2026-02-26 12:21:28 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@github-actions[bot] commented on GitHub (Nov 30, 2024):

👋 Hi, just a reminder that if you haven't read the help post yet, give it a read to see if your issue is covered in it and make sure to follow the debugging section.

Also please note, as stated in the README, if your issue is only associated with your application and not auto-py-to-exe itself, please do not create an issue in this repository - instead, comment on the help post, video or create a new discussion.

<!-- gh-comment-id:2509109481 --> @github-actions[bot] commented on GitHub (Nov 30, 2024): 👋 Hi, just a reminder that if you haven't read [the help post](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/) yet, give it a read to see if your issue is covered in it and make sure to follow [the debugging section](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/#debugging). Also please note, as stated in the README, if your issue is only associated with your application and not auto-py-to-exe itself, please do not create an issue in this repository - instead, comment on the help [post](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/), [video](https://youtu.be/OZSZHmWSOeM) or create a [new discussion](https://github.com/brentvollebregt/auto-py-to-exe/discussions).
Author
Owner

@Mina4ever commented on GitHub (Nov 30, 2024):

yes I have read the help post

<!-- gh-comment-id:2509114895 --> @Mina4ever commented on GitHub (Nov 30, 2024): yes I have read the help post
Author
Owner

@brentvollebregt commented on GitHub (Nov 30, 2024):

I just did the following:

  1. Ran auto-py-to-exe to open auto-py-to-exe
  2. Selected my .py file from GUI and packaged it
    The file contains,
    print("Hello World")
    
  3. Ran the package exe

And I get no error. It appears your reproduction steps are missing some code and additional steps to reproduce the error. I am unable to help without proper reproduction steps.

Searching for your error leads me to this SO answer. I recommend creating a new Python virtual environment, install the libraries you need and auto-py-to-exe, and make sure your script is using the correct import for the correct version of pydantic you have installed.

I can't imagine this error would have not appeared when you ran it before packaging - unless you ran it with one version of pydantic and packaged in an environment with a different version of pydantic.

<!-- gh-comment-id:2509393167 --> @brentvollebregt commented on GitHub (Nov 30, 2024): I just did the following: 1. Ran `auto-py-to-exe` to open auto-py-to-exe 2. Selected my .py file from GUI and packaged it The file contains, ```py print("Hello World") ``` 3. Ran the package exe And I get no error. It appears your reproduction steps are missing some code and additional steps to reproduce the error. I am unable to help without proper reproduction steps. Searching for your error leads me to [this SO answer](https://stackoverflow.com/a/76670657). I recommend creating a new Python virtual environment, install the libraries you need and `auto-py-to-exe`, and make sure your script is using the correct import for the correct version of `pydantic` you have installed. I can't imagine this error would have not appeared when you ran it before packaging - unless you ran it with one version of `pydantic` and packaged in an environment with a different version of `pydantic`.
Author
Owner

@Mina4ever commented on GitHub (Dec 1, 2024):

DataQuilaty.txt
py script attached

<!-- gh-comment-id:2510230636 --> @Mina4ever commented on GitHub (Dec 1, 2024): [DataQuilaty.txt](https://github.com/user-attachments/files/17970194/DataQuilaty.txt) py script attached
Author
Owner

@brentvollebregt commented on GitHub (Dec 2, 2024):

Could you provide a minimal reproducible example? I can't imagine having cx_Oracle or pandas_profiling in the script is causing the issue. If so, it needs to be noted.

Also how did using a virtual environment go? (the second part of my reply)

<!-- gh-comment-id:2510802933 --> @brentvollebregt commented on GitHub (Dec 2, 2024): Could you provide a minimal reproducible example? I can't imagine having `cx_Oracle` or `pandas_profiling` in the script is causing the issue. If so, it needs to be noted. Also how did using a virtual environment go? (the second part of my reply)
Author
Owner

@Mina4ever commented on GitHub (Dec 6, 2024):

first, yes , it's conda virtual environment, with below specs:
Python version (Python 3.11.10)
auto-py-to-exe version (2.44.4)
PyInstaller version (6.11.1)
error.txt

Eel version (0.18.1)

Second: I could find the issue in one of "pandas_profiling" Py file, I have fixed it, however I faced another issue (attached)

Worth to say that i need to convert the shared PY file as is and it's doesn't make sense to my to convert any dumpy py file to exe

<!-- gh-comment-id:2523770916 --> @Mina4ever commented on GitHub (Dec 6, 2024): first, yes , it's conda virtual environment, with below specs: Python version (Python 3.11.10) auto-py-to-exe version (2.44.4) PyInstaller version (6.11.1) [error.txt](https://github.com/user-attachments/files/18041427/error.txt) Eel version (0.18.1) Second: I could find the issue in one of "pandas_profiling" Py file, I have fixed it, however I faced another issue (attached) Worth to say that i need to convert the shared PY file as is and it's doesn't make sense to my to convert any dumpy py file to exe
Author
Owner

@Mina4ever commented on GitHub (Dec 6, 2024):

It works, I copied python library "ydata_profiling" files from virtual environment folder to "_internal" in my app path .
Thank you so much for your support

<!-- gh-comment-id:2523791571 --> @Mina4ever commented on GitHub (Dec 6, 2024): It works, I copied python library "ydata_profiling" files from virtual environment folder to "_internal" in my app path . Thank you so much for your support
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/auto-py-to-exe#395
No description provided.