No module named flask in Microsoft Visual Studio 2013 - python

When I run a new (Fresh creation without any modifications) Flask Web Project in Visual Studio it does not compile. I get an error "No module named flask". This makes no sense to me because it was a "Flask" project that I created and I didn't do anything to break it. Is it possible that Microsoft provides broken template for new Flask projects? I'm confused.
When I try to add a virtual environment I get the following log:
Value cannot be null.
Parameter name: valueInstalling 'pip' package manager.
Downloading setuptools from https://go.microsoft.com/fwlink/?LinkId=317603
Traceback (most recent call last):
File "E:\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\2.1\pip_downloader.py", line 47, in <module>
setuptools_package, _ = urlretrieve(SETUPTOOLS_SOURCE, 'setuptools.tar.gz')
File "C:\Python27\lib\urllib.py", line 94, in urlretrieve
return _urlopener.retrieve(url, filename, reporthook, data)
File "C:\Python27\lib\urllib.py", line 240, in retrieve
fp = self.open(url, data)
File "C:\Python27\lib\urllib.py", line 208, in open
return getattr(self, name)(url)
File "C:\Python27\lib\urllib.py", line 437, in open_https
h.endheaders(data)
File "C:\Python27\lib\httplib.py", line 991, in endheaders
self._send_output(message_body)
File "C:\Python27\lib\httplib.py", line 844, in _send_output
self.send(msg)
File "C:\Python27\lib\httplib.py", line 806, in send
self.connect()
File "C:\Python27\lib\httplib.py", line 1198, in connect
self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file)
File "C:\Python27\lib\ssl.py", line 392, in wrap_socket
ciphers=ciphers)
File "C:\Python27\lib\ssl.py", line 148, in __init__
self.do_handshake()
File "C:\Python27\lib\ssl.py", line 310, in do_handshake
self._sslobj.do_handshake()
IOError: [Errno socket error] [Errno 8] _ssl.c:510: EOF occurred in violation of protocol
'pip' failed to install. Exit code: 1
C:\Python27\python.exe: No module named pip

you will need to install flask as shown below using powershell in administrator mode
PS C:\Python34> pip install flask
Collecting flask
Downloading Flask-0.10.1.tar.gz (544kB)
100% |################################| 544kB 210kB/s
Collecting Werkzeug>=0.7 (from flask)
Downloading Werkzeug-0.10.4-py2.py3-none-any.whl (293kB)
100% |################################| 294kB 28kB/s
Collecting Jinja2>=2.4 (from flask)
Downloading Jinja2-2.7.3.tar.gz (378kB)
100% |################################| 380kB 262kB/s
Collecting itsdangerous>=0.21 (from flask)
Downloading itsdangerous-0.24.tar.gz (46kB)
100% |################################| 49kB 293kB/s
Collecting markupsafe (from Jinja2>=2.4->flask)
Downloading MarkupSafe-0.23.tar.gz
Building wheels for collected packages: flask, Jinja2, itsdangerous, markupsafe
Running setup.py bdist_wheel for flask
Stored in directory: C:\Users\TrustM\AppData\Local\pip\Cache\wheels\d2\db\61\cb9b80526b8f3ba89248ec0a29d6da1bb60136
930fca987
Running setup.py bdist_wheel for Jinja2
Stored in directory: C:\Users\TrustM\AppData\Local\pip\Cache\wheels\b3\c0\62\8908d15b90a7de8bd15e2e6e5f5ba1398c0d99
62a6bf8f5
Running setup.py bdist_wheel for itsdangerous
Stored in directory: C:\Users\TrustM\AppData\Local\pip\Cache\wheels\97\c0\b8\b37c320ff57e15f993ba0ac98013eee778920b
b3ebae3cf
Running setup.py bdist_wheel for markupsafe
Stored in directory: C:\Users\TrustM\AppData\Local\pip\Cache\wheels\94\a7\79\f79a998b64c1281cb99fa9bbd33cfc9b8b5775
8218d17a7
Successfully built flask Jinja2 itsdangerous markupsafe
Installing collected packages: Werkzeug, markupsafe, Jinja2, itsdangerous, flask
Successfully installed Jinja2-2.7.3 Werkzeug-0.10.4 flask-0.10.1 itsdangerous-0.24 markupsafe-0.23
PS C:\Python34> pip install django
Collecting django
Downloading Django-1.8.2-py2.py3-none-any.whl (6.2MB)
100% |################################| 6.2MB 15kB/s
Installing collected packages: django
Successfully installed django-1.8.2
PS C:\Python34>

Related

Pipenv failing to install any packages

I'm trying to make a virtual environment for a script of mine using pipenv, but whenever I try to install any package I get the following error message:
"Command "python setup.py egg_info" failed with error code 1"
For example, when I try to install pandas:
mycomputer-admin$ pipenv install pandas
Installing pandas...
Collecting pandas
Using cached https://files.pythonhosted.org/packages/d8/ba/d2c6578afca709e211ac1cd836a66a6a042f1a773a970be345d9d08be426/pandas-0.23.3-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Collecting numpy>=1.9.0 (from pandas)
Using cached https://files.pythonhosted.org/packages/6a/d5/218414f0f41cb3f183d55d68dbcd996fa3602d5849bdf2ad6c059e98fa68/numpy-1.15.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Collecting python-dateutil>=2.5.0 (from pandas)
Using cached https://files.pythonhosted.org/packages/cf/f5/af2b09c957ace60dcfac112b669c45c8c97e32f94aa8b56da4c6d1682825/python_dateutil-2.7.3-py2.py3-none-any.whl
Collecting pytz>=2011k (from pandas)
Using cached https://files.pythonhosted.org/packages/30/4e/27c34b62430286c6d59177a0842ed90dc789ce5d1ed740887653b898779a/pytz-2018.5-py2.py3-none-any.whl
Collecting six>=1.5 (from python-dateutil>=2.5.0->pandas)
Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Installing collected packages: numpy, six, python-dateutil, pytz, pandas
Successfully installed numpy-1.15.0 pandas-0.23.3 python-dateutil-2.7.3 pytz-2018.5 six-1.11.0
Adding pandas to Pipfile's [packages]...
Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
243, in get_dependencies
legacy_results = self.get_legacy_dependencies(ireq)
File "/usr/local/Cellar/pipenv/2018.7.1/libexec/lib/python3.7/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 335, in get_legacy_dependencies
self.resolver.resolve(reqset)
File "/usr/local/Cellar/pipenv/2018.7.1/libexec/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/resolve.py", line 107, in resolve
self._resolve_one(requirement_set, req)
File "/usr/local/Cellar/pipenv/2018.7.1/libexec/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/resolve.py", line 264, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/usr/local/Cellar/pipenv/2018.7.1/libexec/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/resolve.py", line 214, in _get_abstract_dist_for
self.require_hashes
File "/usr/local/Cellar/pipenv/2018.7.1/libexec/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/operations/prepare.py", line 328, in prepare_linked_requirement
abstract_dist.prep_for_dist(finder, self.build_isolation)
File "/usr/local/Cellar/pipenv/2018.7.1/libexec/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/operations/prepare.py", line 155, in prep_for_dist
self.req.run_egg_info()
File "/usr/local/Cellar/pipenv/2018.7.1/libexec/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/req/req_install.py", line 486, in run_egg_info
command_desc='python setup.py egg_info')
File "/usr/local/Cellar/pipenv/2018.7.1/libexec/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/utils/misc.py", line 698, in call_subprocess
% (command_desc, proc.returncode, cwd))
pipenv.patched.notpip._internal.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in /var/folders/y1/7zsj8_x973n4xjwg5gg6s53jr4zz65/T/tmp6ghbw5_fbuild/email/
No idea what's going on to cause this. Any thoughts?
My colleague had issues with some of the libraries you are installing and Python 3.7. You could try downgrading to 3.6.

Python: Kivy throws an exception when trying to install it with pip

I am currently trying to install kivy to python 3.6, but when i am trying yo install it it throws the following exception:
C:\Users\magshimim\Desktop\notKivy>python -m pip install kivy
Collecting kivy
Using cached
https://files.pythonhosted.org/packages/29/e6/e07f77a8d85a626bb955fe072d41042c4c
ee6deaca61295f1c08e6407097/Kivy-1.10.0-cp36-cp36m-win32.whl Collecting Kivy-Garden>=0.1.4 (from kivy)
Using cached https://files.pythonhosted.org/packages/7d/68/decaee596ff8168a39432eb3949fc7c0be952ebb9467806823bffc165d48/kivy-garden-0.1.4.tar.gz
Requirement already satisfied: docutils in c:\python36\lib\site-packages (from kivy)
Requirement already satisfied: pygments in c:\python36\lib\site-packages (from kivy)
Requirement already satisfied: requests in c:\python36\lib\site-packages (from Kivy-Garden>=0.1.4->kivy)
Exception:
Traceback (most recent call last):
File "C:\Python36\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Python36\lib\site-packages\pip\commands\install.py", line 335, in run
wb.build(autobuilding=True)
File "C:\Python36\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:\Python36\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Python36\lib\site-packages\pip\req\req_set.py", line 666, in _prepare_file
check_dist_requires_python(dist)
File "C:\Python36\lib\site-packages\pip\utils\packaging.py", line 48, in check_dist_requires_python
feed_parser.feed(metadata)
File "C:\Python36\lib\email\feedparser.py", line 175, in feed
self._input.push(data)
File "C:\Python36\lib\email\feedparser.py", line 103, in push
self._partial.write(data)
TypeError: string argument expected, got 'NoneType'
Any help?
Try instead:
pip install kivy
Worked for me on my Windows machine. Make sure pip is in the Path enviornment variable on your machine.

pip install census for census.gov API

I am very new to python, and I am trying to speak with the census.gov API to find the population of several zipcodes. I was able to get my API key, and I am using this python wrapper: https://github.com/datamade/census. I was able to install pip using the sudo easy_install pip command. Here's an example of the output when I run it again:
Best match: pip 9.0.1
Processing pip-9.0.1-py2.7.egg
pip 9.0.1 is already the active version in easy-install.pth
Installing pip script to /usr/local/bin
Installing pip2.7 script to /usr/local/bin
Installing pip2 script to /usr/local/bin
Using /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
I am trying to use the commands:
pip install census
pip install us
pip install us seems to have worked, but I am getting a Traceback when trying pip install census:
Using cached census-0.8.3-py2.py3-none-any.whl
Collecting requests>=1.1.0 (from census)
Using cached requests-2.18.1-py2.py3-none-any.whl
Collecting urllib3<1.22,>=1.21.1 (from requests>=1.1.0->census)
Using cached urllib3-1.21.1-py2.py3-none-any.whl
Collecting idna<2.6,>=2.5 (from requests>=1.1.0->census)
Using cached idna-2.5-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests>=1.1.0->census)
Using cached certifi-2017.4.17-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests>=1.1.0->census)
Using cached chardet-3.0.4-py2.py3-none-any.whl
Installing collected packages: urllib3, idna, certifi, chardet, requests, census
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 784, in install
**kwargs
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 316, in clobber
ensure_dir(destdir)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/urllib3'
I am not sure what to do. Can anyone help? I am using python 2.7.10 by the way.
Your user doesn't have write permissions on /System/Library. Either run pip install from the root user or use pip install -u to install the library to your own directory instead of the system one.

unable to install Boto3 on windows

I am getting below exception after running pip install boto3 command
C:\boto3-develop>pip install boto3
Collecting boto3
Downloading boto3-1.4.4-py2.py3-none-any.whl (127kB)
100% |████████████████████████████████| 133kB 281kB/s
Collecting jmespath<1.0.0,>=0.7.1 (from boto3)
Downloading jmespath-0.9.2-py2.py3-none-any.whl
Collecting s3transfer<0.2.0,>=0.1.10 (from boto3) Downloading
s3transfer-0.1.10-py2.py3-none-any.whl (54kB)
100% |████████████████████████████████| 61kB 787kB/s
Collecting botocore<1.6.0,>=1.5.0 (from boto3) Downloading
botocore-1.5.26-py2.py3-none-any.whl (3.4MB)
100% |████████████████████████████████| 3.4MB 81kB/s
Collecting docutils>=0.10 (from botocore<1.6.0,>=1.5.0->boto3)
Downloading docutils-0.13.1-py3-none-any.whl (536kB)
100% |████████████████████████████████| 542kB 205kB/s
Collecting python-dateutil<3.0.0,>=2.1 (from
botocore<1.6.0,>=1.5.0->boto3) Downloading
python_dateutil-2.6.0-py2.py3-none-any.whl (194kB)
100% |████████████████████████████████| 194kB 273kB/s
Collecting six>=1.5 (from
python-dateutil<3.0.0,>=2.1->botocore<1.6.0,>=1.5.0->b oto3)
Downloading six-1.10.0-py2.py3-none-any.whl
Installing collected packages: jmespath, docutils, six,
python-dateutil, botocor e, s3transfer, boto3
Exception: Traceback (most recent call last): File "c:\program files
(x86)\python36-32\lib\site-packages\pip\basecommand.py" , line 215, in
main
status = self.run(options, args)
File "c:\program files
(x86)\python36-32\lib\site-packages\pip\commands\instal l.py", line
342, in run
prefix=options.prefix_path,
File "c:\program files
(x86)\python36-32\lib\site-packages\pip\req\req_set.py" , line 784, in
install
**kwargs
File "c:\program files
(x86)\python36-32\lib\site-packages\pip\req\req_install .py", line
851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "c:\program files
(x86)\python36-32\lib\site-packages\pip\req\req_install .py", line
1064, in move_wheel_files
isolated=self.isolated,
File "c:\program files
(x86)\python36-32\lib\site-packages\pip\wheel.py", line 345, in
move_wheel_files
clobber(source, lib_dir, True)
File "c:\program files
(x86)\python36-32\lib\site-packages\pip\wheel.py", line 316, in
clobber
ensure_dir(destdir)
File "c:\program files
(x86)\python36-32\lib\site-packages\pip\utils__init__. py", line 83,
in ensure_dir
os.makedirs(path)
File "c:\program files (x86)\python36-32\lib\os.py", line 220, in
makedirs
mkdir(name, mode)
PermissionError: [WinError 5] Access is denied: 'c:\program files
(x86)\python 36-32\Lib\site-packages\jmespath'
C:\boto3-develop>
Make sure you are running the command line as administrator. Lack of privileges often prevents installation of python packages.

Installing matplotlib using pip gives error

I am new to python and is using pip to download and install packages. I ran the following code on my command window and it throws an error
pip install matplotlib
And the process starts as
Collecting matplotlib
Using cached matplotlib-1.5.3-cp27-cp27m-win32.whl
Collecting numpy>=1.6 (from matplotlib)
Using cached numpy-1.11.2-cp27-none-win32.whl
Collecting python-dateutil (from matplotlib)
Using cached python_dateutil-2.5.3-py2.py3-none-any.whl
Collecting cycler (from matplotlib)
Using cached cycler-0.10.0-py2.py3-none-any.whl
Collecting pyparsing!=2.0.4,!=2.1.2,>=1.5.6 (from matplotlib)
Using cached pyparsing-2.1.10-py2.py3-none-any.whl
Collecting pytz (from matplotlib)
Using cached pytz-2016.7-py2.py3-none-any.whl
Collecting six>=1.5 (from python-dateutil->matplotlib)
Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: numpy, six, python-dateutil, cycler, pyparsing, pytz, matplotlib
Exception:
Traceback (most recent call last):
File "c:\python27\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "c:\python27\lib\site-packages\pip\commands\install.py", line 317, in run
prefix=options.prefix_path,
File "c:\python27\lib\site-packages\pip\req\req_set.py", line 742, in install
**kwargs
File "c:\python27\lib\site-packages\pip\req\req_install.py", line 831, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "c:\python27\lib\site-packages\pip\req\req_install.py", line 1032, in move_wheel_files
isolated=self.isolated,
File "c:\python27\lib\site-packages\pip\wheel.py", line 346, in move_wheel_files
clobber(source, lib_dir, True)
File "c:\python27\lib\site-packages\pip\wheel.py", line 324, in clobber
shutil.copyfile(srcfile, destfile)
File "c:\python27\lib\shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: 'c:\\python27\\Lib\\site-packages\\numpy\\core\\multiarray.pyd'
And it gives these traceback errors. I'm unable to figure out what these errors are and how to solve them. Please help. It works perfectly till collecting the packages but at the time of installing it throws errors.
If you're using Windows, the easiest way to install many of the numerically-oriented Python packages is to download one of wheels containing pre-compiled binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/, and install using pip:
pip install SomePackage-1.0-py2.py3-none-any.whl
Make sure to download the right wheel version (Python2 or Python3, 32 bit or 64 bit) for your Python installation.
Try python -m pip install matplotlib.
or
Open the cmd as administrator
then python -m pip install matplotlib

Categories

Resources