Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.