Dependencies and changing sdk of a space

Hello all,

I am using googletrans in a space and it needs httpx 0.13.3 but huggingface overwrites the version at the end of the build.

Is there a way to stop this?
If not what happens if you change the sdk of a space? eg. changing to a docker space without making a new one.

Language Learn Idea - a Hugging Face Space by KwabsHug

Container Log
===== Application Startup at 2024-01-02 18:26:05 =====

Traceback (most recent call last):
File “/home/user/app/app.py”, line 1, in
from googletrans import Translator
File “/home/user/.local/lib/python3.10/site-packages/googletrans/init.py”, line 6, in
from googletrans.client import Translator
File “/home/user/.local/lib/python3.10/site-packages/googletrans/client.py”, line 27, in
class Translator:
File “/home/user/.local/lib/python3.10/site-packages/googletrans/client.py”, line 57, in Translator
proxies: typing.Dict[str, httpcore.SyncHTTPTransport] = None,
AttributeError: module ‘httpcore’ has no attribute ‘SyncHTTPTransport’

Build Logs
Attempting uninstall: httpx
Found existing installation: httpx 0.13.3
Uninstalling httpx-0.13.3:
Successfully uninstalled httpx-0.13.3
Attempting uninstall: gradio-client
Found existing installation: gradio_client 0.8.0
Uninstalling gradio_client-0.8.0:
Successfully uninstalled gradio_client-0.8.0
Attempting uninstall: gradio
Found existing installation: gradio 4.12.0
Uninstalling gradio-4.12.0:
Successfully uninstalled gradio-4.12.0
ERROR: pip’s dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
googletrans 3.1.0a0 requires httpx==0.13.3, but you have httpx 0.26.0 which is incompatible.
Successfully installed authlib-1.3.0 cffi-1.16.0 cryptography-41.0.7 gradio-3.47.1 gradio-client-0.6.0 h11-0.14.0 httpcore-1.0.2 httpx-0.26.0 itsdangerous-2.1.2 psutil-5.9.7 pycparser-2.21 spaces-0.19.4

hi @KwabsHug ,
In this case I recommend you using our Docker SDK and use this Gradio Dockerfile as reference

Thanks for the file. I made another space to ensure the docker side is covered.

I still am confused about changing the sdk on an existing space as I would like to keep the git history and url the same.

you can still use the same Space, for a Docker Space you can change the yaml here

set to sdk: docker and of course, push a Dockerfile to the repo

Thank You, very much. Problem solved Completely

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.