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

Failed Dependencies

Open dasunsrule32 opened this issue 4 years ago • 9 comments
trafficstars

Server:

NAME="Red Hat Enterprise Linux Server"
VERSION="7.9 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.9"

Python:

python -V
Python 3.8.6

ansible-bundler:

bundle-playbook
Ansible Bundler - v1.10.2

Error:

./batch-migrations.run --debug
[2021-08-19 10:10:37 MST] Extracting bundle contents to /tmp/ansible-bundle.4x060...
[2021-08-19 10:10:39 MST] Running entrypoint...
Installing playbook Python dependencies...
Collecting ansible (from -r /tmp/ansible-bundle.4x060/requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/b5/01/dd6bf3cb7d834c7493d10fa1f0720c34c7703fc9bf12c93f294def465bb0/ansible-4.4.0.tar.gz (35.4MB)
    100% |████████████████████████████████| 35.4MB 77.6MB/s 
Collecting ansible-core<2.12,>=2.11.3 (from ansible->-r /tmp/ansible-bundle.4x060/requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/98/3c/1305a288433f23f95bddb6b5b81ac6c6412ba2f737539cc7dba736085021/ansible-core-2.11.4.tar.gz (6.8MB)
    100% |████████████████████████████████| 6.9MB 60.1MB/s 
Collecting jinja2 (from ansible-core<2.12,>=2.11.3->ansible->-r /tmp/ansible-bundle.4x060/requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/80/21/ae597efc7ed8caaa43fb35062288baaf99a7d43ff0cf66452ddf47604ee6/Jinja2-3.0.1-py3-none-any.whl (133kB)
    100% |████████████████████████████████| 143kB 46.6MB/s 
Collecting PyYAML (from ansible-core<2.12,>=2.11.3->ansible->-r /tmp/ansible-bundle.4x060/requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/7a/5b/bc0b5ab38247bba158504a410112b6c03f153c652734ece1849749e5f518/PyYAML-5.4.1-cp36-cp36m-manylinux1_x86_64.whl (640kB)
    100% |████████████████████████████████| 645kB 73.8MB/s 
Collecting cryptography (from ansible-core<2.12,>=2.11.3->ansible->-r /tmp/ansible-bundle.4x060/requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/9b/77/461087a514d2e8ece1c975d8216bc03f7048e6090c5166bc34115afdaa53/cryptography-3.4.7.tar.gz (546kB)
    100% |████████████████████████████████| 552kB 74.7MB/s 
    Complete output from command python setup.py egg_info:
    
            =============================DEBUG ASSISTANCE==========================
            If you are seeing an error here please try the following to
            successfully install cryptography:
    
            Upgrade to the latest pip and try again. This will fix errors for most
            users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
            =============================DEBUG ASSISTANCE==========================
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-5ze_t_48/cryptography/setup.py", line 14, in <module>
        from setuptools_rust import RustExtension
    ModuleNotFoundError: No module named 'setuptools_rust'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-5ze_t_48/cryptography/
Error: Python dependencies could not be installed.
[2021-08-19 11:11:19 MST] Finished, removing temp content...
[2021-08-19 11:11:19 MST] Done.

pip3 install:

pip3 install setuptools-rust                                 
Collecting setuptools-rust                                                     
  Using cached https://files.pythonhosted.org/packages/82/2b/349ad916a2f032506a2c7c0810950a299f96e05d88b21797c2170bd6b2c6/setuptools_rust-0.12.1-py3-none-any.
whl                   
Collecting semantic-version>=2.6.0 (from setuptools-rust)                                                                                                     
  Using cached https://files.pythonhosted.org/packages/a5/15/00ef3b7888a10363b7c402350eda3acf395ff05bebae312d1296e528516a/semantic_version-2.8.5-py2.py3-none-
any.whl                                                                                                                                                       
Collecting toml>=0.9.0 (from setuptools-rust)                                                                                                                 
  Using cached https://files.pythonhosted.org/packages/44/6f/7120676b6d73228c96e17f1f794d8ab046fc910d781c8d151120c3f1569e/toml-0.10.2-py2.py3-none-any.whl
Collecting setuptools>=46.1 (from setuptools-rust)                                                                                                            
  Using cached https://files.pythonhosted.org/packages/bd/25/5bdf7f1adeebd4e3fa76b2e2f045ae53ee208e40a4231ad0f0c3007e4353/setuptools-57.4.0-py3-none-any.whl
Installing collected packages: semantic-version, toml, setuptools, setuptools-rust                 
Exception:                                                                                                                                                    
Traceback (most recent call last):                                                                                                                            
  File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main 
    status = self.run(options, args)                                                                                                                          
  File "/usr/lib/python3.6/site-packages/pip/commands/install.py", line 365, in run               
    strip_file_prefix=options.strip_file_prefix,                                                                                                              
  File "/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 789, in install                
    **kwargs                                                                                                                                                  
  File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 854, in install                
    strip_file_prefix=strip_file_prefix                                                                                                                       
  File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 1069, in move_wheel_files 
    strip_file_prefix=strip_file_prefix,                                                                                                                      
  File "/usr/lib/python3.6/site-packages/pip/wheel.py", line 345, in move_wheel_files             
    clobber(source, lib_dir, True)                                                                                                                            
  File "/usr/lib/python3.6/site-packages/pip/wheel.py", line 287, in clobber
    ensure_dir(dest)  # common for the 'include' path                     
  File "/usr/lib/python3.6/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)                                                          
  File "/usr/lib64/python3.6/os.py", line 210, in makedirs                    
    makedirs(head, mode, exist_ok)                                                                                                                            
  File "/usr/lib64/python3.6/os.py", line 220, in makedirs               
    mkdir(name, mode)                                                          
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.6'

pip3 install --user

pip3 install --user setuptools-rust                      
Collecting setuptools-rust
  Using cached https://files.pythonhosted.org/packages/82/2b/349ad916a2f032506a2c7c0810950a299f96e05d88b21797c2170bd6b2c6/setuptools_rust-0.12.1-py3-none-any.
whl                
Collecting semantic-version>=2.6.0 (from setuptools-rust)
  Using cached https://files.pythonhosted.org/packages/a5/15/00ef3b7888a10363b7c402350eda3acf395ff05bebae312d1296e528516a/semantic_version-2.8.5-py2.py3-none-
any.whl
Collecting toml>=0.9.0 (from setuptools-rust)
  Using cached https://files.pythonhosted.org/packages/44/6f/7120676b6d73228c96e17f1f794d8ab046fc910d781c8d151120c3f1569e/toml-0.10.2-py2.py3-none-any.whl
Collecting setuptools>=46.1 (from setuptools-rust)
  Using cached https://files.pythonhosted.org/packages/bd/25/5bdf7f1adeebd4e3fa76b2e2f045ae53ee208e40a4231ad0f0c3007e4353/setuptools-57.4.0-py3-none-any.whl
Installing collected packages: semantic-version, toml, setuptools, setuptools-rust
Successfully installed semantic-version-2.8.5 setuptools-57.4.0 setuptools-rust-0.12.1 toml-0.10.2

Issue:

It appears that ansible-bundler is trying to use pip install without the --user switch which fails to run successfully as a normal user.

dasunsrule32 avatar Aug 19 '21 18:08 dasunsrule32

Thanks for the detailed report. Can you show me the command line you're using to build the bundle package?

kriansa avatar Aug 19 '21 18:08 kriansa

Sure, it's:

bundle-playbook -f batch-migrations.yml

My playbook is:

---
- hosts: localhost
  become: no
  roles:
    - batch-migrations

and a tree of my role:

roles/batch-migrations/
├── defaults
│   └── main.yml
├── README.md
├── tasks
│   ├── batch.yml
│   ├── depends.yml
│   └── main.yml
└── vars
    ├── dev_vars.yml
    └── qa_vars.yml

dasunsrule32 avatar Aug 19 '21 18:08 dasunsrule32

Well, that's weird. I'll take a look at it tonight. Do you know if it can be reproduced on CentOS?

kriansa avatar Aug 19 '21 18:08 kriansa

It should be the same as CENTOS 7. I don't have one spun up I can test with, but in theory, it should be the same.

dasunsrule32 avatar Aug 19 '21 18:08 dasunsrule32

To add some additional context, we have python2.7, python3.6 and python3.8 installed. So not sure if that is confusing the script at all either.

dasunsrule32 avatar Aug 19 '21 19:08 dasunsrule32

@dasunsrule32 I know this is quite old, but is there a chance you're still facing this issue? Let me know.

kriansa avatar Apr 29 '23 18:04 kriansa

Yes, same issue

dasunsrule32 avatar Apr 29 '23 18:04 dasunsrule32

Are you still using RHEL 7?

kriansa avatar Apr 29 '23 18:04 kriansa

It was Amazon Linux 1 before, my work computer got upgraded to Amazon Linux 2 since this was opened though.

cat /etc/os-release 
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"

dasunsrule32 avatar May 01 '23 16:05 dasunsrule32