diff --git a/README.rst b/README.rst
index d7d6ae3..e8684f3 100644
--- a/README.rst
+++ b/README.rst
@@ -254,6 +254,10 @@ Version History
 
 next
 
+  * In Python 3, if the package can't be found you get a more explicit exception
+    pointing out which package (URL) that failed.
+    See https://github.com/peterbe/hashin/issues/87
+
   * New flag ``--update-all`` (alias ``-u``) will parse the requirements file,
     ignore the version, and update all packages that have new versions.
     See https://github.com/peterbe/hashin/pull/88
diff --git a/hashin.py b/hashin.py
index cd471c1..98d5c44 100755
--- a/hashin.py
+++ b/hashin.py
@@ -20,6 +20,7 @@ from packaging.version import parse
 
 if sys.version_info >= (3,):
     from urllib.request import urlopen
+    from urllib.error import HTTPError
 else:
     from urllib import urlopen
 
@@ -99,12 +100,23 @@ class NoVersionsError(Exception):
     """When there are no valid versions found."""
 
 
+class PackageNotFoundError(Exception):
+    """When the package can't be found on pypi.org."""
+
+
 def _verbose(*args):
     print("* " + " ".join(args))
 
 
 def _download(url, binary=False):
-    r = urlopen(url)
+    try:
+        r = urlopen(url)
+    except HTTPError as exception:
+        status_code = exception.getcode()
+        if status_code == 404:
+            raise PackageNotFoundError(url)
+        raise PackageError("Download error. {0} on {1}".format(status_code, url))
+
     # Note that urlopen will, by default, follow redirects.
     status_code = r.getcode()
 
@@ -115,8 +127,10 @@ def _download(url, binary=False):
                 "No 'Location' header on {0} ({1})".format(url, status_code)
             )
         return _download(location)
+    elif status_code == 404:
+        raise PackageNotFoundError(url)
     elif status_code != 200:
-        raise PackageError("Package not found. {0} on {1}".format(status_code, url))
+        raise PackageError("Download error. {0} on {1}".format(status_code, url))
     if binary:
         return r.read()
     _, params = cgi.parse_header(r.headers.get("Content-Type", ""))

Rewrap 404 errors from pypi.org
E.g.:

```bash
▶ python hashin.py -r /tmp/r.txt requests djangu
Traceback (most recent call last):
  File "hashin.py", line 544, in <module>
    sys.exit(main())
  File "hashin.py", line 536, in main
    dry_run=args.dry_run,
  File "hashin.py", line 142, in run
    run_single_package(spec, requirements_file, *args, **kwargs)
  File "hashin.py", line 173, in run_single_package
    include_prereleases=include_prereleases,
  File "hashin.py", line 467, in get_package_hashes
    data = get_package_data(package, verbose)
  File "hashin.py", line 400, in get_package_data
    content = json.loads(_download(url))
  File "hashin.py", line 107, in _download
    r = urlopen(url)
  File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 564, in error
    result = self._call_chain(*args)
  File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 756, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 570, in error
    return self._call_chain(*args)
  File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
```

In this case, you don't know which of the packages that failed on you. Was it `requests` or `djangu`?
diff --git a/tests/test_cli.py b/tests/test_cli.py
index cae9004..6cd1d07 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -17,12 +17,15 @@ import hashin
 if sys.version_info >= (3,):
     # As in, Python 3
     from io import StringIO
+    from urllib.error import HTTPError
 
     STR_TYPE = str
 else:  # Python 2
     from StringIO import StringIO
 
     FileNotFoundError = IOError  # ugly but necessary
+    # Python 2 does not have this exception.
+    HTTPError = None
 
 
 @contextmanager
@@ -1282,6 +1285,39 @@ selenium==2.53.1 \
 
         self.assertEqual(result, expected)
 
+    @cleanup_tmpdir("hashin*")
+    @mock.patch("hashin.urlopen")
+    def test_get_package_hashes_package_not_found(self, murlopen):
+        def mocked_get(url, **options):
+            if url == "https://pypi.org/pypi/gobblygook/json":
+                if HTTPError:
+                    raise HTTPError(url, 404, "Page not found", {}, None)
+                else:
+                    return _Response({}, status_code=404)
+
+            if url == "https://pypi.org/pypi/troublemaker/json":
+                if HTTPError:
+                    raise HTTPError(url, 500, "Something went wrong", {}, None)
+                else:
+                    return _Response({}, status_code=500)
+
+            raise NotImplementedError(url)
+
+        murlopen.side_effect = mocked_get
+
+        with self.assertRaises(hashin.PackageNotFoundError) as cm:
+            hashin.get_package_hashes(
+                package="gobblygook", version="0.10", algorithm="sha256"
+            )
+        exception = cm.exception
+        self.assertEqual(str(exception), "https://pypi.org/pypi/gobblygook/json")
+
+        # Errors left as is if not a 404
+        with self.assertRaises(hashin.PackageError):
+            hashin.get_package_hashes(
+                package="troublemaker", version="0.10", algorithm="sha256"
+            )
+
     @cleanup_tmpdir("hashin*")
     @mock.patch("hashin.urlopen")
     def test_get_package_hashes_unknown_algorithm(self, murlopen):

pip install -e .
parse_log_pytest
pytest
pytest mock
3.6
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
-e git+https://github.com/peterbe/hashin.git@8c0de876224632d30415e064c2bee9b3315d4466#egg=hashin
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
mock==5.2.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pip-api==0.0.26
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work

name: hashin
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - attrs=21.4.0=pyhd3eb1b0_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - importlib-metadata=4.8.1=py36h06a4308_0
  - importlib_metadata=4.8.1=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - more-itertools=8.12.0=pyhd3eb1b0_0
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=21.3=pyhd3eb1b0_0
  - pip=21.2.2=py36h06a4308_0
  - pluggy=0.13.1=py36h06a4308_0
  - py=1.11.0=pyhd3eb1b0_0
  - pyparsing=3.0.4=pyhd3eb1b0_0
  - pytest=6.2.4=py36h06a4308_2
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - toml=0.10.2=pyhd3eb1b0_0
  - typing_extensions=4.1.1=pyh06a4308_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.6.0=pyhd3eb1b0_0
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - mock==5.2.0
      - pip-api==0.0.26
prefix: /opt/conda/envs/hashin

tests/test_cli.py::Tests::test_get_package_hashes_package_not_found
tests/test_cli.py::Tests::test_add_extra_extras_syntax_edit tests/test_cli.py::Tests::test_amend_requirements_content_new tests/test_cli.py::Tests::test_amend_requirements_content_new_similar_name tests/test_cli.py::Tests::test_amend_requirements_content_replacement tests/test_cli.py::Tests::test_amend_requirements_content_replacement_2 tests/test_cli.py::Tests::test_amend_requirements_content_replacement_amonst_others tests/test_cli.py::Tests::test_amend_requirements_content_replacement_amonst_others_2 tests/test_cli.py::Tests::test_amend_requirements_content_replacement_single_to_multi tests/test_cli.py::Tests::test_change_extra_extras_syntax_edit tests/test_cli.py::Tests::test_expand_python_version tests/test_cli.py::Tests::test_extras_syntax_edit tests/test_cli.py::Tests::test_filter_releases tests/test_cli.py::Tests::test_get_hashes_error tests/test_cli.py::Tests::test_get_latest_version_non_pre_release tests/test_cli.py::Tests::test_get_latest_version_non_pre_release_leading_zeros tests/test_cli.py::Tests::test_get_latest_version_only_pre_release tests/test_cli.py::Tests::test_get_latest_version_simple tests/test_cli.py::Tests::test_get_package_hashes tests/test_cli.py::Tests::test_get_package_hashes_unknown_algorithm tests/test_cli.py::Tests::test_get_package_hashes_without_version tests/test_cli.py::Tests::test_main_packageerrors_stderr tests/test_cli.py::Tests::test_main_version tests/test_cli.py::Tests::test_no_packages_and_not_update_all tests/test_cli.py::Tests::test_non_200_ok_download tests/test_cli.py::Tests::test_packages_and_update_all tests/test_cli.py::Tests::test_release_url_metadata_python tests/test_cli.py::Tests::test_remove_extra_extras_syntax_edit tests/test_cli.py::Tests::test_run tests/test_cli.py::Tests::test_run_case_insensitive tests/test_cli.py::Tests::test_run_contained_names tests/test_cli.py::Tests::test_run_dry tests/test_cli.py::Tests::test_run_pep_0496 tests/test_cli.py::Tests::test_run_update_all tests/test_cli.py::Tests::test_run_without_specific_version tests/test_cli.py::Tests::test_with_extras_syntax
README.rst hashin.py
README.rst hashin.py