Closed heshdotcc closed 3 years ago
Hi @fchpr, can you please provide full stacktrace? Thank you!
Feel free to ask me anything else, and thanks to you for such quick response...
Can you try if this resolves both your issues (FileNotFoundError originally included in this issue, and the Traceback you added above for NoSuchOptionException).
pyproject.toml
poetry env remove python # this will delete virtualenv
poetry # this will install all dependencies (again)
cd app # this will navigate to the folder where the FastAPI app is located
poetry run uvicorn main:app --reload # this will run uvicorn with hot reloading
Now it throws:
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process [11076] using statreload
Process SpawnProcess-1:
Traceback (most recent call last):
File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3.9/site-packages/uvicorn/subprocess.py", line 61, in subprocess_started
target(sockets=sockets)
File "/usr/lib/python3.9/site-packages/uvicorn/server.py", line 48, in run
loop.run_until_complete(self.serve(sockets=sockets))
File "uvloop/loop.pyx", line 1456, in uvloop.loop.Loop.run_until_complete
File "/usr/lib/python3.9/site-packages/uvicorn/server.py", line 55, in serve
config.load()
File "/usr/lib/python3.9/site-packages/uvicorn/config.py", line 308, in load
self.loaded_app = import_from_string(self.app)
File "/usr/lib/python3.9/site-packages/uvicorn/importer.py", line 23, in import_from_string
raise exc from None
File "/usr/lib/python3.9/site-packages/uvicorn/importer.py", line 20, in import_from_string
module = importlib.import_module(module_str)
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "./main.py", line 4, in <module>
from routers import foo
File "./routers/foo.py", line 3, in <module>
from services.foo import FooService
File "./services/foo.py", line 6, in <module>
from utils.service_result import ServiceResult
File "./utils/service_result.py", line 1, in <module>
from loguru import logger
ModuleNotFoundError: No module named 'loguru'
It seems an issue related to virtualenv, maybe since I had upgraded the system (now it's running on Python 3.9).
This seems to be an specific issue related to my system. Worked in other environment.
Edit: The following command...
poetry -vvv run uvicorn main:app --reload
throws:
And regarding the environment...
poetry env info
throws: