Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brew installed version doesn't work with plugins #566

Open
rshurts opened this issue Mar 8, 2017 · 7 comments
Labels

Comments

@rshurts
Copy link

@rshurts rshurts commented Mar 8, 2017

Brew is listed as the recommended way of installing httpie on macOS. However, it doesn't work with auth plugins.

For example, if you pip3 install requests-hawk and then run http --help hawk will not show as an auth type. If you pip3 install httpie-oauth it will install httpie via pip as a dependency and overwrite the brew installed link in /usr/local/bin/http and now all the plugins will show because it isn't using the brew installed version.

I suggest changing the documentation to read pip3 install httpie as the recommended method of installing on macOS.

@jakubroztocil

This comment has been minimized.

Copy link
Owner

@jakubroztocil jakubroztocil commented Mar 9, 2017

@rshurts you're right. Plugin installation for Homebrew-based installs doesn't work out of the box.

There are advantages to keeping Homebrew as the recommended method, though. It makes updates easy and the main package can depend on Python 3 (improved SSL support, etc.).

The ideal world solution would be to have all plugins available as Homebrew packages (brew install httpie-oauth) . But that would mean extra work for maintainers so not all plugins would end up in Homebrew.

Using pip to install plugins looks like the easier way to go. To make it work with Hombrew, it would mean instructing pip to use (currently) /usr/local/Cellar/httpie/0.9.8_2/libexec/lib/python3.6/site-packages as the installation directory.

But plugins installed there won't survive HTTPie upgrades.

Perhaps it would be possible to tweak the Homebrew formula to makeallow HTTPie load installed plugins from, for example, the Homebrew Python 3 site-packages (not sure if it's permanent). Or from another location.

…or some sort of custom plugin installer.

@rshurts

This comment has been minimized.

Copy link
Author

@rshurts rshurts commented Mar 16, 2017

In the meantime, maybe a note in the documentation around plugins saying "brew doesn't work with plugins and to pip install httpie for plugin functionality" would save some headaches.

@aheissenberger

This comment has been minimized.

Copy link

@aheissenberger aheissenberger commented Nov 12, 2018

There is also a problem with the read rights when user has no admin rights:

$ http --help
Traceback (most recent call last):
  File "/usr/local/bin/http", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3123, in <module>
    @_call_aside
  File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3107, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3136, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 569, in _build_master
    ws = cls()
  File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 562, in __init__
    self.add_entry(entry)
  File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 618, in add_entry
    for dist in find_distributions(entry, True):
  File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1965, in find_on_path
    for dist in factory(fullpath):
  File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2035, in distributions_from_metadata
    root, entry, metadata, precedence=DEVELOP_DIST,
  File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2492, in from_location
    py_version=py_version, platform=platform, **kw
  File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2867, in _reload_version
    md_version = _version_from_file(self._get_metadata(self.PKG_INFO))
  File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2456, in _version_from_file
    line = next(iter(version_lines), '')
  File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2646, in _get_metadata
    for line in self.get_metadata_lines(name):
  File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1411, in get_metadata_lines
    return yield_lines(self.get_metadata(name))
  File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1407, in get_metadata
    value = self._get(self._fn(self.egg_info, name))
  File "/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1519, in _get
    with open(path, 'rb') as stream:
PermissionError: [Errno 13] Permission denied: '/usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/idna-2.7-py3.7.egg-info/PKG-INFO'

I was able to fix it with

chmod +r /usr/local/Cellar/httpie/1.0.0/libexec/lib/python3.7/site-packages/idna-2.7-py3.7.egg-info/PKG-INFO

but switched to pip3 install httpie because of it made it easier to install plugins.

@sensibleish

This comment has been minimized.

Copy link

@sensibleish sensibleish commented Nov 15, 2018

Since I upgraded to 10.14 Mojave I'm having the permissions error mentioned by @aheissenberger above. I have the same setup where I install homebrew using a local admin account but do normal operation in a standard account. I'm not a Python person and don't understand this discussion of plugins. I do not recall trying to add anything httpie beyond whatever comes as part of the homebrew formula. pip3 list only shows 3 items which presumably were part of the initial Python bundle.

Is this fundamentally a Python3 problem (at least, Python as installed via homebrew)? Should I be reporting it to the maintainers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.