Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error installing Flask - Python

I am still trying to install Flask on the 'virtual enviroments'. I had some errors trying to get the pip commands when virtualenv activated. (had something to do that my username has a space in the name) But finally found a solutions, just type the right path to where pip is located, to avoid the username folder.

(venv) C:\Users\Daniel P-C>cd C:\Python34\Scripts

(venv) C:\Python34\Scripts>pip

 Usage:
      pip <command> [options]
 etc...

well when trying to install flask I get the following errors

(venv) C:\Python34\Scripts>pip install flask
Downloading/unpacking flask
  Running setup.py (path:C:\Users\DANIEL~1\AppData\Local\Temp\pip_build_Daniel P
-C\flask\setup.py) egg_info for package flask

    warning: no files found matching '*' under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory
 'docs'
    warning: no previously-included files matching '*.pyo' found under directory
 'docs'
    warning: no previously-included files matching '*.pyc' found under directory
 'tests'
    warning: no previously-included files matching '*.pyo' found under directory
 'tests'
    warning: no previously-included files matching '*.pyc' found under directory
 'examples'
    warning: no previously-included files matching '*.pyo' found under directory
 'examples'
    no previously-included directories found matching 'docs\_build'
    no previously-included directories found matching 'docs\_themes\.git'
Downloading/unpacking Werkzeug>=0.7 (from flask)
  Running setup.py (path:C:\Users\DANIEL~1\AppData\Local\Temp\pip_build_Daniel P
-C\Werkzeug\setup.py) egg_info for package Werkzeug

    warning: no files found matching '*' under directory 'werkzeug\debug\templat
es'
    warning: no files found matching '*' under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory
 'docs'
    warning: no previously-included files matching '*.pyo' found under directory
 'docs'
    warning: no previously-included files matching '*.pyc' found under directory
 'tests'
    warning: no previously-included files matching '*.pyo' found under directory
 'tests'
    warning: no previously-included files matching '*.pyc' found under directory
 'examples'
    warning: no previously-included files matching '*.pyo' found under directory
 'examples'
    no previously-included directories found matching 'docs\_build'
Downloading/unpacking Jinja2>=2.4 (from flask)
  Running setup.py (path:C:\Users\DANIEL~1\AppData\Local\Temp\pip_build_Daniel P
-C\Jinja2\setup.py) egg_info for package Jinja2

    warning: no files found matching '*' under directory 'custom_fixers'
    warning: no previously-included files matching '*' found under directory 'do
cs\_build'
    warning: no previously-included files matching '*.pyc' found under directory
 'jinja2'
    warning: no previously-included files matching '*.pyc' found under directory
 'docs'
    warning: no previously-included files matching '*.pyo' found under directory
 'jinja2'
    warning: no previously-included files matching '*.pyo' found under directory
 'docs'
Downloading/unpacking itsdangerous>=0.21 (from flask)
  Running setup.py (path:C:\Users\DANIEL~1\AppData\Local\Temp\pip_build_Daniel P
-C\itsdangerous\setup.py) egg_info for package itsdangerous

    warning: no previously-included files matching '*' found under directory 'do
cs\_build'
Downloading/unpacking markupsafe (from Jinja2>=2.4->flask)
  Downloading MarkupSafe-0.23.tar.gz
  Running setup.py (path:C:\Users\DANIEL~1\AppData\Local\Temp\pip_build_Daniel P
-C\markupsafe\setup.py) egg_info for package markupsafe

Installing collected packages: flask, Werkzeug, Jinja2, itsdangerous, markupsafe

  Running setup.py install for flask

    warning: no files found matching '*' under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory
 'docs'
    warning: no previously-included files matching '*.pyo' found under directory
 'docs'
    warning: no previously-included files matching '*.pyc' found under directory
 'tests'
    warning: no previously-included files matching '*.pyo' found under directory
 'tests'
    warning: no previously-included files matching '*.pyc' found under directory
 'examples'
    warning: no previously-included files matching '*.pyo' found under directory
 'examples'
    no previously-included directories found matching 'docs\_build'
    no previously-included directories found matching 'docs\_themes\.git'
  Running setup.py install for Werkzeug

    warning: no files found matching '*' under directory 'werkzeug\debug\templat
es'
    warning: no files found matching '*' under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory
 'docs'
    warning: no previously-included files matching '*.pyo' found under directory
 'docs'
    warning: no previously-included files matching '*.pyc' found under directory
 'tests'
    warning: no previously-included files matching '*.pyo' found under directory
 'tests'
    warning: no previously-included files matching '*.pyc' found under directory
 'examples'
    warning: no previously-included files matching '*.pyo' found under directory
 'examples'
    no previously-included directories found matching 'docs\_build'
  Running setup.py install for Jinja2

    warning: no files found matching '*' under directory 'custom_fixers'
    warning: no previously-included files matching '*' found under directory 'do
cs\_build'
    warning: no previously-included files matching '*.pyc' found under directory
 'jinja2'
    warning: no previously-included files matching '*.pyc' found under directory
 'docs'
    warning: no previously-included files matching '*.pyo' found under directory
 'jinja2'
    warning: no previously-included files matching '*.pyo' found under directory
 'docs'
  Running setup.py install for itsdangerous

    warning: no previously-included files matching '*' found under directory 'do
cs\_build'
  Running setup.py install for markupsafe

    building 'markupsafe._speedups' extension
    ==========================================================================
    WARNING: The C extension could not be compiled, speedups are not enabled.
    Failure information, if any, is above.
    Retrying the build without the C extension now.


    ==========================================================================
    WARNING: The C extension could not be compiled, speedups are not enabled.
    Plain-Python installation succeeded.
    ==========================================================================
Successfully installed flask Werkzeug Jinja2 itsdangerous markupsafe
Cleaning up...

it says that it has successfully installed flask, but when running python and trying to type import flask it is like it isn't installed? What can I do?

(venv) C:\Python34\Scripts>python
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import flask
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'flask'

I am btw running on Windows 7

like image 972
Sigils Avatar asked Feb 02 '26 13:02

Sigils


1 Answers

Be sure, you use pip and python from venv

For a module/package to be installed by pip into virtualenv, you must use the pip from virtualenv.

For importing modules/packages being installed into virtualenv environment you have to run python interpreter from given virtualenv.

In case, you run your pip or python from directory C:\Python 34\Scripts, it is very likely, you use system wide pip and install flask into system Python. On Linux you would get problems as installing into system wide python requires root privileges, on MS Windows default Python installation it does not complain.

Advice: Create your virtualenv out of default Python installation directory and use pip and python from this virtulaenv. This is what usually happens, when you activate the virtualenv, so there is no need to explicitly using full path to pip or python (anyway, using explicit path to venv python and pip would not harm anything.

like image 81
Jan Vlcinsky Avatar answered Feb 05 '26 05:02

Jan Vlcinsky