Am facing the below error while trying to import Flask. Similar questions posted had issues with Werkzeug versions
from urllib.request import parse_http_list as _parse_list_header
ImportError: No module named request
File "init__.py", line 25, in <module>
from flask import Flask
File "user/anaconda/lib/python2.7/site-packages/flask/__init__.py", line 17,
in <module>
from werkzeug.exceptions import abort
File "user/anaconda/lib/python2.7/site-packages/werkzeug/__init__.py", line
154, in <module>
__import__('werkzeug.exceptions')
File "user/anaconda/lib/python2.7/site-packages/werkzeug/exceptions.py", line
71, in <module>
from werkzeug.wrappers import Response
File "user/anaconda/lib/python2.7/site-packages/werkzeug/wrappers.py", line
26, in <module>
from werkzeug.http import HTTP_STATUS_CODES, \
File "user/anaconda/lib/python2.7/site-packages/werkzeug/http.py", line 28, in
<module>
from urllib.request import parse_http_list as _parse_list_header
ImportError: No module named request'
Werkzeug version(I tried with 10.1,10.4 ) still the error remains.
Someone pointed out that there might be a local copy of urllib2.. I figured out that there was both urllib and urllib2 indeed in my local path.. /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
Now I am not sure how to proceed, Should I uninstall urllib/urllib2 ?
EDIT: The solution listed in Tried to use relative imports, and broke my import paths? doesn't work for me. In this case, I tried importing urllib2 into my Flask project and printing out the file path, but that throws the below exceptions
File "/user/__init__.py", line 25, in <module>
import urllib2
File "/user/anaconda/lib/python2.7/urllib2.py", line 94, in <module>
import httplib
File "/user/anaconda/lib/python2.7/httplib.py", line 80, in <module>
import mimetools
File "/user/anaconda/lib/python2.7/mimetools.py", line 6, in <module>
import tempfile
File "/user/anaconda/lib/python2.7/tempfile.py", line 32, in <module>
import io as _io
File "/user/anaconda/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: dlopen(/user/anaconda/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyErr_ReplaceException Referenced from: /user/anaconda/lib/python2.7/lib-dynload/_io.so Expected in: dynamic lookup