[Bug] ModuleNotFoundError: No module named 'msgpack'
Description
When attempting to start the Uvicorn server with the command uvicorn --reload api.main:app, the process fails with a ModuleNotFoundError for the module msgpack.
Steps to Reproduce
Ensure the virtual environment is activated: source .venv/bin/activate
Run the command: uvicorn --reload api.main:app
Expected Behavior
The Uvicorn server should start and run without any module import errors.
Actual Behavior
The server fails to start, and the following traceback is displayed:
(.venv) raul@raul:~/scidx-api$ uvicorn --reload api.main:app
INFO: Will watch for changes in these directories: ['/home/raul/scidx-api']
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process [1446945] using WatchFiles
Process SpawnProcess-1:
Traceback (most recent call last):
File "/usr/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
self.run()
File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/home/raul/scidx-api/.venv/lib/python3.10/site-packages/uvicorn/_subprocess.py", line 80, in subprocess_started
target(sockets=sockets)
File "/home/raul/scidx-api/.venv/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
return asyncio.run(self.serve(sockets=sockets))
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
File "/home/raul/scidx-api/.venv/lib/python3.10/site-packages/uvicorn/server.py", line 69, in serve
await self._serve(sockets)
File "/home/raul/scidx-api/.venv/lib/python3.10/site-packages/uvicorn/server.py", line 76, in _serve
config.load()
File "/home/raul/scidx-api/.venv/lib/python3.10/site-packages/uvicorn/config.py", line 434, in load
self.loaded_app = import_from_string(self.app)
File "/home/raul/scidx-api/.venv/lib/python3.10/site-packages/uvicorn/importer.py", line 22, in import_from_string
raise exc from None
File "/home/raul/scidx-api/.venv/lib/python3.10/site-packages/uvicorn/importer.py", line 19, in import_from_string
module = importlib.import_module(module_str)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/raul/scidx-api/api/main.py", line 5, in <module>
import api.routes as routes
File "/home/raul/scidx-api/api/routes/__init__.py", line 3, in <module>
from .register_routes import router as register_router
File "/home/raul/scidx-api/api/routes/register_routes/__init__.py", line 8, in <module>
from .post_stream import router as post_stream_router
File "/home/raul/scidx-api/api/routes/register_routes/post_stream.py", line 2, in <module>
from api.services.streaming_services.stream_manager import create_stream
File "/home/raul/scidx-api/api/services/streaming_services/__init__.py", line 1, in <module>
from .compressor import compress_data, decompress_data
File "/home/raul/scidx-api/api/services/streaming_services/compressor.py", line 1, in <module>
import msgpack
ModuleNotFoundError: No module named 'msgpack'
Possible Solution
Ensure the msgpack module is installed in the virtual environment. You need to add the library to requeriments.txt
[Bug] ModuleNotFoundError: No module named 'msgpack'
Description
When attempting to start the Uvicorn server with the command
uvicorn --reload api.main:app
, the process fails with aModuleNotFoundError
for the modulemsgpack
.Steps to Reproduce
source .venv/bin/activate
uvicorn --reload api.main:app
Expected Behavior
The Uvicorn server should start and run without any module import errors.
Actual Behavior
The server fails to start, and the following traceback is displayed:
Possible Solution
Ensure the
msgpack
module is installed in the virtual environment. You need to add the library to requeriments.txtAdditional Context
None.