python-3.xmacosselenium-webdriverterminalpip

How to resolve "packages(s) not found: selenium" error in Mac Terminal?


How to resolve "packages(s) not found: selenium" error in Mac Terminal when issuing the command: pip3 show selenium

I've installed Selenium successfully, with: brew install selenium-server from Terminal command prompt. Seemed to work fine.

Later I found where someone suggested problem might be overcome by using: python3.13 -m pip install selenium. Seemed to work fine also. But when I execute the command:

pip3 show selenium

I get "WARNING: Package(s) not found: selenium"

If I execute: python3.13 --version I get: Python 3.13.4

Any help greatly appreciated.


Solution

  • This answer builds on @Philippe's comment:

    The reason pip3 show selenium didn't work is likely due to version mismatches between Python installations as you probably have multiple Python versions installed (a system-installed Python and perhaps user-installed Python versions)

    Your pip3 seems to point to the pip for a different Python version. You can check by running:

    which pip3
    pip3 --version
    

    You might see something like:

    /usr/local/bin/pip3
    pip 23.2.1 from /usr/local/lib/python3.10/site-packages (python 3.10)
    

    So when you run pip3 show selenium it checks for Selenium in Python 3.10 environment, not 3.13.

    You can use python3.13 -m pip show selenium as it uses the correct pip for Python 3.13 because you installed Selenium under Python 3.13, and you're correctly calling the pip module that belongs to that version.

    Also it is highly recommended to avoid global installation of packages and use virtual environments instead. You can then install your packages in that active environment. This will enable you manage projects that requires specific versions of Python and packages.