Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Python template uses system Python to create the virtual environment #351

Open
honzajavorek opened this issue Mar 11, 2025 · 0 comments

Comments

@honzajavorek
Copy link

Running the following

apify create xyz --template=python-crawlee-beautifulsoup

results in the following output:

Info: Python version 3.13.2 detected.
Info: Creating a virtual environment in "/Users/honza/Projects/xyz/.venv" and installing dependencies from "requirements.txt"...
Run: python3 -m venv --prompt . .venv
Run: /Users/honza/Projects/xyz/.venv/bin/python3 -m pip install --no-cache-dir --no-warn-script-location --upgrade pip setuptools wheel

The line python3 -m venv --prompt . .venv indicates that the template uses system Python:

$ which python3
/opt/homebrew/bin/python3

That's not best practice. System Python (here installed by Homebrew) is supposed to be used exclusively as a dependency for other programs (other Homebrew packages). Starting virtual environments linked to this Python installation makes them fragile, because whenever the system Python updates (e.g. just a security patch version), path to the Python binary changes. All virtual environments break and need to be re-created.

In the past, a solution to this would be to use a separate way to manage Python installations, such as pyenv. In 2025, this is best solved by using uv.

(That makes #350 slightly related to this issue.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant