-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
python functions cannot find python3 interpreter #5518
Comments
Hmm, I found docker/pulsar/scripts/set_python_version.sh which suggests that people are making python a symlink to python3
As I say, this is generally frowned upon. I found there is pythonInstanceLocation in WorkerConfig.java. The documentation says "change the python instance location only when you put the python instance jar in a different location" - but I'm looking for the python interpreter, not a jar file. (I don't think it's using anything I haven't yet found the point where pulsar execs the python interpreter. |
Part of the answer comes from pulsar's debug output: it is running
So a configuration option to change "python" to "python3" here would be great, and solve the problem. |
the question would be what is the default option if any. |
I would be fine with the default remaining at "python" for backwards-compatibility reasons, as long as there's a way to override it. |
@wolfstudy could you please help look into the issue? Thank you. |
How about adding a setting to broker.conf / standalone.conf? e.g.
However I notice at least one place where searching in
So I suggest:
If you don't want a conf setting, then an environment variable would work for me too ( |
conf file is a better option, makes it more explicit. |
Please can this be re-opened? That might have been my mistake, but #5536 doesn't fix this issue, it only documents the (bad) workaround. IMO Pulsar still needs a conf option to set the python interpreter path. |
You can reopen it manually. |
When you add the conf info in a PR, you can relate the PR to this issue as well. |
I have a potential fix for this. I mentioned it over on https://github.com/streamnative/pulsar/issues/85 but I just noticed now that that's a fork. So here's the info:
|
@sijie I've been talking with @sbourkeostk about the change. Thoughts? |
@merlimat @jerrypeng @srkukarni Please add your comments. I am don't think this a clean way to add support for switching python interpretes. |
I'm open to better ideas about how to switch Python interpreters. |
We already have the runtimeflags that was used to pass any runtime specific flags. We could use the same approach in creating a new flag(say runtimebinary or something like that) that would just take in a string and use that as exec point. |
@srkukarni, you got me thinking. How about reusing By the way, the protobuf python definitions also need to be recompiled for this to work. Probably should be done in any case. The one in master seems to be old and doesn't include |
#15376 (PIP-155) should drop support for Python 2 now. Please open a new issue with repro if it's still relevant. |
Describe the bug
python functions do not start if the system has "python3" but not "python" (which is the case for modern Ubuntu systems - "python" is python2 and is not installed by default)
To Reproduce
Write a simple function
func1.py
Deploy it:
(side note: have to give absolute path to function, pulsar-admin changes the working directory)
Check its status:
Note error: Cannot run program "python": error=2, No such file or directory
Expected behavior
I would expect the function to deploy.
Screenshots
N/A
Desktop (please complete the following information):
N/A
Additional context
This may be the same problem as #5369 - however in that case, it's the shebang line in pulsar's own python code, whereas this one is my own function which is not starting.
I cannot find it stated in Pulsar documentation whether Pulsar supports python2, python3 or both. However python2 is very shortly going to be end-of-life.
Workarounds
Install python2 and write my code in python2. I really don't want to do that, with python2 being end-of-life in 2 months' time.
Symlink python to python3. However in Ubuntu systems, symlinking python to python3 has the potential to cause all sorts of problems. Many applications and scripts depend on
python
meaningpython2
(in which case they will depend on thepython-XXX
packages rather thanpython3-XXX
). More content here.Ideally pulsar would try python3 and fallback to python. If pulsar were to be hard-coded to run "python3" instead of "python" that would also be fine IMO, given the impending EOL of python2.
The text was updated successfully, but these errors were encountered: