Following pip instructions from documentation results in an broken pip installation

347 views
Skip to first unread message

Peter Waller

unread,
Nov 23, 2013, 2:31:00 PM11/23/13
to salt-...@googlegroups.com
I followed the instructions here for automatically ensuring pip is installed
Here is what's in my sls:
     
python-pip:
  cmd:
    - run
    - cwd: /
    - name: easy_install --script-dir=/usr/bin -U pip
    - reload_modules: true
     
python-packages:
  pip.installed:
    - requires:
      - cmd: python-pip
    - pkgs:
      - mypythonpackage

Unfortunately, these instructions result in a broken installation of pip on Ubuntu 13.10:

$ pip2
Traceback (most recent call last):
  File "/usr/bin/pip2", line 9, in <module>
    load_entry_point('pip==1.4.1', 'console_scripts', 'pip2')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 343, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2308, in load_entry_point
    raise ImportError("Entry point %r not found" % ((group,name),))
ImportError: Entry point ('console_scripts', 'pip2') not found

Note that `pip`, works, though `pip2` doesn't.

It may be that this has occurred because I have python-pip installed from the apt repositories already.

Thanks,

- Peter

Peter Waller

unread,
Nov 23, 2013, 2:45:45 PM11/23/13
to salt-...@googlegroups.com
I got myself back into a good state by pip uninstalling pip and then just using this to install pip instead.

python-pip:
  pkg:
    - installed

my-python-package:
  pip.installed:
    - requires:
      - pkg: python-pip

Unfortunately I can't figure out how to install many packages with one declaration as I might with pkg.installed, like so:

my-packages:
  pkg.installed:
    - refresh: True
    - pkgs:
      - my-first-package
      - my-second-package

I tried this but obviously it failed:

python-pip:
  pkg:
    - installed
     
python-packages:
  pip.installed:
    - requires:
      - pkg: python-pip
    - pkgs:
      - my-first-package
      - my-second-package

Given that salt is configuration management software and that it comes with pip support out of the box, it is unfortunate that using the pip.* state requires you to manually specify that installing something with pip requires that pip to be installed.

It is also unfortunate that the syntax for installing packages diverges from `pkg.installed` in that I can't seem to just specify a list of packages to be installed without resorting to templating.

Is there a way to do so, or must I resort to templating? If I do have to use templating, can someone give an example of a good way to achieve it in this specific case?

Thanks in advance,

- Peter

David Boucha

unread,
Nov 23, 2013, 3:06:41 PM11/23/13
to salt users list

Try
- names
Instead of
- pkgs

--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Peter Waller

unread,
Nov 23, 2013, 3:46:16 PM11/23/13
to salt-...@googlegroups.com
Hi David,

On 23 November 2013 20:06, David Boucha <da...@saltstack.com> wrote:

Try
- names
Instead of
- pkgs


Thanks! That looks like it is working. Glad to know there is a sane way of doing it. How does this mechanism work? It is unfortunate that `names` doesn't appear in the documentation [1].

Regards,

- Peter

Colton Myers

unread,
Nov 26, 2013, 6:08:16 PM11/26/13
to salt-...@googlegroups.com
`names` basically automatically does the templating that you mentioned you were going to try.  It splits out each name into its own state and they execute separately.

`pkgs`, on the other hand, has been implemented for only a few of the states, and it's designed to install all of those packages with only a single call to the package manager (saving a lot of time).  This has just not been implemented yet for pip.

`names` is supported automatically for any state (handled in the state compiler).  `pkgs` support must be added manually to each state.

--
Colton Myers


--
Reply all
Reply to author
Forward
0 new messages