[GH-ISSUE #433] Python 3.12.0 ModuleNotFoundError: No module named 'bottle.ext.websocket' #345

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

Originally created by @neelkalpa on GitHub (Oct 3, 2023).
Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/433

Originally assigned to: @brentvollebregt on GitHub.

Traceback (most recent call last):
File "", line 198, in run_module_as_main
File "", line 88, in run_code
File "C:\Program Files\Python312\Lib\site-packages\auto_py_to_exe_main
.py", line 10, in
from . import ui
File "C:\Program Files\Python312\Lib\site-packages\auto_py_to_exe\ui.py", line 6, in
import eel
File "C:\Program Files\Python312\Lib\site-packages\eel_init
.py", line 16, in
import bottle.ext.websocket as wbs
ModuleNotFoundError: No module named 'bottle.ext.websocket'

Tried solving like this:
pip install bottle-websocket
pip install eel

However, it didn't work!

Originally created by @neelkalpa on GitHub (Oct 3, 2023). Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/433 Originally assigned to: @brentvollebregt on GitHub. Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "C:\Program Files\Python312\Lib\site-packages\auto_py_to_exe\__main__.py", line 10, in <module> from . import ui File "C:\Program Files\Python312\Lib\site-packages\auto_py_to_exe\ui.py", line 6, in <module> import eel File "C:\Program Files\Python312\Lib\site-packages\eel\__init__.py", line 16, in <module> import bottle.ext.websocket as wbs ModuleNotFoundError: No module named 'bottle.ext.websocket' Tried solving like this: pip install bottle-websocket pip install eel However, it didn't work!
kerem 2026-02-26 12:21:17 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@github-actions[bot] commented on GitHub (Oct 3, 2023):

👋 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:1745210533 --> @github-actions[bot] commented on GitHub (Oct 3, 2023): 👋 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

@brentvollebregt commented on GitHub (Oct 4, 2023):

Could you try the following

  1. Create a new Python virtual environment
  2. Install auto-py-to-exe in this new virtual environment using pip (make sure you are using the new virtual environment!)
  3. Run the auto-py-to-exe in this virtual environment

Do you get the same issue? With you clearing the issue template out, I can't offer much more than this immediately 😕

<!-- gh-comment-id:1746214982 --> @brentvollebregt commented on GitHub (Oct 4, 2023): Could you try the following 1. Create a new Python virtual environment 2. Install auto-py-to-exe in this new virtual environment using pip (make sure you are using the new virtual environment!) 3. Run the auto-py-to-exe in this virtual environment Do you get the same issue? With you clearing the issue template out, I can't offer much more than this immediately 😕
Author
Owner

@DLord420 commented on GitHub (Oct 4, 2023):

Same problem here. Also on python 3.12.
I get the same error when trying to open the app in CMD.

<!-- gh-comment-id:1746743284 --> @DLord420 commented on GitHub (Oct 4, 2023): Same problem here. Also on python 3.12. I get the same error when trying to open the app in CMD.
Author
Owner

@neelkalpa commented on GitHub (Oct 4, 2023):

Could you try the following

  1. Create a new Python virtual environment
  2. Install auto-py-to-exe in this new virtual environment using pip (make sure you are using the new virtual environment!)
  3. Run the auto-py-to-exe in this virtual environment

Do you get the same issue? With you clearing the issue template out, I can't offer much more than this immediately 😕

It works in virtual environment. But it doesn't work outside of it. Any remedy?

<!-- gh-comment-id:1747089344 --> @neelkalpa commented on GitHub (Oct 4, 2023): > Could you try the following > > 1. Create a new Python virtual environment > 2. Install auto-py-to-exe in this new virtual environment using pip (make sure you are using the new virtual environment!) > 3. Run the auto-py-to-exe in this virtual environment > > Do you get the same issue? With you clearing the issue template out, I can't offer much more than this immediately 😕 It works in virtual environment. But it doesn't work outside of it. Any remedy?
Author
Owner

@Wilsman commented on GitHub (Oct 4, 2023):

just ran into the same issue. Also, not too sure how to run it in a venv 🥲

<!-- gh-comment-id:1747668260 --> @Wilsman commented on GitHub (Oct 4, 2023): just ran into the same issue. Also, not too sure how to run it in a venv 🥲
Author
Owner

@brentvollebregt commented on GitHub (Oct 5, 2023):

It works in virtual environment. But it doesn't work outside of it.

This shows that the issue is the packages installed in your environment.

To fix this, run one of the following:

  • If you installed auto-py-to-exe using pip: pip install auto-py-to-exe --upgrade --force-reinstall
  • If you downloaded the repo and ran auto-py-to-exe from there: pip install -r .\requirements.txt --upgrade --force-reinstall at the root of this project

Update: these solutions will not work!

<!-- gh-comment-id:1748029819 --> @brentvollebregt commented on GitHub (Oct 5, 2023): > It works in virtual environment. But it doesn't work outside of it. This shows that the issue is the packages installed in your environment. To fix this, run one of the following: - If you installed auto-py-to-exe using pip: `pip install auto-py-to-exe --upgrade --force-reinstall` - If you downloaded the repo and ran auto-py-to-exe from there: `pip install -r .\requirements.txt --upgrade --force-reinstall` at the root of this project **Update: these solutions will not work!**
Author
Owner

@Wilsman commented on GitHub (Oct 5, 2023):

has the issue stemmed from upgrading to Python 3.12.0?

<!-- gh-comment-id:1748406298 --> @Wilsman commented on GitHub (Oct 5, 2023): has the issue stemmed from upgrading to Python 3.12.0?
Author
Owner

@brentvollebregt commented on GitHub (Oct 5, 2023):

has the issue stemmed from upgrading to Python 3.12.0?

That's a good thought!

Even though @neelkalpa didn't say what Python version they were using, I think I can assume 3.12 judging by the paths. I imagine the virtual environment was the same version.

I just added Python 3.12 to the tests in this repo and they seemed to run fine - so it looks like an upgrade to 3.12 should be ok.

<!-- gh-comment-id:1748495402 --> @brentvollebregt commented on GitHub (Oct 5, 2023): > has the issue stemmed from upgrading to Python 3.12.0? That's a good thought! Even though @neelkalpa didn't say what Python version they were using, I think I can assume 3.12 judging by the paths. I imagine the virtual environment was the same version. I just added Python 3.12 to the tests in this repo [and they seemed to run fine](https://github.com/brentvollebregt/auto-py-to-exe/actions/runs/6417241816) - so it looks like an upgrade to 3.12 should be ok.
Author
Owner

@CwGmZ971 commented on GitHub (Oct 5, 2023):

  • pip install auto-py-to-exe --upgrade --force-reinstall

Have tried this and this has not fixed the issue, this issue is persistent with Python 3.12.0 when running auto-py-to-exe from the command prompt (CMD)

<!-- gh-comment-id:1748527508 --> @CwGmZ971 commented on GitHub (Oct 5, 2023): > * pip install auto-py-to-exe --upgrade --force-reinstall Have tried this and this has not fixed the issue, this issue is persistent with Python 3.12.0 when running auto-py-to-exe from the command prompt (CMD)
Author
Owner

@Wilsman commented on GitHub (Oct 5, 2023):

I tried the same and failed... i uploaded a pastebin of my terminal which may/may not help 🤞

terminal - pastebin

<!-- gh-comment-id:1748568914 --> @Wilsman commented on GitHub (Oct 5, 2023): I tried the same and failed... i uploaded a pastebin of my terminal which may/may not help 🤞 [terminal - pastebin](https://pastebin.com/3z3ZavG3)
Author
Owner

@brentvollebregt commented on GitHub (Oct 5, 2023):

Thank you, I have been able to reproduce this now,

  1. Installed Python 3.12
  2. Setup a virtual environment: C:\...\Python312\python.exe -m venv .venv
  3. Test version: C:\...\.venv\Scripts\python.exe --version gives "Python 3.12.0"
  4. Install auto-py-to-exe : C:\...\.venv\Scripts\python.exe -m pip install auto-py-to-exe
  5. Run auto-py-to-exe: C:\...\.venv\Scripts\python.exe -m auto_py_to_exe

I get the same as above,

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\Brent\Downloads\t\.venv\Lib\site-packages\auto_py_to_exe\__main__.py", line 10, in <module>
    from . import ui
  File "C:\Users\Brent\Downloads\t\.venv\Lib\site-packages\auto_py_to_exe\ui.py", line 6, in <module>
    import eel
  File "C:\Users\Brent\Downloads\t\.venv\Lib\site-packages\eel\__init__.py", line 16, in <module>
    import bottle.ext.websocket as wbs
ModuleNotFoundError: No module named 'bottle.ext.websocket'

I tested this with Python 3.9.9 and it seemed ok

This looks like an Eel issue, executing C:\...\.venv\Scripts\python.exe -c "import eel" gives the same error. I can't see any recent releases in Eel or bottle.

Interestingly, looking at how import bottle.ext.websocket works, it actually imports the package bottle-websocket. I see I have bottle-websocket 0.2.9 installed so this is a bit odd that it can't import it, maybe bottle's _ImportRedirect is broken?

<!-- gh-comment-id:1748634177 --> @brentvollebregt commented on GitHub (Oct 5, 2023): Thank you, I have been able to reproduce this now, 1. Installed Python 3.12 2. Setup a virtual environment: `C:\...\Python312\python.exe -m venv .venv` 3. Test version: `C:\...\.venv\Scripts\python.exe --version` gives "Python 3.12.0" 4. Install auto-py-to-exe : `C:\...\.venv\Scripts\python.exe -m pip install auto-py-to-exe` 5. Run auto-py-to-exe: `C:\...\.venv\Scripts\python.exe -m auto_py_to_exe` I get the same as above, ``` Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "C:\Users\Brent\Downloads\t\.venv\Lib\site-packages\auto_py_to_exe\__main__.py", line 10, in <module> from . import ui File "C:\Users\Brent\Downloads\t\.venv\Lib\site-packages\auto_py_to_exe\ui.py", line 6, in <module> import eel File "C:\Users\Brent\Downloads\t\.venv\Lib\site-packages\eel\__init__.py", line 16, in <module> import bottle.ext.websocket as wbs ModuleNotFoundError: No module named 'bottle.ext.websocket' ``` > I tested this with Python 3.9.9 and it seemed ok This looks like an Eel issue, executing `C:\...\.venv\Scripts\python.exe -c "import eel"` gives the same error. I can't see any recent releases in Eel or bottle. Interestingly, looking at how `import bottle.ext.websocket` works, it [actually imports the package](https://github.com/bottlepy/bottle/blob/master/bottle.py#L4358) `bottle-websocket`. I see I have `bottle-websocket` 0.2.9 installed so this is a bit odd that it can't import it, maybe bottle's `_ImportRedirect` is broken?
Author
Owner

@brentvollebregt commented on GitHub (Oct 5, 2023):

bottle's last release was on March 5, 2023 with version 0.12.25. Since then, there have been a few changes put on master, but no release has been made to push these changes to PyPI.

I just tried the bottle.py on master in my local setup and it worked fine. So it looks like the code is available, it just hasn't been pushed to PyPI.

Update: The "there have been a few changes put on master" link doesn't give much insight as the master branch and release branch in bottles repo don't hold the same changes.

<!-- gh-comment-id:1748652170 --> @brentvollebregt commented on GitHub (Oct 5, 2023): bottle's last release was on March 5, 2023 with version [0.12.25](https://pypi.org/project/bottle/0.12.25/). [Since then, there have been a few changes put on master](https://github.com/bottlepy/bottle/compare/ca6762c559c5e71e0dff71dc97eb4c6b3ed9bbcd...master), but no release has been made to push these changes to PyPI. I just tried the [bottle.py on master](https://github.com/bottlepy/bottle/blob/99341ff3791b2e7e705d7373e71937e9018eb081/bottle.py) in my local setup and it worked fine. So it looks like the code is available, it just hasn't been pushed to PyPI. **Update: The "there have been a few changes put on master" link doesn't give much insight as the master branch and release branch in bottles repo don't hold the same changes.**
Author
Owner

@DLord420 commented on GitHub (Oct 5, 2023):

Cleared PIP cache and tried pip install auto-py-to-exe --upgrade --force-reinstall again with no luck.

<!-- gh-comment-id:1748654248 --> @DLord420 commented on GitHub (Oct 5, 2023): Cleared PIP cache and tried `pip install auto-py-to-exe --upgrade --force-reinstall` again with no luck.
Author
Owner

@brentvollebregt commented on GitHub (Oct 5, 2023):

Yep, my bad, pip install auto-py-to-exe --upgrade --force-reinstall will not work. Until that bottle change comes though, it doesn't look like we can resolve this.

<!-- gh-comment-id:1748656267 --> @brentvollebregt commented on GitHub (Oct 5, 2023): Yep, my bad, `pip install auto-py-to-exe --upgrade --force-reinstall` will not work. Until that bottle change comes though, it doesn't look like we can resolve this.
Author
Owner

@Wilsman commented on GitHub (Oct 5, 2023):

bottle's last release was on March 5, 2023 with version 0.12.25. Since then, there have been a few changes put on master, but no release has been made to push these changes to PyPI.

I just tried the bottle.py on master in my local setup and it worked fine. So it looks like the code is available, it just hasn't been pushed to PyPI.

thanks for looking into this 👍

<!-- gh-comment-id:1748677680 --> @Wilsman commented on GitHub (Oct 5, 2023): > bottle's last release was on March 5, 2023 with version [0.12.25](https://pypi.org/project/bottle/0.12.25/). [Since then, there have been a few changes put on master](https://github.com/bottlepy/bottle/compare/ca6762c559c5e71e0dff71dc97eb4c6b3ed9bbcd...master), but no release has been made to push these changes to PyPI. > > I just tried the [bottle.py on master](https://github.com/bottlepy/bottle/blob/99341ff3791b2e7e705d7373e71937e9018eb081/bottle.py) in my local setup and it worked fine. So it looks like the code is available, it just hasn't been pushed to PyPI. thanks for looking into this 👍
Author
Owner

@brentvollebregt commented on GitHub (Oct 5, 2023):

The commit we need was put on master back on June 13, 2022 but it appears that releases are not directly done master, but instead in their own release branch - so that explains how the commit was made so long ago but is not in the recent release.

<!-- gh-comment-id:1748686009 --> @brentvollebregt commented on GitHub (Oct 5, 2023): [The commit we need](https://github.com/bottlepy/bottle/commit/ca6762c559c5e71e0dff71dc97eb4c6b3ed9bbcd) was put on master back on June 13, 2022 but it appears that releases are not directly done master, but instead in their own release branch - so that explains how the commit was made so long ago but is not in the recent release.
Author
Owner

@brentvollebregt commented on GitHub (Oct 5, 2023):

I've created an issue at https://github.com/bottlepy/bottle/issues/1430 to let bottle know

<!-- gh-comment-id:1748732106 --> @brentvollebregt commented on GitHub (Oct 5, 2023): I've created an issue at https://github.com/bottlepy/bottle/issues/1430 to let bottle know
Author
Owner

@errantSquam commented on GitHub (Oct 9, 2023):

I've created an issue at bottlepy/bottle#1430 to let bottle know

Hi, thanks for creating the issue!

For everyone else encountering the problem, quick fix I've found using the information raised by @brentvollebregt: Navigate to Python312/Lib/site-packages/bottle.py, and replace the code with the linked version: github.com/bottlepy/bottle@ca6762c559/bottle.py

<!-- gh-comment-id:1752335111 --> @errantSquam commented on GitHub (Oct 9, 2023): > I've created an issue at [bottlepy/bottle#1430](https://github.com/bottlepy/bottle/issues/1430) to let bottle know Hi, thanks for creating the issue! For everyone else encountering the problem, quick fix I've found using the information raised by @brentvollebregt: Navigate to `Python312/Lib/site-packages/bottle.py`, and replace the code with the linked version: https://github.com/bottlepy/bottle/blob/ca6762c559c5e71e0dff71dc97eb4c6b3ed9bbcd/bottle.py
Author
Owner

@brentvollebregt commented on GitHub (Oct 9, 2023):

I have a temporary solution in #434 - this seems to work ok for me.

Could someone else that's having this issue try this out and let me know if it works for you? If so, I'll merge it in and create a release.

<!-- gh-comment-id:1752352364 --> @brentvollebregt commented on GitHub (Oct 9, 2023): I have a temporary solution in #434 - this seems to work ok for me. Could someone else that's having this issue try this out and let me know if it works for you? If so, I'll merge it in and create a release.
Author
Owner

@DLord420 commented on GitHub (Oct 9, 2023):

Tried the proposed solution and it did not work on my machine. I just got page after page error messages ending with:

> NameError: name 'true' is not defined. Did you mean: 'True'?

My apologies, somehow the .py file got messed up while downloading. Had to go to the github address and download it in raw format.
I confirm that the work around indeed solves the problem. Many thanks to all.

<!-- gh-comment-id:1752409356 --> @DLord420 commented on GitHub (Oct 9, 2023): ~~Tried the proposed solution and it did not work on my machine. I just got page after page error messages ending with:~~ ~~> NameError: name 'true' is not defined. Did you mean: 'True'?~~ My apologies, somehow the .py file got messed up while downloading. Had to go to the github address and download it in raw format. I confirm that the work around indeed solves the problem. Many thanks to all.
Author
Owner

@Wilsman commented on GitHub (Oct 9, 2023):

I've created an issue at bottlepy/bottle#1430 to let bottle know

Hi, thanks for creating the issue!

For everyone else encountering the problem, quick fix I've found using the information raised by @brentvollebregt: Navigate to Python312/Lib/site-packages/bottle.py, and replace the code with the linked version: github.com/bottlepy/bottle@ca6762c559/bottle.py

This quick fix worked.

<!-- gh-comment-id:1752536894 --> @Wilsman commented on GitHub (Oct 9, 2023): > > I've created an issue at [bottlepy/bottle#1430](https://github.com/bottlepy/bottle/issues/1430) to let bottle know > > Hi, thanks for creating the issue! > > For everyone else encountering the problem, quick fix I've found using the information raised by @brentvollebregt: Navigate to `Python312/Lib/site-packages/bottle.py`, and replace the code with the linked version: https://github.com/bottlepy/bottle/blob/ca6762c559c5e71e0dff71dc97eb4c6b3ed9bbcd/bottle.py This quick fix worked.
Author
Owner

@brentvollebregt commented on GitHub (Oct 9, 2023):

This should now be fixed in auto-py-to-exe 2.41.0 with the shim added in #434.

I'll close this for now, but if you are still facing this issue please comment here and provide the following:

  • auto-py-to-exe: pip show auto-py-to-exe
  • Python version: python --version
  • bottle version: pip show bottle

Hopefully bottle fixes this soon and we can remove the shim.

<!-- gh-comment-id:1752797730 --> @brentvollebregt commented on GitHub (Oct 9, 2023): This should now be fixed in auto-py-to-exe [2.41.0](https://github.com/brentvollebregt/auto-py-to-exe/releases/tag/v2.41.0) with the shim added in #434. I'll close this for now, but if you are still facing this issue please comment here and provide the following: - auto-py-to-exe: `pip show auto-py-to-exe` - Python version: `python --version` - bottle version: `pip show bottle` Hopefully bottle fixes this soon and we can remove the shim.
Author
Owner

@DLord420 commented on GitHub (Oct 9, 2023):

Just FYI, if you use pip install auto-py-to-exe --upgrade to upgrade to the new version (2.41.0), you will get errors and it won't run.
Make sure to use pip install auto-py-to-exe --upgrade --force-reinstall

<!-- gh-comment-id:1752983764 --> @DLord420 commented on GitHub (Oct 9, 2023): Just FYI, if you use `pip install auto-py-to-exe --upgrade` to upgrade to the new version (2.41.0), you will get errors and it won't run. Make sure to use `pip install auto-py-to-exe --upgrade --force-reinstall`
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#345
No description provided.