Process SpawnProcess-9:
Traceback (most recent call last):
File "C:\Users\gveda\AppData\Local\Programs\Python\Python310\lib\multiprocessing\process.py", line 314, in _bootstrap
self.run()
File "C:\Users\gveda\AppData\Local\Programs\Python\Python310\lib\multiprocessing\process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\gveda\AppData\Local\Programs\Python\Python310\lib\site-packages\uvicorn\_subprocess.py", line 76, in subprocess_started
target(sockets=sockets)
File "C:\Users\gveda\AppData\Local\Programs\Python\Python310\lib\site-packages\uvicorn\server.py", line 60, in run
return asyncio.run(self.serve(sockets=sockets))
File "C:\Users\gveda\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\gveda\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 649, in run_until_complete
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "D:\Programs\FastAPI\.\Blog\main.py", line 4, in <module> from .routers import blog,user,auth
File "D:\Programs\FastAPI\.\Blog\routers\auth.py", line 3, in <module> from .. import schemas,database,models,token
File "D:\Programs\FastAPI\.\Blog\token.py", line 2, in <module>
from jose import JWTError, jwt
ModuleNotFoundError: No module named 'jose'
I have already installed python-jose module still it is giving me the error that there is module named jose. From jose module I am importing jwt and there is no module of it. Why ??
I already installed python-jose and jose modules separately still the same error occurs.
this is a common mistake and it all stems from environment variables. The problem is that when you write
pip
in you command line, it points to a path to a certainpip.exe
that could bepython/3.9/lib/pip.exe
python/3.11/lib/pip.exe
,python/3.x/lib/pip.exe
or any other version of python installed on your machine. So it's likely you installed your lib with a different pip then the one linked to the python executable you are calling your script with.So either you change your environment variables to something like
pip39
andpip311
or you call the specific pip like so:Windows
Thanks to
where
we are able to find all instances of python on our machine.Then all you need to do is call pip like so:
Now when you call your script you should specify which executable you want to use.
Linux
For the
where
function usewhereis
. Apart from that using python is the same, so calling a specificpip
and running your script with a specificpython.exe
is the same.I hope this will help someone!