joshua-stone / DerPyBooru

Python bindings for Derpibooru's API
https://derpibooru.org/pages/api
BSD 2-Clause "Simplified" License
36 stars 15 forks source link

pip / pip3 installs an outdated version #14

Open Shikogo opened 7 years ago

Shikogo commented 7 years ago

Hi, maybe this is just me being ignorant about how things work, but no matter what I try, pip always installs version 0.6 for me, which doesn't work anymore with the changes to the API. I've reproduced this on multiple machines running different distros.

Anyone else experiencing this? Somebody know how to fix it?

joshua-stone commented 7 years ago

Thanks for bringing this to my attention. I'm not sure why PyPi is giving you an outdated version, but in the meantime you can install the package through Github directly:

pip install https://github.com/joshua-stone/DerPyBooru/zipball/master

eliskvitka commented 7 years ago

Pip installs outdated version because download_url in setup.py is incorrect.

BytewaveMLP commented 7 years ago

Bump. This is still an issue.

@braunly is correct, setup.py downloads an old version because the version number is hard-coded into download_url and wasn't changed following the update.

rautamiekka commented 7 years ago

Time to do something then ! This is exactly why derpibooru-dl fails.

BytewaveMLP commented 7 years ago

I published my own patched version here which can be used as a substitute if installed as a zipball. I haven't published it to PyPi as I'm not sure of the "legal" implications of such.

The project maintainer @joshua-stone appears to be inactive, so no PyPi update any time soon.

joshua-stone commented 7 years ago

@braunly @rautamiekka @BytewaveMLP I've been trying to fix the issue, but packaging has been difficult. There are multiple instances of version information across different files to keep track of, pip isn't providing meaningful error output, and PyPI doesn't seem to be clear about whether the PKG-INFO file I upload is even doing anything. After using Rust/Cargo, I'm finding that Python's tooling could definitely use an improvement in developer friendliness.

As mentioned before, installing from Github directly seems to at least work while I look into fixing the PyPI package:

pip install https://github.com/joshua-stone/DerPyBooru/zipball/master
BytewaveMLP commented 7 years ago

Oh huh, you're alive? That's good to know, at least.

Hopefully you can get things worked out. Would be nice to be able to use the official PyPi package at some point. ❤️

joshua-stone commented 7 years ago

Yeah I'm alive, although I admittedly haven't been keeping up with development.

I think I've finally fixed the problem. Please check by running this:

pip --no-cache-dir install derpybooru
BytewaveMLP commented 7 years ago
Collecting derpybooru
  Downloading DerPyBooru-0.7.3.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Bytewave\AppData\Local\Temp\pip-build-_toyc8wl\derpybooru\setup.py", line 6, in <module>
        import derpibooru
      File "C:\Users\Bytewave\AppData\Local\Temp\pip-build-_toyc8wl\derpybooru\derpibooru\__init__.py", line 27, in <module>
        from .search import Search
      File "C:\Users\Bytewave\AppData\Local\Temp\pip-build-_toyc8wl\derpybooru\derpibooru\search.py", line 29, in <module>
        from .request import get_images, url
      File "C:\Users\Bytewave\AppData\Local\Temp\pip-build-_toyc8wl\derpybooru\derpibooru\request.py", line 27, in <module>
        from requests import get, codes
    ModuleNotFoundError: No module named 'requests'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Bytewave\AppData\Local\Temp\pip-build-_toyc8wl\derpybooru\

After installing requests manually, however:

Collecting derpybooru
  Downloading DerPyBooru-0.7.3.tar.gz
Requirement already satisfied: requests in c:\python36\lib\site-packages (from derpybooru)
Installing collected packages: derpybooru
  Running setup.py install for derpybooru ... done
Successfully installed derpybooru-0.7.3
BytewaveMLP commented 7 years ago

And just to prove it's the correct version:

>>> import derpibooru
>>> for image in derpibooru.Search():
...     print("#{} - score: {:>3} - {}".format(image.id, image.score, image.tags))
...
#1446857 - score:   2 - ['equestria girls', 'juniper montage', 'light', 'magic', 'mirror magic', 'safe', 'screencap', 'solo', 'spoiler:eqg specials']
#1446855 - score:   7 - ['alicorn', 'apple bloom', 'artist:baron engel', 'cute', 'duo', 'hug', 'monochrome', 'pony', 'princess luna', 'safe', 'simple background', 'sketch', 'smiling', 'traditional art', 'white background']
#1446854 - score:  13 - ['alicorn', 'artist:hikariviny', 'cloud', 'crown', 'female', 'flying', 'full moon', 'jewelry', 'looking back', 'mare', 'moon', 'pony', 'princess luna', 'regalia', 'safe', 'smiling', 'solo', 'stars']
#1446853 - score:  11 - ['aeroshell', 'alternate hairstyle', 'apron', 'artist:kryptchild', 'ask glitter shell', 'canon x oc', 'clothes', 'comic', 'crossdressing', 'cup cake', 'date', 'gay', 'glitter shell', 'headband', 'hoodie', 'male', 'oc', 'oc:aero', 'parent:derpy hooves', 'parent:oc:warden', 'safe', 'scarf', 'shipping', 'skirt', 'snails', 'sugarcube corner', 'tumblr', 'when aero met glitter']
...
dstufft commented 7 years ago

The problem is that we (pip) have to run setup.py to determine what your dependencies are, but because you're importing your module in your setup.py, you're failing to import requests... because we don't know you need that yet when we run your setup.py to determine what your deps are.

Basically, you can't import your module inside your setup.py.

sixeyedfox commented 6 years ago

With the pip install https://github.com/joshua-stone/DerPyBooru/zipball/master I've installed the 0.7.2 version successfully, and then the library manager in PyCharm indicated that there is an update, and successfully updated to 0.7.3. Though it still cannot be installed just by running a pip command, which definitely needs to be fixed.

nullforce commented 5 years ago

Still having this issue, without pre-installing requests manually, so I fixed it in a fork.