salt icon indicating copy to clipboard operation
salt copied to clipboard

Salt pip_state -pre_releases option does not allow installing pip packages with pre-release versions

Open dan1 opened this issue 12 years ago • 16 comments

The pip.installed state option '-pre_releases' should be equivalent to: $ pip install --pre some_pip_package.pre-release-version

Currently it does not allow pre-release versions to be installed.

Example sls file:

...

my-python-package: pip.installed: - name: my-python-package - upgrade: True - bin_env: /usr/local - pre_releases: True

...

pip version is 1.4.1

dan1 avatar Jan 24 '14 23:01 dan1

Thanks for the report. We'll get this fixed.

basepi avatar Jan 29 '14 15:01 basepi

I found this ticket while debugging a similar (the same?) issue, but am confused as there are not many details here. I am using a similar state, and see the following debug output from my salt run:

[DEBUG   ] TRY BLOCK: end of pip.install -- cmd: ['/var/web/myapp/venv/bin/pip', 'install', '--pre', 'myapp[production]'], cmd_kwargs: {'runas': 'myapp', 'use_vt': False, 'saltenv': 'base', 'env': {'VIRTUAL_ENV': '/var/web/myapp/venv'}}

Despite the explicit command arguments listed, the prereleases are not installed. When I run the stripped command by hand, i.e.: /var/web/myapp/venv/bin/pip install --pre myapp[production] , the prerelease does install. What could possibly be going wrong here?

majuscule avatar Aug 24 '17 17:08 majuscule

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

stale[bot] avatar Dec 17 '18 17:12 stale[bot]

Threatening to close a (high severity tagged) issue because no progress has been made on it in four years is not a good look.

majuscule avatar Dec 17 '18 18:12 majuscule

Thank you for updating this issue. It is no longer marked as stale.

stale[bot] avatar Dec 17 '18 18:12 stale[bot]

This still seems to be broken. The state below doesn't do what you'd expect, and never installs a pre-release:

example-install:
  pip.installed:
    - extra_index_url: 'https://{{ pillar['pip']['packagecloud_token']}}:@packagecloud.io/foo/baz/pypi/simple'
    - bin_env: /var/web/example/venv
    - user: example
    - name: example_package[production]
    - upgrade: True
    - pre_releases: {% if 'staging' in grains['id'] %} True {% else %} False {% endif %}

wilson avatar Apr 24 '19 15:04 wilson

any update on this? after 5 years of original reporting?

adparvum avatar Apr 24 '19 15:04 adparvum

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

stale[bot] avatar Jan 08 '20 19:01 stale[bot]

bump!

adparvum avatar Jan 09 '20 02:01 adparvum

Thank you for updating this issue. It is no longer marked as stale.

stale[bot] avatar Jan 09 '20 02:01 stale[bot]

moving this up in severity and putting on the list to get it fixed - will update after planning session, assigned to plan, stalebot shouldn't stale this out going forward (as of today)

sagetherage avatar Jan 24 '20 04:01 sagetherage

Hi, I hope everyone is doing well during this pandemic era. I just wanted to drop a note to say this issue is still of interest to us, and also…

distinctly

if you're using packagecloud, the problem may be packagecloud and not salt. I've tried reporting to packagecloud that I'm unable to install pre-release versions of python packages from packagecloud (using pip directly, not salt), but I never got a reply (since November 2020).

kojiromike avatar Mar 03 '21 18:03 kojiromike

@kojiromike Are you seeing the issue with 3004 as well?

anilsil avatar Nov 01 '21 19:11 anilsil

@anilsil 🤔 I am not working very closely in this space right now, but I know the issue I mentioned about packagecloud seems to have been resolved. Unfortunately I can't tell you if it's resolved exactly in SaltStack, but maybe. If nobody can reproduce the issue, then I think it's probably resolved.

kojiromike avatar Nov 01 '21 19:11 kojiromike

I've confirmed that this bug sort of exists. While pre_release: True and upgrade: True ignore pre-released versions for already-installed packages, they do not prevent installing the pre-release versions, they just have to be specified.

This has to do with the fact that the default is to ignore other versions.

The workaround is to specify the particular version you want, and it will be able to be installed. Though, a good fix for this bug would be to check that when pre_release=True that we should set include_alpha = include_beta = include_rc. Honestly, just changing https://github.com/saltstack/salt/blob/43f05bb600a8975c2cb406560acd1f03dc237374/salt/states/pip_state.py#L297-L299 to

include_alpha = include_beta = include_rc = pre_release

Obviously the fix would need some tests, but... that would solve that problem.

waynew avatar Nov 16 '21 19:11 waynew

Closing this due to age, the old version of Salt and Python 2, also this was pending wanting community help since couple of years. If you retest this with the latest release of Salt 3006.2 and if still an issue, please open a new issue, which will have metrics in tracking issues.

anilsil avatar Aug 29 '23 03:08 anilsil