Solving zsh Python Error – zsh: no matches found: requests[security]

zsh Python Error – zsh: no matches found: requests[security] is a common error which occurs because of a very simple syntax problem in zsh.

In this post we will try to solve your error and see why it occurs in the first place, we will present multiple solutions so you can find the one which suits your case.

Exploring the Error : zsh Python Error – zsh: no matches found: requests[security]

The error happens because of a very simple syntax problem in zsh.

First, if you are getting the error this means you are doing something like

                                                                       #
pip install requests[security]
                                                                       #

Your error should look like the error message bellow. Make sure it is the exact match of the one bellow.

                                                                       #
zsh: no matches found: requests[security]
                                                                       #

Bellow I make my best attempt at solving the error and present multiple possible solutions.

Solution : Correctly use the square brackets

The problem is a very simple syntax problem.

You see, zsh actually uses square brackets for pattern matching and globbing.

You have two small fixes. You can either permanently disable globbing for the pip command or correct the syntax in the command.

To use the correct syntax

You can pass square brackets as an argument to the command by quoting the argument. Just like in the example bellow.

                                                                       #
pip install 'requests[security]'
                                                                       #

To disable globbing for pip You should add the code bellow to ~/.zshrc

                                                                       #
alias pip='noglob pip'
                                                                       #

This should be more than enough to get rid of the error forever.

Summing-up

That is it guys, this is the end of this article aka guide, I hope you found it useful in solving your problem, make sure to support our work on Kofi, you do not have to but hey you can donate to the team. Thank you for reading and cheers.

If you want to learn more about Python, please check out the Python Documentation : https://docs.python.org/3/