From 4b59d0e13fb1f7b529000367a9e12386c8d2608a Mon Sep 17 00:00:00 2001 From: Lucas Cardozo Date: Sat, 18 Mar 2023 21:48:10 +0000 Subject: [PATCH 1/4] fix: same interpreter from venv to get pkg name --- src/pipx/commands/inject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pipx/commands/inject.py b/src/pipx/commands/inject.py index 3da0528bfe..31353967d4 100644 --- a/src/pipx/commands/inject.py +++ b/src/pipx/commands/inject.py @@ -47,7 +47,7 @@ def inject_dep( # zip file, or tar.gz file. if package_name is None: package_name = package_name_from_spec( - package_spec, venv.python, pip_args=pip_args, verbose=verbose + package_spec, venv.python_path, pip_args=pip_args, verbose=verbose ) venv.install_package( From 16192922137c1475da1a22c1fe5b6ab133a2fa73 Mon Sep 17 00:00:00 2001 From: Lucas Cardozo Date: Sat, 18 Mar 2023 22:20:06 +0000 Subject: [PATCH 2/4] chore: add entry to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77b33899a7..b88720a1a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## dev - Fallback to user's log path if the default log path (`$PIPX_HOME/logs`) is not writable to aid with pipx being used for multi-user (e.g. system-wide) installs of applications +- Fix wrong interpreter usage when injecting local pip-installable dependencies into venvs ## 1.2.0 From 8e80bbe8f2632e3268afc6bb49de439456f2dcd7 Mon Sep 17 00:00:00 2001 From: Lucas Cardozo Date: Mon, 20 Mar 2023 10:10:08 +0000 Subject: [PATCH 3/4] fix: cast venv Path to str --- src/pipx/commands/inject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pipx/commands/inject.py b/src/pipx/commands/inject.py index 31353967d4..cc9da331e2 100644 --- a/src/pipx/commands/inject.py +++ b/src/pipx/commands/inject.py @@ -47,7 +47,7 @@ def inject_dep( # zip file, or tar.gz file. if package_name is None: package_name = package_name_from_spec( - package_spec, venv.python_path, pip_args=pip_args, verbose=verbose + package_spec, str(venv.python_path), pip_args=pip_args, verbose=verbose ) venv.install_package( From de75215141ab186d8c77c3a02a5a634f90906e3b Mon Sep 17 00:00:00 2001 From: Lucas Cardozo Date: Tue, 21 Mar 2023 15:29:55 +0000 Subject: [PATCH 4/4] fix: use os.fspath instead of str --- src/pipx/commands/inject.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pipx/commands/inject.py b/src/pipx/commands/inject.py index cc9da331e2..68a2243410 100644 --- a/src/pipx/commands/inject.py +++ b/src/pipx/commands/inject.py @@ -1,3 +1,4 @@ +import os import sys from pathlib import Path from typing import List, Optional @@ -47,7 +48,10 @@ def inject_dep( # zip file, or tar.gz file. if package_name is None: package_name = package_name_from_spec( - package_spec, str(venv.python_path), pip_args=pip_args, verbose=verbose + package_spec, + os.fspath(venv.python_path), + pip_args=pip_args, + verbose=verbose, ) venv.install_package(