tasdikrahman / xkcd-dl

:arrow_double_down: Download ALL xkcd's which have been uploaded till date. Ever!

Home Page:http://tasdikrahman.me/xkcd_dl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not work out of the box, if at all

bradenbest opened this issue · comments

$ python setup.py build
$ sudo python setup.py install
$ xkcd-dl
Traceback (most recent call last):
  File "/usr/local/bin/xkcd-dl", line 9, in <module>
    load_entry_point('xkcd-dl==0.0.5', 'console_scripts', 'xkcd-dl')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 351, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2363, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2088, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/local/lib/python2.7/dist-packages/xkcd_dl-0.0.5-py2.7.egg/bin/main.py", line 21, in <module>
    import urllib.request
ImportError: No module named request
$ sudo apt-get install python-urllib3 python-requests
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-requests is already the newest version.
python-urllib3 is already the newest version.

I don't believe this is how python is meant to function. When did something that was supposed to be simple and easy for rapid prototyping turn into this over-complicated setup.py egg nonsense, where even if you have a dependency properly installed, it still breaks because there's apparently no python equivalent to -I/path/to/h/file -L/path/to/library-binary? Couple this with the fact that there are both python 2 and 3 in active development with divided, separate communities, and you get a bunch of crap. This is why I stopped using Python. Sure, it's easy to program in, but it fails epically in the portability department. I have never had this much trouble with C.

Rant aside, this repo seems to be broken for the above reasons. Not to mention, upon inspecting urllib itself, there doesn't even seem to be a "request" object/module inside urllib, nor does there appear to be a urllib.request module of any fashion other than /usr/lib/python2.7/dist-packages/urllib3/request.py. Is that the package? Shouldn't the import line thus be "import urllib3.request"? What's going on here? How did you even manage to get this to function on your system? Cause I can't. The only way I can import urllib.request of any fashion is to go directly into urllib3's directory and type "import urllib3.request". That won't work anywhere else, and regular urllib doesn't have a request submodule, according to python. And symlinking the directory doesn't work, either.

This is so broken.

I am sorry that you had trouble installing my package. There had been some issues when installing from source as mentioned in #3 .

Did you try installing through pip @bradenbest ? That works for others so far who are using python 2.*

As for the import issue. The urllib2 module has been divided across several modules in python3.* named as urllib.request and urllib.error. So I suggest using python3.* for that.

Let me know if you have any issues then.

Python3? So what would the command be, sudo pip3 install urllib2?

One thing that drives me nuts with pip is that it always says "Downloading/unpacking", when it's actually searching to see if the package exists. It also doesn't give any feedback on what it's doing, so you get to see an inaccurate log message that tells you absolutely nothing while it hangs for thirty-five (35) seconds, and 99% of the time, it returns with an error message that it couldn't find the package. easyinstall isn't much better, either. I typically end up installing via my native package manager ala sudo apt-get install python-<package>

Anyways, I went with that, and this was the result:

$ sudo pip3 install urllib2
[sudo] password for braden: 
Downloading/unpacking urllib2
  Real name of requirement urllib2 is urllib3
  Could not find any downloads that satisfy the requirement urllib2
Cleaning up...
No distributions at all found for urllib2
Storing debug log for failure in /home/braden/.pip/pip.log
$ sudo pip3 install urllib3
Requirement already satisfied (use --upgrade to upgrade): urllib3 in /usr/lib/python3/dist-packages
Cleaning up...

So, no dice.

I noticed this:

Requirement already satisfied (use --upgrade to upgrade)

$ sudo pip3 install urllib3 --upgrade
Downloading/unpacking urllib3 from https://pypi.python.org/packages/py2.py3/u/urllib3/urllib3-1.12-py2.py3-none-any.whl#md5=f2d5530128e8935d22da26d9fc4e2b8c
  Downloading urllib3-1.12-py2.py3-none-any.whl (85kB): 85kB downloaded
Installing collected packages: urllib3
  Found existing installation: urllib3 1.7.1
    Not uninstalling urllib3 at /usr/lib/python3/dist-packages, owned by OS
Successfully installed urllib3
Cleaning up...
$ xkcd-dl 
Traceback (most recent call last):
[...]
ImportError: No module named request

Dang...

Hey @bradenbest .

You don't need to manually install the requirements for the package xkcd-dl! pip will take care of that for you.

Do you have python3 in your path? To check that, do a

$ python3 --version
Python 3.4.2

If you are getting something like the above, you just have to do a $ sudo pip3 install xkcd-dl.

Is the above working for you?

That worked. Thanks a lot!

I'll leave the decision of whether to close this to you, but before you close it, consider this: the issue may be able to be gotten around with pip, but it still exists when trying to build from source. I'm a man who enjoys bleeding edge software, so it's a bummer when I can't get something to work directly from source.

The fix could be as simple as updating the readme with a solid section about troubleshooting broken dependencies.

Glad I could be of some help!

Thanks a lot for your input. I appreciate it!

I updated the README section. Do check it out. I will be closing this issue then?

@bradenbest does the updated README cover everything it needs to?

@Kickball @prodicus
The updated section (I assume you're referring to this commit) does indeed clear things up with python/python3.

But this issue is called "Does not work out-of-the-box", so I tested it by cloning the latest version of this repo, and attempting to run bin/main.py directly (./main.py), and got the same ImportError exception. Running it with python3 main.py worked and gave me usage info. Upon investigating the file, I noticed that it's using python2.

#!/usr/bin/env python

Changing python to python3 should solve this issue.