ColCarroll / ridge_map

Ridge plots of ridges
MIT License
520 stars 49 forks source link

HTTP Error 404: Not Found #27

Closed josephasmith97 closed 3 years ago

josephasmith97 commented 4 years ago

Hi there! I am new to Python and Ridgemap! It looks like a great tool which I would really like to start using but unfortunately I can't because I keep getting this error. What is going wrong here and how can I solve this issue? I am running python 3.8 on macOS catalina

Screenshot 2020-10-28 at 21 52 03

dComposer commented 3 years ago

I'm getting the same error. Same python 3.8 and same os! I was using this library without issue about 9 months ago and now the saved code that used to work won't run anymore.

Here's an example:

from ridge_map import RidgeMap RidgeMap().plot_map() Traceback (most recent call last): File "<pyshell#1>", line 1, in RidgeMap().plot_map() File "/Users/dcomposer/Library/Python/3.8/lib/python/site-packages/ridge_map/ridge_map.py", line 77, in init font = FontManager().prop File "/Users/dcomposer/Library/Python/3.8/lib/python/site-packages/ridge_map/ridge_map.py", line 51, in prop temp_file.write(urlopen(self.github_url).read()) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 222, in urlopen return opener.open(url, data, timeout) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 531, in open response = meth(req, response) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 640, in http_response response = self.parent.error( File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 569, in error return self._call_chain(args) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 502, in _call_chain result = func(args) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/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

flxrhn commented 3 years ago

I had the same problem. I worked around it by doing: fm = FontManager(github_url="https://github.com/google/fonts/blob/master/ofl/cinzel/static/Cinzel-Regular.ttf?raw=true") RidgeMap(font=fm.prop).plot_map() Aparently the url changed from 'raw=True' to 'raw=true' in the end.

ColCarroll commented 3 years ago

thanks for the fix! i confirmed it, and will merge it in.

matthewfeickert commented 3 years ago

@ColCarroll Thanks for this project work and for getting these fixes in for urllib. Would you be willing to cut a new release on PyPI that includes these fixes (so v0.0.3 it seems)? It would be great to have them up on there as at the moment one needs to install from GitHub HEAD to get things working:

$ docker run --rm -ti python:3.8 /bin/bash
root@cc26d91cbc70:/# python -m pip install --quiet --upgrade pip setuptools wheel
root@cc26d91cbc70:/# python -m pip install --quiet ridge_map
root@cc26d91cbc70:/# pip list
Package         Version
--------------- ---------
certifi         2020.12.5
chardet         4.0.0
cycler          0.10.0
decorator       4.4.2
idna            2.10
imageio         2.9.0
kiwisolver      1.3.1
matplotlib      3.3.3
networkx        2.5
numpy           1.19.5
Pillow          8.1.0
pip             20.3.3
pyparsing       2.4.7
python-dateutil 2.8.1
PyWavelets      1.1.1
requests        2.25.1
ridge-map       0.0.2
scikit-image    0.18.1
scipy           1.6.0
setuptools      51.1.2
six             1.15.0
SRTM.py         0.3.6
tifffile        2021.1.8
urllib3         1.26.2
wheel           0.36.2
root@cc26d91cbc70:/# printf "from ridge_map import RidgeMap\nsubplot = RidgeMap().plot_map()\nsubplot.figure.savefig('new_hampshire.png')\n" > example.py
root@cc26d91cbc70:/# cat example.py 
from ridge_map import RidgeMap
subplot = RidgeMap().plot_map()
subplot.figure.savefig('new_hampshire.png')
root@cc26d91cbc70:/# python example.py
Creating /root/.cache/srtm
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.8/site-packages/ridge_map/ridge_map.py", line 77, in __init__
    font = FontManager().prop
  File "/usr/local/lib/python3.8/site-packages/ridge_map/ridge_map.py", line 51, in prop
    temp_file.write(urlopen(self.github_url).read())
  File "/usr/local/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.8/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/local/lib/python3.8/urllib/request.py", line 640, in http_response
    response = self.parent.error(
  File "/usr/local/lib/python3.8/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/local/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.8/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
root@cc26d91cbc70:/# python -m pip uninstall -y ridge_map
Found existing installation: ridge-map 0.0.2
Uninstalling ridge-map-0.0.2:
  Successfully uninstalled ridge-map-0.0.2
root@cc26d91cbc70:/# python -m pip install --quiet --upgrade git+git://github.com/colcarroll/ridge_map.git
root@cc26d91cbc70:/# python example.py
4 25934402
4 25934402
4 25934402
4 25934402 
root@cc26d91cbc70:/# file new_hampshire.png 
new_hampshire.png: PNG image data, 2000 x 1456, 8-bit/color RGBA, non-interlaced
ColCarroll commented 3 years ago

Sure! I forgot this was on PyPI -- noticed https://github.com/scikit-hep/mplhep/issues/241, so maybe it won't be necessary, but should be quick to do, just in case!

matthewfeickert commented 3 years ago

Sure! I forgot this was on PyPI

Thanks. It happens! :)

noticed scikit-hep/mplhep#241, so maybe it won't be necessary, but should be quick to do, just in case!

Oh, my request for a new PyPI release was actually just out of my own interest in using ridge-map to make contour art of the river systems my wife does ecological research in. But ridge-map does keep on giving too with the nice FontManager you pointed out to me. :rocket: