Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

Chen Wang
Chen Wang
7,371 Points

Why can't I install wsgiref in python virtual environment?

Actually I don't know what it does and I just saw a project which requires it.

When I try to install it by

pip install wsgiref

I saw the following:

Collecting wsgiref
  Using cached wsgiref-0.1.2.zip
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/private/var/folders/4f/n582rdzj62d3t43440bd5_5c0000gn/T/pip-build-uf5ja573/wsgiref/setup.py", line 5, in <module>
        import ez_setup
      File "/private/var/folders/4f/n582rdzj62d3t43440bd5_5c0000gn/T/pip-build-uf5ja573/wsgiref/ez_setup/__init__.py", line 170
        print "Setuptools version",version,"or greater has been installed."
                                 ^
    SyntaxError: Missing parentheses in call to 'print'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/4f/n582rdzj62d3t43440bd5_5c0000gn/T/pip-build-uf5ja573/wsgiref

However, I can't even find this directory "private/var/folders/4f/n582rdzj62d3t43440bd5_5c0000gn/T/pip-build-uf5ja573/wsgiref".

I have googled everything related this but I can't find a solution.

1 Answer

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

Looks like it's installing a Python 2 version of wsgiref with Python 3's pip.

What do you get when you run pip --version?

Chen Wang
Chen Wang
7,371 Points

It's a so small problem and I spent several hours to figure this out... It seems that the wsgiref has already been included as a standard library in Python 3...

The tutorial I saw in the internet is done by python 2, which requires a extra wsgiref installation. In python 2 this print syntax, which is lack of parentheses, so it works well. However, python 3 doesn't support this syntax. They didn't fix this installation problem, because we can just directly import the wsgiref in python 3 without installing anything.

These version issues is really confusing. Thanks for your help, Kenneth!

I love your instruction videos, btw.

Looking forward to your Django one.