172

I am trying to run a python urllib2 script and getting this error:

InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.

After googling the error the solution, on stack overflow is to download requests' security package:
pip install requests[security]

But when I run that I get the error...

zsh: no matches found: requests[security]

Anyone know why zsh isn't picking up this library, it installs/upgrades requests just fine, I don't know why this isn't working

I am running this on a Debian Server...

davidism
  • 121,510
  • 29
  • 395
  • 339
Kristen
  • 1,731
  • 2
  • 11
  • 7

1 Answers1

537

zsh uses square brackets for globbing / pattern matching.

That means that if you need to pass literal square brackets as an argument to a command, you either need to escape them or quote the argument like this:

pip install 'requests[security]'

If you want to disable globbing for the pip command permanently, you can do so by adding this to your ~/.zshrc:

alias pip='noglob pip'
Lukas Graf
  • 30,317
  • 8
  • 77
  • 92
  • 2
    That works perfectly thank you, now I just need to make sure it installs into the correct location. – Kristen Jun 09 '15 at 14:14
  • Came here for a similar error ``` ➜ pip install gym[box2d] zsh: no matches found: gym[box2d] ``` The correct way to use is ➜ pip install 'gym[box2d]' – Senthilkumar Gopal Feb 28 '20 at 04:00
  • 1
    Thank you for posting this! I looked high and low to figure out why my optional install was not working. – dant Mar 25 '20 at 20:15
  • 1
    Works like a charm! Just a note here, remember to restart zsh to make disabling globbing take effect – Alex G Apr 19 '20 at 08:56
  • 3
    isn't there a way to disable in `~/.zshrc` for all commands (not just for pip)? – Juan José Ramírez Feb 16 '21 at 22:19
  • I had **python -m pip install -U channels["daphne"]** and got the error: *zsh: no matches found: channels[daphne]* So I tried **python3 -m pip install -U 'channels[daphne]'** instead, and it worked. – AnonymousUser Jan 03 '23 at 06:45