-
Notifications
You must be signed in to change notification settings - Fork 433
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
Specify custom python binary path for "func start" terminal command? #2844
Comments
I tried setting the env variable based on comments in this file ("languageWorkers:python:defaultExecutablePath"):
But the cli did not use the binary I specified in that ENV variable |
@aescolastico, what version of Python are you trying to use? Typically, we encourage users to use a virtual environment. |
I have a rosetta x86_64 emulated install of python3 located in '/usr/local/bin/python3' Im running 3.9 for both. I need to use the emulated version in order to run func tools on my M1 mac. Arm python is not currently supported by this application. When func tools "finds" the python located at '/usr/local/bin/python3' (x86 emulated) it works without issue. But to do this I need to either uninstall the arm python, or remove all references of "python" or "python3" that point to that arm version. How would I use a virtual environment? I use func tools in the terminal and not with vscode if that helps. |
@aescolastico I don't have an M1 Mac yet to test this but give this a try: # create the virtual environment
/usr/local/bin/python3 -m venv .venv
# activate it
source .venv/bin/activate
# this should point to the python binary in your virtual environment
which python
# install dependencies in the virtual env
python -m pip install -r requirements.txt Now when you use M1 support is tracked here #2834 |
So this:
actually still pointed to my opt python "site-packages" directory (likely due to some hardcoded alias' in my bash_profile). I think that's what I was running into when I tried to use venvs the other day. Your use of which gave me that hint. when I manually specified the path to the binary in my venv, it worked.
Thanks for your help @anthonychu For anyone else on M1 hardware. I had to do this in the Rosetta copy of my terminal editor and also had to install an intel emulated version of home-brew to get az func working. |
Currently I have to set an alias for "python" if I want core tools to use a specific version. Is there a parameter I can feed the command or some value in the settings file I can use to achieve this? The reason being that I need to use a different version of python for az func development then I do for every day use. Modifying my alias' is quite inconvenient.
Thanks in advance and apologies if this has been asked before. Ive been searching for hours.
The text was updated successfully, but these errors were encountered: