Reputation: 207
While importing googletrans I am getting this error:
AttributeError: module 'httpcore' has no attribute 'SyncHTTPTransport
Upvotes: 5
Views: 24441
Reputation: 462
All of the sudden I faced this issue. I was using version 4.0.0rc1 for googletrans. It seems googletrans has three dependencies: h11, httpcore, and httpx.
I tried to upgrade googletrans using pip
$ pip install googletrans --upgrade
It did not upgrade googletrans but downgrade its dependencies.
Now I run the app without any issues. I'm not sure why pip's dependency resolver downgrade the packages, since initially the app was running well with the current versions.
Upvotes: 1
Reputation: 21
Consider the extra packages and version
pip install httpcore==0.15.0 httpx pymongo googletrans
Upvotes: 2
Reputation: 41
This is a easy way by patch:
import httpcore
setattr(httpcore, 'SyncHTTPTransport', Any)
Upvotes: 4
Reputation: 366
googletrans==3.0.0 use very old httpx (0.13.3) and httpcore version. You just need to update httpx and httpcore to latest version and go to googletrans source directory in Python310/Lib/site-packages. In the file client.py, fix 'httpcore.SyncHTTPTransport
' to 'httpcore.AsyncHTTPProxy
'. And done, perfect. Even, Async, a concurrency model that is far more efficient than multi-threading, and can provide significant performance benefits and enable the use of long-lived network connections such as WebSockets.
if you got error 'Nonetype'...group. Try: pip install googletrans==4.0.0-rc1
Upvotes: 20