question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Attempting to contribute -- "dj-stripe distribution not found?"

See original GitHub issue

Hey there! Thanks for this library.

We’re trying to get support for source.transaction.created webhook events to work, but trying to get dj-stripe tests running locally produces this error:

Traceback (most recent call last):
  File "/Users/eric/.virtualenvs/djstripe/bin/pytest", line 8, in <module>
    sys.exit(console_main())
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/_pytest/config/__init__.py", line 185, in console_main
    code = main()
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/_pytest/config/__init__.py", line 143, in main
    config = _prepareconfig(args, plugins)
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/_pytest/config/__init__.py", line 318, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/pluggy/_callers.py", line 55, in _multicall
    gen.send(outcome)
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/_pytest/helpconfig.py", line 100, in pytest_cmdline_parse
    config: Config = outcome.get_result()
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/_pytest/config/__init__.py", line 1003, in pytest_cmdline_parse
    self.parse(args)
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/_pytest/config/__init__.py", line 1283, in parse
    self._preparse(args, addopts=addopts)
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/_pytest/config/__init__.py", line 1191, in _preparse
    self.hook.pytest_load_initial_conftests(
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
    return outcome.get_result()
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/pytest_django/plugin.py", line 353, in pytest_load_initial_conftests
    _setup_django()
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/pytest_django/plugin.py", line 236, in _setup_django
    django.setup()
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/django/apps/config.py", line 124, in create
    mod = import_module(mod_path)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/eric/src/dj-stripe/djstripe/apps.py", line 7, in <module>
    __version__ = pkg_resources.get_distribution("dj-stripe").version
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/pkg_resources/__init__.py", line 478, in get_distribution
    dist = get_provider(dist)
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/pkg_resources/__init__.py", line 354, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/pkg_resources/__init__.py", line 909, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/Users/eric/.virtualenvs/djstripe/lib/python3.10/site-packages/pkg_resources/__init__.py", line 795, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'dj-stripe' distribution was not found and is required by the application

This error appeared on 2 machines and on master and stable/2.6 branches. Probably missing something small and silly, thank you!

PS: should there already be webhook support for source.transaction.created?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ckcollabcommented, Jul 29, 2022

OK, finally figured it out. Poetry wasn’t building the final distribution because mysqlclient was failing to install. I removed mysqlclient from pyproject.toml and she’s running fine now!

For anyone experiencing this in the future, make sure poetry finishes with no errors … it might look like it succeeded “well enough,” but for the distribution to be made every package must be installed successfully.

1reaction
arnav13081994commented, Jul 28, 2022

@ckcollab You’re right about that. I’m not sure what’s wrong here.

Can you try to install the master branch using pip by adding this to the requirements file replacing the reference to the dj-stripe package

https://github.com/dj-stripe/dj-stripe/archive/master.zip

@hhartwell I’m glad you find dj-stripe to be useful. We will continue to add super useful features! Definitely open a feature request if you think of a useful addition to this library.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Duplicate requests dependency (causes issues on Python 2)
After the stripe-python 2.0 upgrade, dj-stripe's tests on Python 2.7 started failing and I've been trying to investigate why.
Read more >
Setting up dj-stripe (initial migrations) ProgrammingError
(I'm assuming I've created the gotcha due to dirty uninstall of initial attempt?) In case relevant: My auth system is django-allauth.
Read more >
dj-stripe - PyPI
dj-stripe implements all of the Stripe models, for Django. Set up your webhook endpoint and start receiving model updates. You will then have...
Read more >
djstripe.models — dj-stripe 1.2.4 documentation
Let's not make dj-stripe entirely unusable if that happens. logger.warning("Could not ... or until all " "webhook delivery attempts have been exhausted.
Read more >
dj-stripe Documentation - Read the Docs
This is done because dj-stripe is not an authentication system, so it ... are delivered, or until all webhook delivery attempts have been ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found