Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'httpcore.backends' #35

Closed
saforem2 opened this issue Jul 5, 2023 · 3 comments · Fixed by #36
Closed

ModuleNotFoundError: No module named 'httpcore.backends' #35

saforem2 opened this issue Jul 5, 2023 · 3 comments · Fixed by #36
Labels
bug Something isn't working

Comments

@saforem2
Copy link
Contributor

saforem2 commented Jul 5, 2023

Describe the bug

Trying to run a different project jpterm and encountered the following traceback:

Traceback (most recent call last):
  File "/Users/samforeman/projects/saforem2/l2hmc-qcd/venvs/py310/bin/jpterm", line 5, in <module>
    from jpterm.cli import main
  File "/Users/samforeman/projects/jpterm/jpterm/cli.py", line 3, in <module>
    from txl.app import disabled
  File "/Users/samforeman/projects/jpterm/txl/txl/app.py", line 6, in <module>
    components = {
  File "/Users/samforeman/projects/jpterm/txl/txl/app.py", line 7, in <dictcomp>
    ep.name: ep.load()
  File "/Users/samforeman/projects/saforem2/l2hmc-qcd/venvs/py310/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2517, in load
    return self.resolve()
  File "/Users/samforeman/projects/saforem2/l2hmc-qcd/venvs/py310/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2523, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/Users/samforeman/projects/saforem2/l2hmc-qcd/venvs/py310/lib/python3.10/site-packages/txl_remote_contents/components.py", line 9, in <module>
    from httpx_ws import aconnect_ws
  File "/Users/samforeman/projects/saforem2/l2hmc-qcd/venvs/py310/lib/python3.10/site-packages/httpx_ws/__init__.py", line 3, in <module>
    from httpx_ws._api import (
  File "/Users/samforeman/projects/saforem2/l2hmc-qcd/venvs/py310/lib/python3.10/site-packages/httpx_ws/_api.py", line 14, in <module>
    from httpcore.backends.base import AsyncNetworkStream, NetworkStream
ModuleNotFoundError: No module named 'httpcore.backends'

I've identified the problem to be coming from this line in your httpx_ws/_api.py:L14 file

from httpcore.backends.base import AsyncNetworkStream, NetworkStream

Replacing

from httpcore.backends.base import AsyncNetworkStream, NetworkStream

with

from httpcore._backends.base import AsyncNetworkStream, NetworkStream

resolved the issue.

To Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

A clear and concise description of what you expected to happen.

Configuration

  • Python version:
  • httpx-ws version:

Additional context

Add any other context about the problem here.

@saforem2 saforem2 added the bug Something isn't working label Jul 5, 2023
@wimglenn
Copy link

wimglenn commented Jul 5, 2023

Since v0.17.3 use

from httpcore import AsyncNetworkStream, NetworkStream

instead of

from httpcore.backends.base import AsyncNetworkStream, NetworkStream

ref: https://github.com/encode/httpcore/blob/master/CHANGELOG.md#0173-5th-july-2023

@saforem2
Copy link
Contributor Author

saforem2 commented Jul 5, 2023

fixed and updated in #36

@frankie567
Copy link
Owner

Thank you @saforem2 for raising this and @wimglenn for pointing out the fix :) That's the risk when we rely on private API 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants