Skip to content

Conversation

@davidsanfal
Copy link
Contributor

@davidsanfal davidsanfal commented Oct 2, 2025

Changelog: Fix: Improved Python virtual environment creation in PipEnv by using the system-installed interpreter or a user-defined one via tools.system.pipenv:python_interpreter.
Docs: conan-io/docs#4291

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

@davidsanfal davidsanfal force-pushed the feature/pyinstaller-venv branch from 237122f to 0501a01 Compare October 3, 2025 10:14
@davidsanfal davidsanfal force-pushed the feature/pyinstaller-venv branch from 0501a01 to 57efa02 Compare October 3, 2025 10:27
@davidsanfal davidsanfal marked this pull request as ready for review October 4, 2025 09:01
@davidsanfal davidsanfal requested review from czoido and jcar87 October 6, 2025 17:19
@davidsanfal davidsanfal added this to the 2.22.0 milestone Oct 22, 2025
def _create_venv(self):
python_interpreter = self._conanfile.conf.get(
"tools.system.pipenv:python_interpreter",
default=shutil.which('python') if platform.system() == "Windows" else shutil.which('python3'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the shutil.which() default to find the current interpreter if we are running in a venv already? Or it finds it directly in the system?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the one inside the virtualenv. But it's a python that's only used during recipe execution. Every time you run it, it's a new environment. In any case, I'm going to add that it gets the real path because in virtualenv python is a symlink.

@davidsanfal davidsanfal force-pushed the feature/pyinstaller-venv branch from 807d1d9 to aa63728 Compare October 29, 2025 08:58
@davidsanfal davidsanfal force-pushed the feature/pyinstaller-venv branch from 3c45c5a to 4a1d10e Compare October 29, 2025 10:49
@czoido czoido merged commit 0fbfdc5 into conan-io:develop2 Oct 29, 2025
16 checks passed
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

Successfully merging this pull request may close these issues.

4 participants