Skip to content

fetch_20newsgroups failed. HTTP Error 500: Internal Server Error #3841

Closed

Description

@starsdeep

When I try to follow the tutorial of the text analysis, I got this error. I have check the Internet, I can download the gzipped data file manually from "http://people.csail.mit.edu/jrennie/20Newsgroups/20news-bydate.tar.gz". But it seems when I run fetch_20newsgroups I always failed at urlopen(URL).

>>> from sklearn.datasets import fetch_20newsgroups
>>> categories = ['alt.atheism', 'soc.religion.christian',
... 'comp.graphics', 'sci.med']
>>> twenty_train = fetch_20newsgroups(subset='train',categories=categories, shuffle=True, random_state=42)
No handlers could be found for logger "sklearn.datasets.twenty_newsgroups"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/sklearn/datasets/twenty_newsgroups.py", line 221, in fetch_20newsgroups
    cache_path=cache_path)
  File "/Library/Python/2.7/site-packages/sklearn/datasets/twenty_newsgroups.py", line 92, in download_20newsgroups
    opener = urlopen(URL)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 410, in open
    response = meth(req, response)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 523, in http_response
    'http', request, response, code, msg, hdrs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 448, in error
    return self._call_chain(*args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 531, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 500: Internal Server Error

Activity

  1. larsmans commented on Nov 17, 2014

    @larsmans
    Member

    Works fine here. Could you try again? Might be a fluke over at MIT.

  2. ogrisel commented on Nov 21, 2014

    @ogrisel
    Member

    It might be worth implementing a retry mechanism in the dataset downloaders. I think nilearn has one.

  3. GaelVaroquaux commented on Nov 21, 2014

    @GaelVaroquaux
    Member

    I think nilearn has one.

    It has a partial download mechanism, with resume. @AlexandreAbraham
    is the one who implemented it. He is back in Paris in 2 weeks.

  4. AlexandreAbraham commented on Nov 21, 2014

    @AlexandreAbraham
    Contributor

    I think that the remark of @ogrisel is general and easy to implement. However, if you are interested in the nilearn dataset downloader, here are the features:

    • retry automatically a second time if a download fail
    • download files by batch, in a sandbox, and clean everything in case of error
    • support resuming of dataset download (useful for big ones)
    • easy to use archive extraction / file renaming / md5 hash checking

    I must say that during my tests, I never encountered the problem evoked here (ie a file downloadable using a browser but not using urlopen).

  5. mjbommar commented on Mar 6, 2015

    @mjbommar
    Contributor

    @ogrisel, @amueller, would it be worth "owning" the storage location for tutorials and test data? I have also noticed some slow downloads that can delay testing.

    I would be happy to donate an S3 bucket to store all requisite data.

  6. amueller commented on Mar 6, 2015

    @amueller
    Member

    Interesting idea. On the one hand, it would be nice to have control, on the other hand it kind of means additional maintenance burden.... I'm a bit torn. Don't you have to pay for S3 per download? I think we skip them in travis, but if the skipping failed, that could give a serious hit ;)

  7. mjbommar commented on Mar 7, 2015

    @mjbommar
    Contributor

    Would be happy to give it a try :) Easy enough to do the math on cost per download once we know how many files there are.

    Got any suggestion on identifying all the external resources?

  8. mjbommar commented on Mar 7, 2015

    @mjbommar
    Contributor

    Seems like there's only ~35MB in ~/scikit_learn_data. If we had 5000 requests/month, it'd still only be ~$10/mo. Happy to handle that.

    I've put them up here for now and made all objects in the bucket public:

    mjbommar@vm1:~/scikit_learn_data$ s3cmd ls --recursive s3://scikit-learn-data/
    2015-03-07 14:07  15668535   s3://scikit-learn-data/20news-bydate.pkz
    2015-03-07 14:07   6501820   s3://scikit-learn-data/20newsgroup_vectorized.pk
    2015-03-07 14:08    496655   s3://scikit-learn-data/cal_housing.pkz
    2015-03-07 14:08   1405393   s3://scikit-learn-data/olivetti.pkz
    2015-03-07 14:08     36388   s3://scikit-learn-data/reuters/README.txt
    2015-03-07 14:08       186   s3://scikit-learn-data/reuters/all-exchanges-strings.lc.txt
    2015-03-07 14:08       316   s3://scikit-learn-data/reuters/all-orgs-strings.lc.txt
    2015-03-07 14:08      2474   s3://scikit-learn-data/reuters/all-people-strings.lc.txt
    2015-03-07 14:08      1721   s3://scikit-learn-data/reuters/all-places-strings.lc.txt
    2015-03-07 14:08      1005   s3://scikit-learn-data/reuters/all-topics-strings.lc.txt
    2015-03-07 14:08     28194   s3://scikit-learn-data/reuters/cat-descriptions_120396.txt
    2015-03-07 14:08    273802   s3://scikit-learn-data/reuters/feldman-cia-worldfactbook-data.txt
    2015-03-07 14:08      1485   s3://scikit-learn-data/reuters/lewis.dtd
    2015-03-07 14:08   1324350   s3://scikit-learn-data/reuters/reut2-000.sgm
    2015-03-07 14:08   1254440   s3://scikit-learn-data/reuters/reut2-001.sgm
    2015-03-07 14:08   1217495   s3://scikit-learn-data/reuters/reut2-002.sgm
    2015-03-07 14:08   1298721   s3://scikit-learn-data/reuters/reut2-003.sgm
    2015-03-07 14:08   1321623   s3://scikit-learn-data/reuters/reut2-004.sgm
    2015-03-07 14:08   1388644   s3://scikit-learn-data/reuters/reut2-005.sgm
    2015-03-07 14:08   1254765   s3://scikit-learn-data/reuters/reut2-006.sgm
    2015-03-07 14:08   1256772   s3://scikit-learn-data/reuters/reut2-007.sgm
    2015-03-07 14:08   1410117   s3://scikit-learn-data/reuters/reut2-008.sgm
    2015-03-07 14:08   1338903   s3://scikit-learn-data/reuters/reut2-009.sgm
    2015-03-07 14:08   1371071   s3://scikit-learn-data/reuters/reut2-010.sgm
    2015-03-07 14:08   1304117   s3://scikit-learn-data/reuters/reut2-011.sgm
    2015-03-07 14:08   1323584   s3://scikit-learn-data/reuters/reut2-012.sgm
    2015-03-07 14:08   1129687   s3://scikit-learn-data/reuters/reut2-013.sgm
    2015-03-07 14:08   1128671   s3://scikit-learn-data/reuters/reut2-014.sgm
    2015-03-07 14:08   1258665   s3://scikit-learn-data/reuters/reut2-015.sgm
    2015-03-07 14:08   1316417   s3://scikit-learn-data/reuters/reut2-016.sgm
    2015-03-07 14:08   1546911   s3://scikit-learn-data/reuters/reut2-017.sgm
    2015-03-07 14:08   1258819   s3://scikit-learn-data/reuters/reut2-018.sgm
    2015-03-07 14:08   1261780   s3://scikit-learn-data/reuters/reut2-019.sgm
    2015-03-07 14:08   1049566   s3://scikit-learn-data/reuters/reut2-020.sgm
    2015-03-07 14:08    621648   s3://scikit-learn-data/reuters/reut2-021.sgm
    2015-03-07 14:08   8150596   s3://scikit-learn-data/reuters/reuters21578.tar.gz
    2015-03-07 14:09   3085736   s3://scikit-learn-data/species_coverage.pkz
    
  9. amueller commented on Mar 9, 2015

    @amueller
    Member

    Can you create a PR that replaces the links in the datasets folder with links to your buckets? I'd be 👍 on that, but it would be a good way to get feedback. It would definitely be faster, but we need to be able to rely on them being their for the next couple of years ;)

  10. amueller commented on Dec 11, 2015

    @amueller
    Member

    @mcculloh you think that is related to the server error? Maybe not going via the redirect would be more stable, so only one server can fail ^^

  11. mjbommar commented on Jan 4, 2016

    @mjbommar
    Contributor

    @amueller, my bucket offer is still on the table. I'd be happy to share creds with you or another maintainer outside of the repo to keep it up-to-date.

  12. amueller commented on Sep 14, 2016

    @amueller
    Member

    we could actually use figshare, I think!

  13. GaelVaroquaux commented on Sep 14, 2016

    @GaelVaroquaux
    Member
  14. modified the milestone: 0.19 on Sep 29, 2016
  15. modified the milestone: 0.19 on Jun 12, 2017
  16. lesteve commented on Sep 25, 2017

    @lesteve
    Member

    Closing we are using figshare now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions