I have been trying to run this project
I installed all the dependencies. I still did not make any adjustments. I need to run it first but I get this error when I type the command
python main.py this is the error i get:
Traceback (most recent call last): File "main.py", line 8, in <module> import jwt ImportError: No module named jwt I worked with similar errors before and managed to solve them but not with this one I could not figure out the source of the problem
17 Answers
- Check if PyJWTY is in the requirements file or if is installed in you system, using: pip3 install PyJWT
- You could also face this error if you have running on your machine two versions of python. So the correct command will be python3 main.py
I have hit the same issue with pyjwt 2.1.0 which was clearly installed in my venv as well as globally. What helped was to downgrade it to version 1.7.1
pip install "PyJWT==1.7.1"
run the app and then to reinstall newest version 2.1.0
pip install "PyJWT==2.1.0"
And the issue disappeared.
This project has requirements that need to be installed for it to work. These can be installed via pip, pip install -r requirements.txt (I've linked to the requirements file in the project), which you can read more about here.
What worked for me was using import jwt instead of import PyJWT. I am using version PyJWT-2.3.0.
jwt image on vscode As you can see no errors in the above screenshot. The app runs without import errors. Image of terminal
You have to have only PyJWT installed and not JWT. Make sure you uninstall JWT (pip uninstall JWT) and install PyJWT (pip install PyJWT)
Faced the same issue. Am using a guest VM running ubuntu 16.04. I have multiple versions of python installed - both 3.5 and 3.7.
After repeated tries with and without using virtualenv what worked finally is:
Create a fresh virtual environment using :
priya:~$ virtualenv -p /usr/bin/python3.7 fenvActivate the virutal environment : priya:~$ source ./fenv/bin/activate
Note : You can find the path for python3.7 by using whereis python: priya:~$ whereis python python: /usr/bin/python /usr/bin/python3.5m /usr/bin/python3.5 /usr/bin/python3.7 /usr/bin/python3.5m-config /usr/bin/python3.5-config /usr/bin/python2.7 /usr/bin/python3.7m /usr/bin/python2.7-config /usr/lib/python3.5 /usr/lib/python3.7 /usr/lib/python2.7 /etc/python /etc/python3.5 /etc/python3.7 /etc/python2.7 /usr/local/lib/python3.5 /usr/local/lib/python3.7 /usr/local/lib/python2.7 /usr/include/python3.5m /usr/include/python3.5 /usr/include/python2.7 /usr/share/python /usr/share/man/man1/python.1.gz
For your project - FSWD Nanodegree - After you have activated your virtualenv, run pip install -r requirements.txt You can test by : (fenv) priya:FSND-Deploy-Flask-App-to-Kubernetes-Using-EKS :~$ python Python 3.7.9 (default, Aug 18 2020, 06:24:24) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information.
import jwt exit()
pip3 install flask_jwt_ex.. I was doing this without sudo. And then I was working on the program as sudo.