Antoine Ratieuville
Antoine Ratieuville

Reputation: 47

error with urllib on heroku

I import urllib in my script with : import urllib2 as urllib

but when i push my app to heroku, I have this error :

   remote: -----> Installing requirements with pip
    remote:        Collecting urllib (from -r /tmp/build_1d35698f2d5b9e170c92042828569c91/requirements.txt (line 3))
    remote:          Could not find a version that satisfies the requirement urllib (from -r /tmp/build_1d35698f2d5b9e170c92042828569c91/requirements.txt (line 3)) (from versions: )
    remote:        No matching distribution found for urllib (from -r /tmp/build_1d35698f2d5b9e170c92042828569c91/requirements.txt (line 3))
    remote:  !     Push rejected, failed to compile Python app.
    remote:
    remote:  !     Push failed

what can I do ? Thanks by advance !

Upvotes: 0

Views: 775

Answers (1)

Taku
Taku

Reputation: 33744

urllib2 is a built-in package in Python 2 (renamed to urllib.request and urllib.error in Python 3). Therefore it doesn't need to be installed and it should not be in your requirements.txt.

Remove urllib or urllib2 from the requirements.txt file (hint: given from your error, remove urllib from the third line of requirements.txt) then your error should be gone.

Upvotes: 2

Related Questions