aws-codebuild-docker-images icon indicating copy to clipboard operation
aws-codebuild-docker-images copied to clipboard

pyenv: version `3.7.7' not installed

Open ghost opened this issue 6 years ago • 13 comments

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

ghost avatar Sep 15 '20 06:09 ghost

The same issue here.

smoockpp avatar Sep 18 '20 13:09 smoockpp

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                                                    

sleepy-mouse avatar Sep 20 '20 02:09 sleepy-mouse

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.

npetter avatar Sep 24 '20 09:09 npetter

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

apmartins85 avatar Nov 17 '20 11:11 apmartins85

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

rsumibcay-rdi avatar Nov 17 '20 15:11 rsumibcay-rdi

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.

rsumibcay-rdi avatar Nov 17 '20 16:11 rsumibcay-rdi

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 👍

tomwaldnz avatar Dec 07 '20 20:12 tomwaldnz

For me, the issue was completely different:

  • I have a ./buildspec folder in the repo, containing the failing buildspec
  • The project has a .python-version file on top-level, setting Python to 3.7.9
  • Buildspec would use this file to set its python version 3.7.9
  • aws xyz is failing, because on aws/codebuild/standard:4.0, it's installed under 3.7.7.

Workaround:

  • Manually overwrite python version in buildspec
...
    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)
...

jangroth avatar Dec 08 '20 04:12 jangroth

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

rafaelmartinsdacosta avatar Dec 16 '20 03:12 rafaelmartinsdacosta

Changing git config core.autocrlf and renormalizing repo did the trick:

$ git config --global core.autocrlf true
$ git add --renormalize .

kazdy avatar Jan 14 '21 12:01 kazdy

https://github.com/aws/aws-codebuild-docker-images/pull/428 addresses the build failure in Windows. Let us know if the issue persists.

subinataws avatar Feb 19 '21 20:02 subinataws

Let us know if this issue still persists. Resolving based on validation on our end.

subinataws avatar May 20 '21 14:05 subinataws

image

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

darlanpj avatar Jul 01 '21 18:07 darlanpj