ansible-pyenv icon indicating copy to clipboard operation
ansible-pyenv copied to clipboard

"Install versions" fails: "pyenv: No such file or directory"

Open blueyed opened this issue 9 years ago • 6 comments

When trying this role, it fails to install the versions:

TASK: [dirn.pyenv | Install versions] ***************************************** 
failed: [c.example.com] => (item=2.7.9) => {"cmd": "pyenv install 2.7.9", "failed": true, "item": "2.7.9", "rc": 2}
msg: [Errno 2] No such file or directory
failed: [c.example.com] => (item=3.4.3) => {"cmd": "pyenv install 3.4.3", "failed": true, "item": "3.4.3", "rc": 2}
msg: [Errno 2] No such file or directory
failed: [c.example.com] => (item=pypy-2.5.0) => {"cmd": "pyenv install pypy-2.5.0", "failed": true, "item": "pypy-2.5.0", "rc": 2}
msg: [Errno 2] No such file or directory
failed: [c.example.com] => (item=pypy3-2.4.0) => {"cmd": "pyenv install pypy3-2.4.0", "failed": true, "item": "pypy3-2.4.0", "rc": 2}
msg: [Errno 2] No such file or directory

FATAL: all hosts have already failed -- aborting

The pyenv command is not available yet: the Add to run commands task comes later, and even then, the pyenv_runcom would need to be sourced before.

blueyed avatar Jun 22 '15 22:06 blueyed

I got the same error: TASK: [dirn.pyenv | Install versions] ***************************************** failed: [127.0.0.1] => (item=3.4.3) => {"cmd": "pyenv install 3.4.3", "failed": true, "item": "3.4.3", "rc": 2} msg: [Errno 2] No such file or directory

musicformellons avatar Jul 01 '15 19:07 musicformellons

@dirn Yep, getting the same issue.

osman-masood avatar Oct 09 '15 10:10 osman-masood

@blueyed, @musicformellons, and @oamasood, what OS?

dirn avatar Oct 09 '15 15:10 dirn

@dirn It's from within an Ubuntu 14.04 Docker container. Here's the dockerfile:

FROM ansible/ubuntu14.04-ansible:stable
MAINTAINER Osman Masood <[email protected]>

WORKDIR /root
ADD . my_dir

RUN ansible-galaxy install dirn.pyenv  # Install Ansible role for pyenv from Galaxy

ADD ansible/container-bootstrap.yml /srv/ansible/container-bootstrap.yml
WORKDIR /srv/ansible
RUN ansible-playbook -v container-bootstrap.yml -c local

And my container-bootstrap.yml:

- name: Bootstrap gettalent/base_service_container image
  hosts: local
  tasks:
    - name: update core libs
      apt: update_cache=yes
    - name: install basic packages
      apt: pkg={{ item }} update_cache=yes cache_valid_time=259200  # 3 days
      with_items:
        - curl
        - wget
        - build-essential
        - gcc
        - make
        - zlib1g-dev  
        - libbz2-dev
        - libmysqlclient-dev
        - libreadline-dev
        - libxml2-dev
        - libxslt-dev
        - libssl-dev
        - nginx
        - git
    - name: install Python and Basic Tools
      apt: pkg={{ item }} update_cache=yes cache_valid_time=259200  # 3 days
      with_items:
        - python
        - python-dev
        - python-distribute
        - python-pip
        - python-setuptools
        - software-properties-common
        - python-software-properties


- name: Install python 2.7.9 in pyenv
  hosts: local
  roles:
    - role: dirn.pyenv
      pyenv_virtualenv: false
      pyenv_runcom: ~/.bashrc
      pyenv_versions:
        - 2.7.9
      pyenv_default_versions:
        - 2.7.9
      pyenv_project_versions:
        - 2.7.9

Thanks.

osman-masood avatar Oct 09 '15 17:10 osman-masood

Awesome. This will be a huge help.

dirn avatar Oct 09 '15 18:10 dirn

In install versions command, pyenv should be prefixed with full qualified path:

- name: Install versions
  command: creates={{ pyenv_root }}/versions/{{ item }} {{ pyenv_root }}/bin/pyenv install {{ item }}
  with_items: "{{ pyenv_versions }}"

dylanninin avatar Jun 19 '17 14:06 dylanninin