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

Python 3.12.0 ModuleNotFoundError: No module named 'bottle.ext.websocket' #433

Closed
neelkalpa opened this issue Oct 3, 2023 · 23 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@neelkalpa
Copy link

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!

@neelkalpa neelkalpa added the bug Something isn't working label Oct 3, 2023
@github-actions
Copy link

github-actions bot commented 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.

@brentvollebregt
Copy link
Owner

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 😕

@brentvollebregt brentvollebregt added question Further information is required and removed bug Something isn't working labels Oct 4, 2023
@DLord420
Copy link

DLord420 commented Oct 4, 2023

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

@neelkalpa
Copy link
Author

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?

@Wilsman
Copy link

Wilsman commented Oct 4, 2023

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

@brentvollebregt
Copy link
Owner

brentvollebregt commented 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!

@Wilsman
Copy link

Wilsman commented Oct 5, 2023

has the issue stemmed from upgrading to Python 3.12.0?

@brentvollebregt
Copy link
Owner

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.

@CwGmZ971
Copy link

CwGmZ971 commented 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)

@Wilsman
Copy link

Wilsman commented Oct 5, 2023

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

terminal - pastebin

@brentvollebregt
Copy link
Owner

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?

@brentvollebregt
Copy link
Owner

brentvollebregt commented 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.

@DLord420
Copy link

DLord420 commented Oct 5, 2023

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

brentvollebregt added a commit that referenced this issue Oct 5, 2023
Need to get #433 sorted before we can say Python 3.12 is supported
@brentvollebregt
Copy link
Owner

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.

@brentvollebregt brentvollebregt added bug Something isn't working and removed question Further information is required labels Oct 5, 2023
@Wilsman
Copy link

Wilsman commented 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 👍

@brentvollebregt
Copy link
Owner

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.

@brentvollebregt
Copy link
Owner

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

@errantSquam
Copy link

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: https://github.com/bottlepy/bottle/blob/ca6762c559c5e71e0dff71dc97eb4c6b3ed9bbcd/bottle.py

@brentvollebregt
Copy link
Owner

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.

@DLord420
Copy link

DLord420 commented 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.

@Wilsman
Copy link

Wilsman commented 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: https://github.com/bottlepy/bottle/blob/ca6762c559c5e71e0dff71dc97eb4c6b3ed9bbcd/bottle.py

This quick fix worked.

@brentvollebregt
Copy link
Owner

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.

@brentvollebregt brentvollebregt unpinned this issue Oct 9, 2023
@brentvollebregt brentvollebregt pinned this issue Oct 9, 2023
@DLord420
Copy link

DLord420 commented 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

@brentvollebregt brentvollebregt unpinned this issue Oct 30, 2023
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

No branches or pull requests

6 participants