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

ImportError: No module named 'pkg_resources' #508

Closed
cunde opened this issue Aug 19, 2016 · 7 comments
Closed

ImportError: No module named 'pkg_resources' #508

cunde opened this issue Aug 19, 2016 · 7 comments

Comments

@cunde
Copy link

cunde commented Aug 19, 2016

➜ ~ http --help
Traceback (most recent call last):
File "/usr/local/Cellar/httpie/0.9.4/libexec/bin/http", line 5, in
from pkg_resources import load_entry_point
ImportError: No module named 'pkg_resources'

@badjano
Copy link

badjano commented Sep 6, 2016

bump

@jkbrzt
Copy link
Member

jkbrzt commented Sep 6, 2016

@badjano that's an old version. Try:

$ brew update && brew upgrade httpie

@badjano
Copy link

badjano commented Sep 8, 2016

Traceback (most recent call last):
File "/usr/local/Cellar/httpie/0.9.6/libexec/bin/http", line 5, in
from pkg_resources import load_entry_point
ImportError: No module named 'pkg_resources'

@badjano
Copy link

badjano commented Sep 8, 2016

I have a colleague that has the same mac, but it is working on his, I reinstalled python, pip, setuptools, brew upgrade, everything, still can't figure out what is going on

@sheeley
Copy link

sheeley commented Sep 23, 2016

I just ran into this as well. Looking at the install error, I saw this:

==> Installing dependencies for httpie: python3
==> Installing httpie dependency: python3
==> Downloading https://homebrew.bintray.com/bottles/python3-3.5.2_1.el_capitan.bottle.2.tar.gz
######################################################################## 100.0%
==> Pouring python3-3.5.2_1.el_capitan.bottle.2.tar.gz
==> Using the sandbox
==> /usr/local/Cellar/python3/3.5.2_1/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python3/3.5.2_1/bin --install-lib=/usr/local/lib/python3.5/site-pa
Last 15 lines from /Users/jsheeley/Library/Logs/Homebrew/python3/post_install.01.python3:
-s
setup.py
--no-user-cfg
install
--force
--verbose
--install-scripts=/usr/local/Cellar/python3/3.5.2_1/bin
--install-lib=/usr/local/lib/python3.5/site-packages
--single-version-externally-managed
--record=installed.txt

Failed to import the site module
Your PYTHONPATH points to a site-packages dir for Python 2.x but you are running Python 3.x!
     PYTHONPATH is currently: "/Library/Python/2.7/site-packages:/usr/local/lib/python2.7/site-packages:/Users/jsheeley/.venvburrito/lib/python2.7/site-packages"
     You should `unset PYTHONPATH` to fix this.
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall python3`
==> Caveats
Pip, setuptools, and wheel have been installed. To update them
  pip3 install --upgrade pip setuptools wheel
... (etc)

To fix, I ran:

✗ unset PYTHONPATH
✗ brew postinstall python3

Then, try httpie:

✗ http google.com
HTTP/1.1 301 Moved Permanently
Cache-Control: public, max-age=2592000
Content-Length: 219
Content-Type: text/html; charset=UTF-8
Date: Fri, 23 Sep 2016 04:34:37 GMT
Expires: Sun, 23 Oct 2016 04:34:37 GMT
Location: http://www.google.com/
Server: gws
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>

After installing python3 properly, it works (even with PYTHONPATH set to the old value).

I think this is compounded also by brew's recent 1.0.0 release - it seems to have changed a number of python things for me, and I've had to reinstall a number of packages.

@badjano
Copy link

badjano commented Sep 23, 2016

Thanks @sheeley, this worked for me, although my python3 wasn't linked and I decided to force uninstall it and install it again, and now it works!

@windyinsc
Copy link

This happened to me after I upgraded npm from 3.10.10 to 4.0.5... I tried @sheeley solution but it did not work for me. My fix was to brew uninstall httpie then brew install httpie. Now I'm back to normal. FYI.... This was on my MacBook Pro (Early 2011) running macOS 10.9.5

@jkbrzt jkbrzt closed this as completed Sep 5, 2017
@jkbrzt jkbrzt changed the title http error ImportError: No module named 'pkg_resources' Sep 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants