Skip to content
This repository

Install through pip fails under Python 3.3 #1010

Closed
harmesy opened this Issue · 3 comments

3 participants

harmesy Natan L Kenneth Reitz
harmesy

Hey, sorry if I'm going about this in the wrong way, new to this.

I was attempting to install requests to a new virtualenv using python3 and pip. It failed with the following:

Downloading/unpacking git+https://github.com/kennethreitz/requests
  Cloning https://github.com/kennethreitz/requests to /var/folders/wz/jd2dflq52hbd0t48t3th34xw0000gn/T/pip-57zi3u-build
  Running setup.py egg_info for package from git+https://github.com/kennethreitz/requests
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/var/folders/wz/jd2dflq52hbd0t48t3th34xw0000gn/T/pip-57zi3u-build/setup.py", line 6, in <module>
        import requests
      File "./requests/__init__.py", line 54, in <module>
        from .api import request, get, head, post, patch, put, delete, options
      File "./requests/api.py", line 14, in <module>
        from . import sessions
    ImportError: cannot import name sessions
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/var/folders/wz/jd2dflq52hbd0t48t3th34xw0000gn/T/pip-57zi3u-build/setup.py", line 6, in <module>

    import requests

  File "./requests/__init__.py", line 54, in <module>

    from .api import request, get, head, post, patch, put, delete, options

  File "./requests/api.py", line 14, in <module>

    from . import sessions

ImportError: cannot import name sessions

----------------------------------------
Command python setup.py egg_info failed with error code 1 in /var/folders/wz/jd2dflq52hbd0t48t3th34xw0000gn/T/pip-57zi3u-build

When I tried the same with python 2.7.2 it worked fine and installed without any issues.

I modified api.py, line 22 from from adapters import HTTPAdapter to from .adapters import HTTPAdapter and it seemed to fix the problem when installing with python3. I also tried reinstalling into a new virtualenv using python 2.7.2 with the above change and it seemed to work fine.

I'm pretty much brand new to python, so the the above change could have more consequences than I'm aware of, but I just thought I'd let you know.

Thanks.

Natan L

I'm getting the same thing when attempting to install from the repository (this). I've mirrored @harmesy's fix in a pull request.

Natan L

And, @harmesy, you went about this in a completely correct way. :+1:

Kenneth Reitz

Closing since there was a pull request. Thanks again! :cake:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.