Python apify client not working inside docker container

I have built an app using streamlit that uses the python client to scrap some data. The app works correctly outside of docker, but I need to deply it using a container. When I try to import apify_client inside the container, i get the following error:
>>> import apify_client
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/dist-packages/apify_client/__init__.py", line 3, in <module>
from .client import ApifyClient, ApifyClientAsync
File "/usr/local/lib/python3.8/dist-packages/apify_client/client.py", line 5, in <module>
from ._http_client import _HTTPClient, _HTTPClientAsync
File "/usr/local/lib/python3.8/dist-packages/apify_client/_http_client.py", line 16, in <module>
from ._logging import logger_name
File "/usr/local/lib/python3.8/dist-packages/apify_client/_logging.py", line 21, in <module>
ctx_client_method = ContextVar[Optional[str]]('client_method', default=None)
TypeError: 'NoneType' object is not callable
>>> import apify_client
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/dist-packages/apify_client/__init__.py", line 3, in <module>
from .client import ApifyClient, ApifyClientAsync
File "/usr/local/lib/python3.8/dist-packages/apify_client/client.py", line 5, in <module>
from ._http_client import _HTTPClient, _HTTPClientAsync
File "/usr/local/lib/python3.8/dist-packages/apify_client/_http_client.py", line 16, in <module>
from ._logging import logger_name
File "/usr/local/lib/python3.8/dist-packages/apify_client/_logging.py", line 21, in <module>
ctx_client_method = ContextVar[Optional[str]]('client_method', default=None)
TypeError: 'NoneType' object is not callable
Has anyone experienced something similar_?
2 Replies
deep-jade
deep-jade2y ago
Hi, at the first glance it seems that maybe some dependency is missing or there is some mismatch of versions
rising-crimson
rising-crimson2y ago
@KillerAppl Can you please provide some link to your failed build / scraper's code , so you Python dev can check it?

Did you find this page helpful?