0

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'

2 Answers2

2

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.

1

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.

  • I installed dnspython version 2.3.0 but I'm getting another error : "AttributeError: module 'httpcore' has no attribute 'CloseError'" Do you have an idea on how to solve the issue ? – hotips Aug 20 '23 at 07:17
  • No idea, but it's definitely got to do with version compatibility. Maybe you can experiment with the older versions of dnspython or httpcore. – Sachin K Rao Aug 22 '23 at 04:25
  • I tried but I still get errors. I will retry once again with a new conda environment – hotips Aug 24 '23 at 14:36