-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Sanic failed to start when installed using PDM #2828
Comments
Confirmed. This appears to be an upstream issue with tracerite [💻 ssadowski@q|test-sanic]$ pdm run sanic
Traceback (most recent call last):
File "/playground/test-sanic/.venv/bin/sanic", line 5, in <module>
from sanic.__main__ import main
File "/playground/test-sanic/.venv/lib/python3.11/site-packages/sanic/__init__.py", line 6, in <module>
from sanic.app import Sanic
File "/playground/test-sanic/.venv/lib/python3.11/site-packages/sanic/app.py", line 55, in <module>
from sanic.application.state import ApplicationState, ServerStage
File "/playground/test-sanic/.venv/lib/python3.11/site-packages/sanic/application/state.py", line 13, in <module>
from sanic.server.async_server import AsyncioServer
File "/playground/test-sanic/.venv/lib/python3.11/site-packages/sanic/server/__init__.py", line 5, in <module>
from sanic.server.runners import serve
File "/playground/test-sanic/.venv/lib/python3.11/site-packages/sanic/server/runners.py", line 6, in <module>
from sanic.config import Config
File "/playground/test-sanic/.venv/lib/python3.11/site-packages/sanic/config.py", line 13, in <module>
from sanic.errorpages import DEFAULT_FORMAT, check_error_format
File "/playground/test-sanic/.venv/lib/python3.11/site-packages/sanic/errorpages.py", line 26, in <module>
from sanic.pages.error import ErrorPage
File "/playground/test-sanic/.venv/lib/python3.11/site-packages/sanic/pages/error.py", line 3, in <module>
import tracerite.html
File "/playground/test-sanic/.venv/lib/python3.11/site-packages/tracerite/__init__.py", line 1, in <module>
import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources' Tagging in @Tronic and it may make sense to open a correlating issue there. |
Looks like it is missing setuptools (where that module comes from). Normally Python comes with that installed, but in virtual envs it is apparently not available. Can you try If that fixes it, we are just missing that dependency in tracerite. |
I added setuptools and it failed without error (correctly, I might add, because there's nothing for it to actually run yet) so I'd say that seems to be accurate. I'll create a quick stub for sanic after work and verify. |
Yes, you are correct. After |
Fixed (not tested) on Tracerite git now. Needs a new tracerite release, @ahopkins can you push one out? |
@Tronic
|
Upcoming tracerite-1.1.1 (git main) no longer uses |
Tracerite 1.1.1 still depends on |
Sorry about that. Can you try if the PR solves this issue so we could get that released as another version... sanic-org/tracerite#10 |
confirmed still an issue with sanic v23.12.1 as of Feb 13, 2024. installing setuptools to the virtualenv fixed the issue for me. edit: I was not using PDM, just new virtualenv, |
Is there an existing issue for this?
Describe the bug
As mentioned in the the book Python Web Developmentwith Sanic, I installed sanic with pdm:
$ mkdir test-sanic $ cd test-sanic $ pdm init ... with all default settings $ pdm run sanic
It failed with:
ModuleNotFoundError: No module named 'pkg_resources'
Same error within virtual environment created by pdm as:
$ . .venv/bin/activate [.venv]$ sanic
python version 3.11
sanic version 23.6.0
pdm version 2.9.2
Code snippet
No response
Expected Behavior
Should be able to run sanic CLI, it worked with virtual environment I created manually.
How do you run Sanic?
Sanic CLI
Operating System
Linux
Sanic Version
23.6.0
Additional context
No response
The text was updated successfully, but these errors were encountered: