Search code examples
pythonpip

CMD is not recognized python modules as an internal or external command, operable program or batch file


When I try to install any module with pip install the cmd/vscode return this message (I tried it with different ones)

C:\>pip install solc-select
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
Requirement already satisfied: solc-select in c:\python310\lib\site-packages (0.2.1)
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
WARNING: There was an error checking the latest version of pip.

But when I try to run the module's code I get this issue:

C:\>solc-select use 0.8.7
'solc-select' is not recognized as an internal or external command,
operable program or batch file.

I've reinstalled my Python 3 and pip as well.

Python 3.10.5
C:\>pip --version
pip 22.1 from C:\Users\Jester\AppData\Roaming\Python\Python310\site-packages\pip (python 3.10)

I'm facing this issue on Windows 10 x64 and I've added Python and pip folder/file to my system variables.


Solution

  • Try it with a virtual environment. To do that, take the following steps:

    • In VScode (or a separate commanpdrompt screen), make sure you are in your working folder.
    • Initialise a virtual environment with the command python -m venv venv. This will create a folder 'venv' in your working folder
    • Activate your virtual environment with bin\venv\activate, you should now see (venv) - C:/path/to/working/folder in your command prompt.
    • Install the module that you want, using your virtual environment with pip install sold-select