tdsmith / homebrew-pypi-poet

Generates Homebrew resource stanzas for Python packages.
MIT License
140 stars 30 forks source link

Poet fails with HTTP Error 404 #67

Open slokhorst opened 5 years ago

slokhorst commented 5 years ago

I'm trying to create a Brew formula for Gajim. I have grabbed the gajim source and am trying to run poet, but it fails:

# setup venv
python3 -m venv venv
source venv/bin/activate
# install dependencies
pip install keyring nbxmpp pyOpenSSL pyasn1 pyobjc pillow idna precis-i18n certifi cssutils
# download and install gajim
curl -O https://gajim.org/downloads/1.1/gajim-1.1.1.tar.bz2
tar xf gajim-1.1.1.tar.bz2
cd gajim-1.1.1
python setup.py install
# install and run poet
pip install homebrew-pypi-poet
poet -f gajim

Now poet fails with the following output:

Traceback (most recent call last):
  File "/Users/sebas/venv/bin/poet", line 11, in <module>
    sys.exit(main())
  File "/Users/sebas/venv/lib/python3.7/site-packages/poet/poet.py", line 243, in main
    print(formula_for(args.formula, args.also))
  File "/Users/sebas/venv/lib/python3.7/site-packages/poet/poet.py", line 161, in formula_for
    nodes = merge_graphs(make_graph(p) for p in [package] + also)
  File "/Users/sebas/venv/lib/python3.7/site-packages/poet/poet.py", line 187, in merge_graphs
    for g in graphs:
  File "/Users/sebas/venv/lib/python3.7/site-packages/poet/poet.py", line 161, in <genexpr>
    nodes = merge_graphs(make_graph(p) for p in [package] + also)
  File "/Users/sebas/venv/lib/python3.7/site-packages/poet/poet.py", line 147, in make_graph
    package_data = research_package(package, dependencies[package]['version'])
  File "/Users/sebas/venv/lib/python3.7/site-packages/poet/poet.py", line 80, in research_package
    with closing(urlopen("https://pypi.io/pypi/{}/json".format(name))) as f:
  File "/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 563, in error
    result = self._call_chain(*args)
  File "/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 755, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 563, in error
    result = self._call_chain(*args)
  File "/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 755, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

Am I using poet right? Any idea what's going wrong?

tobywf commented 5 years ago

I also got this. Due to how make_graph currently works, the package is being included in the dependencies, and therefore has to be on PyPI. This is somewhat incorrect, since the local package might have different deps, but also means it doesn't work with unreleased packages, making testing hard.

A quick fix is to change line 131 in poet.py:

- ignore = ['argparse', 'pip', 'setuptools', 'wsgiref']
+ ignore = ['argparse', 'pip', 'setuptools', 'wsgiref', pkg]

Edit: That change above might unblock you, but can break other scenarios. Sounds like this is a known problem, and #28 would solve this issue.

jasonkarns commented 1 year ago

I'm getting the same error. I'm not a python developer, but I'm familiar with homebrew. I'm attempting to create a tap+formula for a python utility written at my current client. The utility is not published anywhere. (It is installed via: pip install git+ssh://git@github.com/client/tool.git)

Knowing next to nothing about python, pip or how it handles dependencies (other than that it's seemingly perpetually painful?), what would be recommended next steps?