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

pip fails when installing a local python package #19028

Closed
pumazi opened this Issue Dec 9, 2016 · 7 comments

Comments

Projects
None yet
7 participants
@pumazi

pumazi commented Dec 9, 2016

From @pumazi on April 13, 2016 20:12

ISSUE TYPE
  • Bug Report
COMPONENT NAME

pip

ANSIBLE VERSION
ansible 2.0.1.0
  config file = 
  configured module search path = Default w/o overrides
CONFIGURATION

N/A

OS / ENVIRONMENT

N/A

SUMMARY

Installation of local Python packages using the pip module fails. For example, from within the local package's root, pip install -e . or pip install -e .[feature].

STEPS TO REPRODUCE

Given an archived package installed on a server and unpacked to say /tmp/requests, install this package using the pip module.

- name: failed local python package install
  hosts: all
  tasks:
    - name: acquire source via the tarball
      become: yes
      unarchive:
        src: "https://pypi.python.org/packages/source/m/mock/mock-2.0.0.tar.gz"
        dest: "/var/tmp/"
        copy: no
    - name: install
      become: yes
      pip:
        name: ".[feature]"
        editable: yes
        chdir: "/var/tmp/mock-2.0.0"
        state: present
EXPECTED RESULTS

Installation of the local python package as a editable/development package.

ACTUAL RESULTS

With the addition of the extras_require in the package's setup.py, [feature] in the example, the module attempts to download the package rather than install from the local directory.

fatal: [example.com]: FAILED! => {"changed": false, "cmd": "/usr/bin/pip install .[feature]", "failed": true, "invocation": {"module_args": {"chdir": "/var/tmp/mock-2.0.0", "editable": true, "executable": null, "extra_args": null, "name": ".[feature]", "requirements": null, "state": "present", "use_mirrors": true, "version": null, "virtualenv": null, "virtualenv_command": "virtualenv", "virtualenv_python": null, "virtualenv_site_packages": false}, "module_name": "pip"}, "msg": "stdout: Downloading/unpacking .[feature]\n  Could not find any downloads that satisfy the requirement .[feature]\nCleaning up...\nNo distributions at all found for .[feature]\nStoring debug log for failure in /root/.pip/pip.log\n"}

Editable was set to true, but it is ignored. Looking at the code, I can see this is because the editable check is part of a compound condition that also checks if the package name containing a VCS prefix. As such, the editable flag -e is never applied to the command.

Note, the mock package doesn't actually have a requirements extra called "feature", but that's not the point. The internals of pip/setuptools will happily ignore the extra if it doesn't exist.

Copied from original issue: ansible/ansible-modules-core#3426

@pumazi

This comment has been minimized.

Show comment
Hide comment
@pumazi

pumazi Dec 9, 2016

From @ansibot on July 31, 2016 14:41

@mattupstate ping, this issue is waiting for your response.
click here for bot help

pumazi commented Dec 9, 2016

From @ansibot on July 31, 2016 14:41

@mattupstate ping, this issue is waiting for your response.
click here for bot help

@pumazi

This comment has been minimized.

Show comment
Hide comment
@pumazi

pumazi Dec 9, 2016

From @mattupstate on August 1, 2016 18:32

needs_contributor

pumazi commented Dec 9, 2016

From @mattupstate on August 1, 2016 18:32

needs_contributor

@pumazi

This comment has been minimized.

Show comment
Hide comment
@pumazi

pumazi Dec 9, 2016

From @ansibot on December 7, 2016 19:58

This repository has been locked. All new issues and pull requests should be filed in https://github.com/ansible/ansible

Please read through the repomerge page in the dev guide. The guide contains links to tools which automatically move your issue or pull request to the ansible/ansible repo.

pumazi commented Dec 9, 2016

From @ansibot on December 7, 2016 19:58

This repository has been locked. All new issues and pull requests should be filed in https://github.com/ansible/ansible

Please read through the repomerge page in the dev guide. The guide contains links to tools which automatically move your issue or pull request to the ansible/ansible repo.

@Lujeni

This comment has been minimized.

Show comment
Hide comment
@Lujeni

Lujeni Dec 26, 2016

Contributor

Hello @pumazi

I wrote a quick fix, can you let me know if it's works for you please?

Thank

Contributor

Lujeni commented Dec 26, 2016

Hello @pumazi

I wrote a quick fix, can you let me know if it's works for you please?

Thank

@jimi-c jimi-c removed the plugin label Jan 4, 2017

Lujeni added a commit to Lujeni/ansible that referenced this issue Feb 5, 2017

gundalow added a commit that referenced this issue Jul 14, 2017

Fix the editable condition into pip module (#19028) (#19688)
* Fix the editable condition into pip module (#19028)

* Add editable to tests

Default changed to False, so now editable: True is needed explicitly in
tests
@Lujeni

This comment has been minimized.

Show comment
Hide comment
@Lujeni

Lujeni Jul 15, 2017

Contributor

resolved_by_pr #19688

Contributor

Lujeni commented Jul 15, 2017

resolved_by_pr #19688

@ansibot

This comment has been minimized.

Show comment
Hide comment
@ansibot
Contributor

ansibot commented Jul 15, 2017

@robinro

This comment has been minimized.

Show comment
Hide comment
@robinro

robinro Jul 16, 2017

Contributor

bot_broken
The bot did not respect the resolved_by_pr message.

Contributor

robinro commented Jul 16, 2017

bot_broken
The bot did not respect the resolved_by_pr message.

@ansibot ansibot added the bot_broken label Jul 16, 2017

AlanCoding added a commit to AlanCoding/ansible that referenced this issue Jul 18, 2017

Fix the editable condition into pip module (ansible#19028) (ansible#1…
…9688)

* Fix the editable condition into pip module (ansible#19028)

* Add editable to tests

Default changed to False, so now editable: True is needed explicitly in
tests

@gundalow gundalow closed this Feb 4, 2018

@ansibot ansibot removed the bug_report label Mar 7, 2018

@ansibot ansibot added the bug label Mar 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment