-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
switch python command according to os #16
Conversation
I checked it on my ubuntu and windows machines, but needs testing with a variety of setups |
@@ -251,9 +251,13 @@ def pip_install_reqs(self, reqs_to_install): | |||
os.makedirs(self.prefix_path, exist_ok=True) | |||
log(f"Will pip install {reqs_to_install}") | |||
|
|||
# python is normally found at sys.executable, but there is a bug on windows qgis so use 'python' instead | |||
# https://github.com/qgis/QGIS/issues/45646 | |||
python_command = 'python' if os.name == 'nt' else sys.executable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be sure, is this tested?
I guess the python command is on PATH
, so it looks plausible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it on my machine and it worked on Windows. However, it would be good if it could be tested by others as it could depend on how the machine is setup (I have another installation of python on my machine, for example).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could print sys.executable
from within the python subprocess to validate which one is started?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
python_command = 'python' if os.name == 'nt' else sys.executable | |
python_command = "python" if os.name == "nt" else sys.executable |
let's make our linter happy too
Thanks! |
I just tested this on a fresh install of qgis on a fresh windows machine. Whilst this change works, and python is found, pip seems to not be installed by default ! Should I open a new issue for this? |
This is surprising, I've seen many scripts rely on it being installed and I've never seen any reference for how to install this manually. Are you sure it is picking up the python installation that comes with QGIS? |
Actually this was my fault - I used the osgeo4w installer on 'advanced' - when installed using the normal express install pip is included. |
So, let's merge? |
yup :-) |
Another fix for #5