Skip to content
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

package requires python version 3:, but spec asked for 2.7.16 #11531

Closed
danlipsa opened this issue May 22, 2019 · 9 comments
Closed

package requires python version 3:, but spec asked for 2.7.16 #11531

danlipsa opened this issue May 22, 2019 · 9 comments
Assignees
Labels
bug Something isn't working concretization python3 triage The issue needs to be prioritized

Comments

@danlipsa
Copy link
Contributor

danlipsa commented May 22, 2019

I am trying to change the paraview package so that version 5.6 uses python3 and all previous version use python2. So I have the following code:

depends_on('python@3:', when='@5.6:+python', type=('build', 'link', 'run'))
depends_on('python@2.7:2.8', when='@:5.5+python', type=('build', 'link', 'run'))

If I don't do the same branching on all python packages, I will get the error in the title for the following command:

spack spec paraview+python

However, if I specify the version that the previous command chooses, the command works correctly.

spack spec paraview@5.6.0+python

Numpy is one of the packages that are needed in paraview. I will have to use:

depends_on('py-numpy', when='@:5.5+python', type=('build', 'run'))
depends_on('py-numpy', when='@5.6:+python', type=('build', 'run'))

instead of the simpler:

depends_on('py-numpy', when='+python', type=('build', 'run'))

to avoid the error in the title. Attached is the package.py that shows this error.
paraview.zip

@citibeth
Copy link
Member

Could you please look over and comment on #11468? The central question is... is it possible / feasible to produce a single version of Spack that supports Python2 and Python3 stacks? Or starting 2020-Jan-01 should we stop trying to make things work for Python2? I was leaning toward the former. But if we can't figure out how to make things like this package work, then maybe it's more practical to drop Python2 support.

@baberlevi
Copy link
Member

I've run into similar issues, and have found if I add a 3.x version preference for python in packages.yaml or an equivalent section in spack.yaml (if using spack env) that fixes the problem, e.g.

python:
      variants: +tkinter+ucs4
      version: [3.7.2, 2.7.16]

I just tried this with your two python dependency lines added to paraview, and it is working for me.

maybe we should consider adding a something like that to the default packages.yaml distributed with spack?

@danlipsa
Copy link
Contributor Author

danlipsa commented May 23, 2019

@baberlevi Yes, this works! Thanks! Yes, it may make sense to add something like this to the default packages.yaml. I used a slightly simpler version:

   python:
      version: [3, 2]

@adamjstewart
Copy link
Member

maybe we should consider adding a something like that to the default packages.yaml distributed with spack?

Currently, the python package defaults to Python 2. If we want to switch the default to Python 3, that should fix this issue. See #10319.

@Sunando-S
Copy link

I've run into similar issues, and have found if I add a 3.x version preference for python in packages.yaml or an equivalent section in spack.yaml (if using spack env) that fixes the problem, e.g.

python:
      variants: +tkinter+ucs4
      version: [3.7.2, 2.7.16]

I just tried this with your two python dependency lines added to paraview, and it is working for me.

maybe we should consider adding a something like that to the default packages.yaml distributed with spack?

Hi, I have below in package.yaml.

packages:
  python:
    version: [3.6.8, 2.7.10]        <<< However, cannot install py-jupyter-notebook (`... but spec asked for 2.7.16`)
  all:
    compiler: [gcc, intel, pgi, clang, xl, nag, fj]
    providers:
      D: [ldc]
      awk: [gawk]
      blas: [openblas]

@adamjstewart
Copy link
Member

@sunandosamaddar That looks like another known bug in the concretizer. To get around this, you can do:

$ spack install py-jupyter-notebook ^python@3:

@Sunando-S
Copy link

Thanks @adamjstewart!

@alalazo
Copy link
Member

alalazo commented Nov 2, 2020

Duplicate of #1781

@alalazo alalazo marked this as a duplicate of #1781 Nov 2, 2020
@alalazo
Copy link
Member

alalazo commented Nov 2, 2020

This happens because being a Python package implies an unconditional dependence on python:

    extends('python')
    depends_on('python', type=('build', 'run'))

The conditional dependencies in the description create the same case as in #1781.

@alalazo alalazo closed this as completed Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working concretization python3 triage The issue needs to be prioritized
Projects
None yet
Development

No branches or pull requests

8 participants