Salt pip_state -pre_releases option does not allow installing pip packages with pre-release versions
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
Thanks for the report. We'll get this fixed.
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?
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.
Threatening to close a (high severity tagged) issue because no progress has been made on it in four years is not a good look.
Thank you for updating this issue. It is no longer marked as stale.
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 %}
any update on this? after 5 years of original reporting?
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.
bump!
Thank you for updating this issue. It is no longer marked as stale.
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)
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 Are you seeing the issue with 3004 as well?
@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.
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.
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.