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

PyInquirer conda conflict for nf-core 1.10.2 and python 3.7 #726

Closed
skrakau opened this issue Aug 11, 2020 · 16 comments
Closed

PyInquirer conda conflict for nf-core 1.10.2 and python 3.7 #726

skrakau opened this issue Aug 11, 2020 · 16 comments

Comments

@skrakau
Copy link
Member

skrakau commented Aug 11, 2020

Hi,
when running conda create --name nf-core-test python=3.7 nf-core=1.10.2 I get

Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versions

Package python conflicts for:
nf-core=1.10.2 -> python
nf-core=1.10.2 -> click -> python[version='2.7.*|3.5.*|3.6.*|3.4.*|>=3|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.8,<3.9.0a0|>=3.4']
python=3.7

Without specifying the python version it works using python 3.6.11.

@ewels
Copy link
Member

ewels commented Aug 11, 2020

Good to know, thanks! Not sure that there’s much that we can do about this, other than recommending Python 3.8 instead of 3.7 (I guess that also works, based on the error message?)

@skrakau
Copy link
Member Author

skrakau commented Aug 12, 2020

Somehow conda create --name nf-core-test python=3.8 nf-core=1.10.2 doesn't work either. I guess otherwise it would also install a newer version, if one is compatible, when not specifying the python version.

@skrakau
Copy link
Member Author

skrakau commented Aug 12, 2020

Don't know, the conda conflict messages do not always help somehow.

@ewels
Copy link
Member

ewels commented Oct 22, 2020

I just got the same problem for py3.8 and nf-core 1.10.2 in conda - also with no explanation in the errors. Installing from Pip (in the same conda environment) worked fine...?!

@apeltzer
Copy link
Member

apeltzer commented Oct 22, 2020

I have found mamba to be quite helpful in determining the cause of this so tried this out in a fresh environment :-)

$ mamba install -c bioconda -c conda-forge python=3.8 nf-core=1.10.2 -k

                  __    __    __    __
                 /  \  /  \  /  \  /  \
                /    \/    \/    \/    \
███████████████/  /██/  /██/  /██/  /████████████████████████
              /  / \   / \   / \   / \  \____
             /  /   \_/   \_/   \_/   \    o \__,
            / _/                       \_____/  `
            |/
        ███╗   ███╗ █████╗ ███╗   ███╗██████╗  █████╗
        ████╗ ████║██╔══██╗████╗ ████║██╔══██╗██╔══██╗
        ██╔████╔██║███████║██╔████╔██║██████╔╝███████║
        ██║╚██╔╝██║██╔══██║██║╚██╔╝██║██╔══██╗██╔══██║
        ██║ ╚═╝ ██║██║  ██║██║ ╚═╝ ██║██████╔╝██║  ██║
        ╚═╝     ╚═╝╚═╝  ╚═╝╚═╝     ╚═╝╚═════╝ ╚═╝  ╚═╝

        mamba (0.6.1) supported by @QuantStack

        GitHub:  https://github.com/mamba-org/mamba
        Twitter: https://twitter.com/QuantStack

█████████████████████████████████████████████████████████████

bioconda/noarch          [====================] (00m:00s) Done
pkgs/main/linux-64       [====================] (00m:00s) Done
pkgs/r/noarch            [====================] (00m:00s) Done
bioconda/linux-64        [====================] (00m:00s) Done
pkgs/main/noarch         [====================] (00m:00s) Done
conda-forge/noarch       [====================] (00m:00s) Done
pkgs/r/linux-64          [====================] (00m:00s) Done
conda-forge/linux-64     [====================] (00m:01s) Done

Looking for: ['python=3.8', 'nf-core=1.10.2']

Encountered problems while solving.
Problem: package nf-core-1.10.2-pyh864c0ab_0 requires pyinquirer 1.0.2.*, but none of the providers can be installed

So it looks like its directly related to pyinquirer :-(

@ewels
Copy link
Member

ewels commented Nov 6, 2020

PyInquirer!

shakefist

@ewels
Copy link
Member

ewels commented Nov 10, 2020

Questionary now has a file selector type which is quite nice, and should handle full validation I think. Needs thought and work, but at the moment I think that this is the best / easiest swap for PyInquirer.

Difficult to tell whether it will be better than PyInquirer with its dependencies as it uses Poetry. But might be worth a play with that first to check that it actually solves the installation issues.

Could also think about going old school and just doing it homebrew without any packages. Won't be as slick but might simplify things.

@ewels ewels changed the title conda conflict for nf-core 1.10.2 and python 3.7 PyInquirer conda conflict for nf-core 1.10.2 and python 3.7 Nov 10, 2020
@ggabernet
Copy link
Member

nf-core tools

@KevinMenden
Copy link
Contributor

Started to play a bit with Questionary - it looks like we can really just swap it.
It has a prompt command that takes the same input as PyInquirer, and it has a Separator().
I swapped it in all places and the code works and takes questions as expected. Haven't tried all use cases yet, though.

You can't install it alongside PyInquirer because that depends on an old version of the prompt-toolkit (version 1.-something, while Questionary uses 3.0.8). In my book that speaks for Questionary ...

I will test around a bit more - still need to fully understand the nf-core/tools code :-)

@Zethson
Copy link
Member

Zethson commented Nov 16, 2020

I've had great experiences with Questionary. The devs are also very responsive, somewhat contrary to the PyInquirer devs.

@TomKellyGenetics
Copy link
Member

TomKellyGenetics commented Nov 17, 2020

I've recently found similar issues caused by outdated bioconda libraries conflicting with updated dependencies on conda-forge. You can resolved it like this.

conda install -n ENV_NAME --strict-channel-priority --override-channels --c conda-forge -c bioconda PKG1 PKG2 PK3...

@ewels
Copy link
Member

ewels commented Nov 18, 2020

Yeah, Questionary looks good but be aware that "it has the same two problems that PyInquirer has" - #684 (comment)

Unfortunately past-me didn't care to elaborate on what those two problems were 🤦🏻

@ewels
Copy link
Member

ewels commented Nov 18, 2020

Ah, you can see the reason in the code comments when I switched back to the stable(!) release of PyInquirer:

- #
- # NOTE: WE ARE USING A PRE-RELEASE VERSION OF PYINQUIRER
- #
- # This is so that we can capture keyboard interruptions in a nicer way
- # with the raise_keyboard_interrupt=True argument in the prompt.prompt() calls
- # It also allows list selections to have a default set.
- #
- # Waiting for a release of version of >1.0.3 of PyInquirer.
- # See https://github.com/CITGuru/PyInquirer/issues/90
- #
- # When available, update setup.py to use regular pip version

+ # NOTE: When PyInquirer 1.0.3 is released we can capture keyboard interruptions
+ # in a nicer way # with the raise_keyboard_interrupt=True argument in the PyInquirer.prompt() calls
+ # It also allows list selections to have a default set.
+ #
+ # Until then we have workarounds:
+ # * Default list item is moved to the top of the list
+ # * We manually raise a KeyboardInterrupt if we get None back from a question
+ #

https://github.com/nf-core/tools/pull/684/files#diff-31477effcfb136e692dd57c7d0abf196e9cb8962d49c1bb43cee0f2a7ad8c93bL24-L33

So the two problems I was hitting were:

  • Being able to capture ctrl-c to exit
  • Having a default value when using a select list of options

And I added slightly unsatisfactory workarounds to both problems.

@Zethson
Copy link
Member

Zethson commented Nov 18, 2020

  1. questionary has a unsafe_ask() method, which does not catch any keyboard interrupts. (https://github.com/tmbo/questionary/blob/master/questionary/question.py#L55).
    I just wrote a new function, which wraps all questionary functions (I get what I want with getattr), catches all keyboard interrupts and does what I want with it.
  2. well kinda similar story to earlier with PyInquirer. There's an open PR which is pretty much done, but the author didn't have time to clean it. But honestly, having the default on top is not toooo bad.

@KevinMenden
Copy link
Contributor

KevinMenden commented Nov 19, 2020

So what to do? :-)
Questionary and PyInquirer are pretty much compatible, partly because the former is based on the latter (at least he mentions that its based on that). But Questionary is much more frequently updated and maintained.
So exchanging the two is just a swap of the import and some mentions in the code - and it would solve the issue with the python version..

On top of that, we could implement the path method from Questionary. For this we would need to know which input parameter actually is a path. Could be done by adding a boolean path to the schema, which we could then query in the single_param_to_pyinquirer function, and simply set the question type to path.

What do you think?

Edit: or directly change the type to path in the schema, of course.

Edit2: hmm okay I'm now realising that you can't just declare the typeas path in JSON schema ...

@KevinMenden
Copy link
Contributor

closed by #799

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

No branches or pull requests

7 participants