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

Upgrade pip in all Docker images. #746

Merged
merged 2 commits into from
Aug 5, 2020

Conversation

bcipriano
Copy link
Collaborator

Link the Issue(s) this Pull Request is related to.
Fixes #745

Summarize your change.
The base CentOS image uses an old version of pip, which can cause errors when trying to upgrade setuptools. Upgrade pip in all Docker images to fix this.

This exposes an issue with the dual-Python setup we're using. We rely on calling pip directly from the shell, which is not a stable symlink. Upgrading pip from either Python 2 or 3 creates a new symlink and it becomes non-obvious which version you're then operating in. To fix this we switch all images to use python -m pip instead of pip, which always gives us a version-appropriate pip version.

Copy link
Collaborator

@gregdenton gregdenton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@bcipriano bcipriano merged commit e2ea8de into AcademySoftwareFoundation:master Aug 5, 2020
@bcipriano bcipriano deleted the upgrade-pip branch August 5, 2020 15:46
@sravano9
Copy link

After using RUN python -m pip install -U setuptools
still facing same error

Downloading/unpacking setuptools from https://files.pythonhosted.org/packages/7c/1b/9b68465658cda69f33c31c4dbd511ac5648835680ea8de87ce05c81f95bf/setuptools-50.3.0.zip#sha256=39060a59d91cf5cf403fa3bacbb52df4205a8c3585e0b9ba4b30e0e19d4c4b18
Running setup.py (path:/tmp/pip_build_root/setuptools/setup.py) egg_info for package setuptools
Traceback (most recent call last):
File "", line 3, in
File "setuptools/init.py", line 16, in
import setuptools.version
File "setuptools/version.py", line 1, in
import pkg_resources
File "pkg_resources/init.py", line 1365
raise SyntaxError(e) from e
^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

File "", line 3, in

File "setuptools/init.py", line 16, in

import setuptools.version

File "setuptools/version.py", line 1, in

import pkg_resources

File "pkg_resources/init.py", line 1365

raise SyntaxError(e) from e

                        ^

SyntaxError: invalid syntax

@bcipriano
Copy link
Collaborator Author

@sravano9 What platform are you on? Can you share the docker command you're running? These will help me try to reproduce this error.

@sravano9
Copy link

sravano9 commented Sep 30, 2020

@bcipriano I am executing this below command inside docker file
RUN python -m pip install -U setuptools

I am using python version 2.7 and Ubuntu Os

please let me know any changes required

@bcipriano
Copy link
Collaborator Author

Sorry to be clear I mean, can you share the command you're using to actually kick off the docker build. I.e. docker build ....

What version of Ubuntu are you on?

@HuanwenChen312
Copy link

HuanwenChen312 commented Nov 17, 2020

Hi, I'm using Bazel Container Image Rules do build and run a python image, I'm also encountering the same issue, I have tried to upgrade setuptools to lates version, but still getting the same error:

raise SyntaxError(e) from e
                       ^
SyntaxError: invalid syntax

Please feel free to let me know if you need any more information, thanks

@bcipriano
Copy link
Collaborator Author

bcipriano commented Nov 20, 2020

@HuanwenChen312 What's the exact version of Python you're using? I.e. the result if you run python --version within your build environment.

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

Successfully merging this pull request may close these issues.

Docker builds sometimes produce pip errors
4 participants