Previously reported issue still happens on v4 of the Ubuntu Standard Dockerfile
Step 49/97 : RUN env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYTHON_37_VERSION; rm -rf /tmp/*
---> Running in c221f8f2e06d
': not a valid identifieron-build/share/python-build/3.7.7: line 3: export: `
BUILD FAILED (Ubuntu 18.04 using python-build 20180424)
Removing intermediate container c221f8f2e06d
---> 9367b9c9d65d
Step 50/97 : RUN pyenv global $PYTHON_37_VERSION
---> Running in 74f20fddeb15
pyenv: version `3.7.7' not installed
The command '/bin/sh -c pyenv global $PYTHON_37_VERSION' returned a non-zero code: 1
The same issue here.
Slightly different logs, but it seems same issue.
Step 46/98 : ENV PYTHON_38_VERSION="3.8.3" PYTHON_37_VERSION="3.7.7"
---> Using cache
---> 547335e18055
Step 47/98 : ENV PYTHON_PIP_VERSION=19.3.1
---> Using cache
---> f7477afa338d
Step 48/98 : COPY tools/runtime_configs/python/$PYTHON_37_VERSION /root/.pyenv/plugins/python-build/share/python-build/$PYTHON_37_VERSION
---> Using cache
---> f00dddf9a31b
Step 49/98 : RUN env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYTHON_37_VERSION; rm -rf /tmp/*
---> Using cache
---> 7cdb96506109
Step 50/98 : RUN pyenv global $PYTHON_37_VERSION
---> Running in e7629ce94953
pyenv: version `3.7.7' not installed
The command '/bin/sh -c pyenv global $PYTHON_37_VERSION' returned a non-zero code: 1
For anyone with the same issue. The problem on my side was that I've cloned the repository on a windows machine and gotten "\r\n" line-endings in the files under /root/.pyenv/plugins/python-build/share/python-build/$PYTHON_37_VERSION.
By manually changing line endings to just "\n" it continued past this issue.
Hi guys.. Do we have some update about this issue?
I'm trying to build a golden image with a mirror parameter due to solving the "rate limit policy" that docker hub decided to put on to free users.
When I build the image, I get pyenv message.
I tried on Linux and macos distros with different tags .. got the same output.
@fabianotessarolo
After cloning down this repo, convert windows newlines to unix newlines on all the script files in the folders runtime_configs/php and runtime_configs/python before building the image. I used the dos2unix utility.
For example:
$ dos2unix tools/runtime_configs/python/3.7.7
This issue is due to git on windows converting unix newlines to windows newlines of unix script files. Either, configure your local git to preserve original line endings on checkout, or download the zip file instead of cloning down the repo.
This issue is due to git on windows converting unix newlines to windows newlines of unix script files. Either, configure your local git to preserve original line endings on checkout, or download the zip file instead of cloning down the repo.
I can confirm this is the issue, and your suggested fixed worked for me. Thanks 馃憤
For me, the issue was completely different:
./buildspec folder in the repo, containing the failing buildspec.python-version file on top-level, setting Python to 3.7.9aws xyz is failing, because on aws/codebuild/standard:4.0, it's installed under 3.7.7.Workaround:
...
commands:
- echo "Setting python to the version that has aws installed"
- echo "3.7.7" > ./.python-version
- echo Logging in to Amazon ECR...
- $(aws ecr get-login --no-include-email --region $AWS_REGION)
...
Workaround: I'm resolving temporarily by changing the Dockerfile
from:
#python
RUN curl https://pyenv.run | bash
to:
#python
RUN curl https://pyenv.run --insecure | bash
Changing git config core.autocrlf and renormalizing repo did the trick:
$ git config --global core.autocrlf true
$ git add --renormalize .
https://github.com/aws/aws-codebuild-docker-images/pull/428 addresses the build failure in Windows. Let us know if the issue persists.
Let us know if this issue still persists. Resolving based on validation on our end.

I have the same problem here.
I tried some alternatives they said in the topic, but it still didn't work. I just can't download by zip due to internal reasons
Most helpful comment
The same issue here.