-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Refactor: Update our python scripts to Python 3 #5950
Comments
I want to use python 2.7, not python 3. Here are some details about the problem: 1- I'm using Python 2.7 all the way. which python 2- I've also tried using virtenv before running the command "make setup" but I get the same result. virtualenv -p python2.7 workspace/python2.7 source workspace/python2.7/bin/activate It is still pointing to python 2.7 as shown here: (python2.7) ubuntu@beats: which python The problems occurs during the processing of "make setup" 3- The recipe is this: go get github.com/elastic/beats/metricbeat Now I run make in debug mode to see all details:
Now if we look at the debug log data, I cut a few interesting part:s:
(more...). In the following log section we see references to python3:
The question is: Why is python-env set to python3 as we can see here? ubuntu@beats: ls -l build/python-env/bin/python |
@rvigeant8 Lets the |
I can reproduce the problem on Mac using the following scenario:
So to use python 2.7 I have to pass params to virtualenv using this command:
Its probably better to export the variable |
I tried this:
export VIRTUALENV_PARAMS="-p python2.7"
so looking at the evironment variables I get this:
env | grep VIRT
VIRTUALENV_PARAMS=-p python2.7
Then it looks better but I get a different problem: the path seems somwhat
too long for the pip command.
rm -rf build
make python-env
Running virtualenv with interpreter /usr/bin/python2.7
New python executable in
/home/ubuntu/workspace/SecOpsTools/IBMDataPowerXMLGW/metricbeat/src/github.com/rvigeant8/dpbeat/build/python-env/bin/python2.7
Also creating executable in
/home/ubuntu/workspace/SecOpsTools/IBMDataPowerXMLGW/metricbeat/src/github.com/rvigeant8/dpbeat/build/python-env/bin/python
Installing setuptools, pip, wheel...done.
bash:
/home/ubuntu/workspace/SecOpsTools/IBMDataPowerXMLGW/metricbeat/src/github.com/rvigeant8/dpbeat/build/python-env/bin/pip:
/home/ubuntu/workspace/SecOpsTools/IBMDataPowerXMLGW/metricbeat/src/github.co:
bad interpreter: No such file or directory
bash:
/home/ubuntu/workspace/SecOpsTools/IBMDataPowerXMLGW/metricbeat/src/github.com/rvigeant8/dpbeat/build/python-env/bin/pip:
/home/ubuntu/workspace/SecOpsTools/IBMDataPowerXMLGW/metricbeat/src/github.co:
bad interpreter: No such file or directory
vendor/github.com/elastic/beats/libbeat/scripts/Makefile:222: recipe for
target 'python-env' failed
make: *** [python-env] Error 126
I will shorten the path and check if it completes succesfully
|
Here are the latest development with my problems creating a metricbeat :
I get much further now, however make setup fails with this message:
cp: cannot stat 'module/*/_meta/kibana': No such file or directory
Here I ran make with debug output to get more details:
make -p --debug update
# Copyright (C) 1988-2014 Free Software Foundation, Inc.
# License GPLv3+: GNU GPL version 3 or later <
http://gnu.org/licenses/gpl.html>
# This is free software: you are free to change and redistribute it.
# There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets....
File 'update' does not exist.
File 'python-env' does not exist.
Must remake target 'python-env'.
Successfully remade target file 'python-env'.
File 'collect' does not exist.
File 'fields' does not exist.
Must remake target 'fields'.
Successfully remade target file 'fields'.
File 'collect-docs' does not exist.
Must remake target 'collect-docs'.
Successfully remade target file 'collect-docs'.
File 'configs' does not exist.
Must remake target 'configs'.
Successfully remade target file 'configs'.
File 'kibana' does not exist.
Must remake target 'kibana'.
cp: cannot stat 'module/*/_meta/kibana': No such file or directory
vendor/github.com/elastic/beats/metricbeat/Makefile:23: recipe for target
'kibana' failed
make: [kibana] Error 1 (ignored)
Successfully remade target file 'kibana'.
File 'imports' does not exist.
Must remake target 'imports'.
Traceback (most recent call last):
File "./vendor/github.com/elastic/beats/script/generate_imports.py",
line 7, in <module>
from generate_imports_helper import comment, get_importable_lines
ImportError: No module named generate_imports_helper
vendor/github.com/elastic/beats/metricbeat/Makefile:57: recipe for target
'imports' failed
make: *** [imports] Error 1
|
Our current python scripts and test frameworks work only under Python 2.7; there are a few changes that we need to make to upgrade our scripts to python 3, notably concerning encoding of strings. But toolings exist to helps us update and compatibility layers also exist to ease the transition.
I understand that python 2.7 EOL is in 2020, but we should still work on that.
related to a discuss post: https://discuss.elastic.co/t/step-3-init-and-create-the-metricset-failure/112046/5
The text was updated successfully, but these errors were encountered: