Development & Debugging

Can I use Apify with Python?

Yes, Apify has a full Python SDK available on PyPI (package name: apify) that supports complete actor development, API access, dataset management, and all the same capabilities as the JavaScript SDK. Python is a first-class citizen on the Apify platform. Here is how Python development on Apify works. Install the SDK with pip install apify. Create a new actor project using the Apify CLI with apify create my-actor --template python, which generates a project scaffold with the correct Dockerfile, requirements.txt, and main.py structure. Your actor code uses the same Actor.main() async pattern as the JavaScript SDK — you define an async main function that receives the actor context, reads input, does its work, and pushes results to the dataset. Python actors run inside Docker containers on Apify's infrastructure, using official Apify Python base images that come pre-configured with the SDK and common dependencies. Your Dockerfile extends the base image and installs your additional requirements. The build process handles pip dependency resolution, so you just list your packages in requirements.txt and they are available at runtime. Python is particularly popular for several categories of actors. Data science and analytics actors that use pandas, numpy, scipy, or scikit-learn for processing scraped data. Machine learning actors that run inference using TensorFlow, PyTorch, or Hugging Face transformers. Natural language processing actors that use spaCy, NLTK, or custom NLP pipelines. API integration actors where Python's requests library and rich ecosystem of API client libraries make integration straightforward. Data transformation actors that leverage Python's excellent CSV, JSON, and database libraries. For web scraping specifically, Python actors can use BeautifulSoup, Scrapy, or the Apify Python SDK's built-in HTTP client. Browser automation is available through Playwright for Python. While the Crawlee framework (Apify's recommended scraping library) is currently more mature in its JavaScript version, the Python ecosystem provides equivalent capabilities through other libraries. All ApifyForge tools work seamlessly with Python actors because they interact through the Apify API, which is language-agnostic. The Schema Validator, Test Runner, Cloud Staging, and fleet analytics do not care whether your actor is written in Python, JavaScript, TypeScript, or any other language. For more on building actors, visit apifyforge.com/glossary/actors. For related topics, see the questions about what happens when an actor fails and how to debug failed runs.

Related questions