module not found markupsafe

77 Views Asked by At

I create a virtual env:

> virtualenv -p python3 spectap

I activate it and install packages from requirements.txt in it:

> . spectap/bin/activate
> pip3 install -r requirements.txt

Running my flask app in debug mode gives me this error:

Traceback (most recent call last):
  File "/home/ec2-user/app4/app/spectap/bin/flask", line 5, in <module>
    from flask.cli import main
  File "/home/ec2-user/app4/app/spectap/local/lib/python3.6/dist-packages/flask/__init__.py", line 1, in <module>
    from markupsafe import escape
ModuleNotFoundError: No module named 'markupsafe'

I install markupsafe:

(spectap) [ec2-user@ip-172-31-23-155 app]$ pip3 install MarkupSafe==2.0.1
Collecting MarkupSafe==2.0.1
  Using cached MarkupSafe-2.0.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (30 kB)
Installing collected packages: MarkupSafe
  WARNING: Value for scheme.purelib does not match. Please report this to <https://github.com/pypa/pip/issues/10151>
  distutils: /home/ec2-user/app4/app/spectap/lib/python3.6/dist-packages
  sysconfig: /home/ec2-user/app4/app/spectap/lib/python3.6/site-packages
  WARNING: Additional context:
  user = False
  home = None
  root = None
  prefix = None
Successfully installed MarkupSafe-2.0.1

After installation in my virtual env, I run pip show markupsafe but it still does not seem to find the package:

(spectap) [ec2-user@ip-172-31-23-155 app]$ pip3 show markupsafe
WARNING: Package(s) not found: markupsafe

Also re-running my flask app still shows the no module named markupsafe error.

What am I missing?

P.S. Here is what the path variable looks like from inside the virtual environment:

(spectap) [ec2-user@ip-172-31-23-155 app]$ python -c "import sys; print(sys.path)"
['', 
 '/home/ec2-user/app5/app/spectap/local/lib64/python3.6/site-packages', 
 '/home/ec2-user/app5/app/spectap/local/lib/python3.6/site-packages', 
 '/home/ec2-user/app5/app/spectap/lib64/python3.6', 
 '/home/ec2-user/app5/app/spectap/lib/python3.6', 
 '/home/ec2-user/app5/app/spectap/lib64/python3.6/site-packages', 
 '/home/ec2-user/app5/app/spectap/lib/python3.6/site-packages', 
 '/home/ec2-user/app5/app/spectap/lib64/python3.6/lib-dynload', 
 '/home/ec2-user/app5/app/spectap/local/lib/python3.6/dist-packages', 
 '/usr/lib64/python3.6', '/usr/lib/python3.6']
0

There are 0 best solutions below