Mahir Bahçeci
Mahir Bahçeci

Reputation: 41

I cant import Pymongo

I want to try import pymongo via JupyterLab but i have received an error message

and tried uninstall pymongo, httpx, httpcore and again install them but not work.

how can i solve this problem, please help me.

Thank you for interest.

let me show you that message:

import yfinance as yf
from pymongo import MongoClient

---------------------------------------------------------------------------
.......
.....
....

~\anaconda3\lib\site-packages\dns\query.py in <module>
     65     import httpx
     66 
---> 67     _CoreNetworkBackend = httpcore.NetworkBackend
     68     _CoreSyncStream = httpcore._backends.sync.SyncStream
     69 
AttributeError: module 'httpcore' has no attribute 'NetworkBackend'

Upvotes: 3

Views: 1824

Answers (3)

Chris
Chris

Reputation: 11

Try upgrading just httpcore to the 0.15.0 version. This seemed to work for me when I had this issue.

pip install -U httpcore==0.15.0

Upvotes: 1

Sachin K Rao
Sachin K Rao

Reputation: 75

As @Philip Rago mentioned, the error is with the dnspython package.

Try executing the following command-

pip install dnspython==2.3.0

This installs the version of dnspython prior to the latest one that is causing the error.

Upvotes: 5

Philip Rago
Philip Rago

Reputation: 31

I also ran into this problem yesterday with a container that was working prior to 7/26/23. My issue seemed to be stemming from FastAPI at first glance but what I found is it actually came from a dns support package called dnspython.

Seems to me whatever they updated on 7/26/23 is the source of this issue. For me forcing an earlier version of dnspython solved my issue.

Upvotes: 3

Related Questions