Skip to content
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

"make python-env" fails on current Homebrew #7489

Closed
beniwohli opened this issue Jul 3, 2018 · 7 comments
Closed

"make python-env" fails on current Homebrew #7489

beniwohli opened this issue Jul 3, 2018 · 7 comments

Comments

@beniwohli
Copy link
Contributor

Since some time, python defaults to Python 3 when using Homebrew on OSX. Python 3 is also the default on Ubuntu 18.04.

make python-env defaults to use python, and when that points to a Python 3 binary, promptly fails, trying to install functools32:

functools32==3.2.3.post2

Collecting functools32==3.2.3.post2 (from -r ./_beats/libbeat/tests/system/requirements.txt (line 13))
Using cached https://files.pythonhosted.org/packages/c5/60/6ac26ad05857c601308d8fb9e87fa36d0ebf889423f47c3502ef034365db/functools32-3.2.3-2.tar.gz
    Complete output from command python setup.py egg_info:
    This backport is for Python 2.7 only.
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/fd/pwc3ll_s05v3cqbqsnv9r77r0000gn/T/pip-install-ns9id84h/functools32/

Even after fixing that (and enum34), the tests and other Python scripts won't run on Python 3 (see #5950).

As a workaround, one can create the virtualenv manually using Python 2

virtualenv -p python2 build/python-env
@ruflin
Copy link
Member

ruflin commented Jul 3, 2018

@elastic/beats Time to go to python 3?

@kesslerm
Copy link
Contributor

kesslerm commented Aug 2, 2018

As a workaround, one can set VIRTUALENV_PARAMS="-p python2.7" before running make.

VIRTUALENV_PARAMS="-p python2.7" make

@urso
Copy link

urso commented Aug 2, 2018

Maybe we should set VIRTUALENV_PARAMS in the Makefile for the time being. Having to remember to set an env variable or setup a private virtualenv as workaround is not really user-friendly.

@amandahla
Copy link
Contributor

I have set this variable and it works but it shows the warning:
"DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7."

At least, it seems that everything worked as expected for the "make create-metricset".

@amandahla
Copy link
Contributor

amandahla commented Aug 13, 2019

Update: now I had to use "export PYTHON_EXE=/usr/bin/python2" too to avoid:

2019/08/13 10:57:31 Found Elastic Beats dir at /home/METRICBEATS/beats/src/github.com/elastic/beats
Generated fields.yml for metricbeat to /home/METRICBEATS/beats/src/github.com/elastic/beats/metricbeat/build/fields/fields.all.yml
    ERROR: Command errored out with exit status 1:
     command: /home/METRICBEATS/beats/src/github.com/elastic/beats/metricbeat/build/python-env/build/ve/linux/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-g_nfbvj1/functools32/setup.py'"'"'; __file__='"'"'/tmp/pip-install-g_nfbvj1/functools32/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: /tmp/pip-install-g_nfbvj1/functools32/
    Complete output (1 lines):
    This backport is for Python 2.7 only.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Using "VIRTUALENV_PARAMS", the "make python-env" was fine but for "make update" in metricbeat a "...beats/metricbeat/build/python-env/build/ve/" directory was created using python3.

So I check the dev-tools/mage/pytest.go source and then set the PYTHON_EXE variable for him.

@fearful-symmetry
Copy link
Contributor

This should be fixed by #14798

@jsoriano
Copy link
Member

#14798 finished, we are now in the Python 3 age 🙂, what should solve this problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants