Httpie: ImportError: cannot import name is_windows

Created on 24 Feb 2015  ·  11Comments  ·  Source: httpie/httpie

httipie (http command) fails to execute with requests 2.5.2 since the latter removed the is_windows from the requests.compat module

Thanks a lot

Carlos

Traceback (most recent call last):
File "/Users/csanchez/Projects/nti.dataserver-buildout/bin/http", line 413, in
import httpie.main
File "/Users/csanchez/Documents/workspace/nti.dataserver-buildout/eggs/httpie-0.9.1-py2.7.egg/httpie/main.py", line 6, in
from .core import main
File "/Users/csanchez/Documents/workspace/nti.dataserver-buildout/eggs/httpie-0.9.1-py2.7.egg/httpie/core.py", line 21, in
from httpie.compat import str, bytes, is_py3
File "/Users/csanchez/Documents/workspace/nti.dataserver-buildout/eggs/httpie-0.9.1-py2.7.egg/httpie/compat.py", line 7, in
from requests.compat import is_windows, bytes, str, is_py3, is_py26
ImportError: cannot import name is_windows

Most helpful comment

@fearphage you could install it via pip for now: $ sudo pip install httpie

All 11 comments

+1

+1

Thanks for the report. I've just released v0.9.2 on PyPi to address this issue. Homebrew (https://github.com/Homebrew/homebrew/pull/37135) and other packages coming soon.

If you find this issue on a google search, try installing httpie with pip instead of yum.
I just got this ImportError: is_windows error on CentOS 7.2 with the EPEL repo.
EPEL7=http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && curl -sSf -o epel.rpm ${EPEL7} && rpm -ivh epel.rpm
Problem was I installed httpie with yum install -y httpie, which installs a very old version.
Fixed with: yum remove -y httpie and yum install -y python-pip && pip install httpie.

For the sake of posterity, the update to EPEL has been pushed to updates-testing, will hopefully land in stable soon. https://bugzilla.redhat.com/show_bug.cgi?id=1247973

@jamshid thanks, pip install helps :)

This is still broken in the Debian/Ubuntu build. I have no target to upgrade to.

➜  documentation git:(master) apt-cache show httpie
Package: httpie
Priority: extra
Section: universe/web
Installed-Size: 222
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Bartosz Fenski <[email protected]>
Architecture: amd64
Version: 0.8.0-1
Depends: python (>= 2.7), python (<< 2.8), python:any (>= 2.7.1-0ubuntu2), python-requests, python-pygments
Filename: pool/universe/h/httpie/httpie_0.8.0-1_amd64.deb
Size: 55500
MD5sum: b63d70a3a3ad9ccdd713306aadd8279c
SHA1: 163be6d2e6db90b7efa907e3fa34796b156d78ab
SHA256: a16bc5a84862ff60408a66f2cd3e2b139c2c79fc00e77e3ba33840389083265b
Description-en: CLI, cURL-like tool for humans
 HTTPie is a CLI HTTP utility that makes CLI interaction with HTTP-based
 services as human-friendly as possible.
 .
 HTTPie does so by providing an http command that allows for issuing
 arbitrary HTTP requests using a simple and natural syntax and
 displaying colorized responses.
Description-md5: a93fec7677de7601feefe5cc8467934c
Homepage: http://httpie.org
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu

@fearphage you could install it via pip for now: $ sudo pip install httpie

I couldn't at the time. pip was broken system-wide.

pip install --upgrade pip
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 521, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2632, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2312, in load
    return self.resolve()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py&
quot;, line 2318, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 74, in <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File "/usr/lib/python2.7/dist-packages/pip/vcs/mercurial.py", line 9, in <module>
    from pip.download import path_to_url
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 25, in <module>
    from requests.compat import IncompleteRead
ImportError: cannot import name IncompleteRead

A version of requests was outdated or something.

Solution: I ended up uninstalling the built-in pip (apt-get remove python-pip) and installed it via another method easy_install --upgrade pip. After that, everything was back to functioning and I reinstalled httpie.

I'm on Ubuntu 15.04 (Vivid) if anyone was wondering.

Glad you've resolved the issue, @fearphage. Hopefully Ubuntu fixes the package soon (a bug report might be in order btw — https://help.ubuntu.com/community/ReportingBugs).

Got this error today, on Ubuntu 14.04.5 LTS, wow

$ http 168.63.129.16
Traceback (most recent call last):
  File "/usr/bin/http", line 9, in <module>
    load_entry_point('httpie==0.8.0', 'console_scripts', 'http')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 351, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2363, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2088, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib/python2.7/dist-packages/httpie/__main__.py", line 6, in <module>
    from .core import main
  File "/usr/lib/python2.7/dist-packages/httpie/core.py", line 21, in <module>
    from .compat import str, is_py3
  File "/usr/lib/python2.7/dist-packages/httpie/compat.py", line 6, in <module>
    from requests.compat import (
ImportError: cannot import name is_windows
Was this page helpful?
0 / 5 - 0 ratings

Related issues

rashthedude picture rashthedude  ·  3Comments

tonsV2 picture tonsV2  ·  4Comments

Abdallah-Obaid picture Abdallah-Obaid  ·  4Comments

Govinda-Fichtner picture Govinda-Fichtner  ·  6Comments

victorhooi picture victorhooi  ·  4Comments