James Ives
James Ives

Reputation: 3355

Could not find a version that satisfies the requirement for my own module

I have a Python module which I published to Pip, but I'm having a hard time installing it myself and I'm not really sure why.

Below is the error I'm getting, even though 1.0.3 is indeed published on the registry: https://pypi.org/project/Discord-Webhooks/

Could not find a version that satisfies the requirement Discord-Webhooks==1.0.3 (from -r requirements.txt (line 2)) (from versions: )
No matching distribution found for Discord-Webhooks==1.0.3 (from -r requirements.txt (line 2))

This is what my setup.py file looks like. Running python3 setup.py sdist bdist_wheel produces no errros when building the project.

from setuptools import setup, find_packages

long_description = open('README.md').read()

setup(
  name='Discord Webhooks',
  version='1.0.3',
  py_modules=['discord_webhooks'],
  url='https://github.com/JamesIves/discord-webhooks',
  author='James Ives',
  author_email='[email protected]',
  description='Easy to use package for Python which allows for sending of webhooks to a Discord server.',
  long_description=long_description,
  license='MIT',
  install_requires=[
    'requests==2.21.0'
  ],
  classifiers=[
    'Development Status :: 5 - Production/Stable',
    'Environment :: Other Environment',
    'Intended Audience :: Developers',
    'License :: OSI Approved :: MIT License',
    'Programming Language :: Python :: 3',
    'Programming Language :: Python :: 3.6',
  ],
)

Am I missing something here? How come I can't run pip install Discord-Webhooks without an error? I'm running Python 3.6.0.

Upvotes: 4

Views: 4592

Answers (1)

hoefling
hoefling

Reputation: 66201

You have uploaded a wheel built with Python 2, this is indicated by the python tag py2 in the wheel name: Discord_Webhooks-1.0.3-py2-none-any.whl. You need to upload a wheel built using Python 3:

$ python3 setup.py bdist_wheel

You can also specify the tag explicitly:

$ python3 setup.py bdist_wheel --python-tag=py3

then you can also build the py3 wheel using Python 2 (of course if the setup script doesn't use any incompatible code). Another possibility, if your code runs with both Python 2 and 3, is to build a universal wheel:

$ python3 setup.py bdist_wheel --universal

This will produce a wheel with the python tag py2.py3, which is installable with both Python major versions.

Upvotes: 1

Related Questions