3

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

1
  • btw - the warnings, complaining about missing files are fine. They mostly result from installation package containing MANIFEST.in file declaring inclusion of some files, which are in fact not part of installation package. This is quite common for doc(s) directory, often also for test and other ones as seen here. Commented Jul 9, 2014 at 19:26

3 Answers 3

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Greetings Jan, I think I have tried your following solution(please correct me if I misunderstood you). First I create the "folder" $ virtualenv venv after that I activate the virtual server $ venv\Scripts\activate so if I dont type the full path to pip and just type pip install flask I will get the following error: Fatal error in launcher: Unable to create process using '""C:\Users\Daniel P-C\v env\Scripts\python.exe"" "C:\Users\Daniel P-C\venv\Scripts\pip.exe" ' how can I create a virtualenv out of default Python and then use pip/python?
@Sigils I would recommend two things. First: try to work in directory, which does not contain spaces in path. I used to have directory C:\var\devel and from there I was trying to do my programming. Second: Find out some virtualenv tutorial, ideally using Windows and try to get through it. You shall get familiar with basic activities like activation, deactivation etc., it will pay back many times. If it still makes problem, add details into your question and I am sure, you will get some help.
1

I had exactly the same problem as you, and the answer of Jan didn't work for me.

The problem was simply that I installed virtualenv using apt-get:

$ sudo apt-get install virtualenv

Instead of installing it with pip:

$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ sudo python get-pip.py
$ sudo pip install virtualenv

It solved the problem for me. You can even uninstall the apt-get package after:

$ sudo apt-get remove virtualenv

virtualenv is still installed (but the good one!).

Comments

-2

Did you add python to your path?

Try this:

  1. Click Start
  2. Search Advanced Systems setting and click
  3. Click on Environmental Variables.
  4. Append ;C:\python27 to the Path variable
  5. Restart the Command Prompt.

1 Comment

@grtPrgma Manipulating PATH is not root of the problem, there is no problem with starting the Python, the problem is, using pip which is not belonging to activated virtualenv. Manipulating PATH is likely to make additional problems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.