'pip' is not recognized as an internal or external command, HAS WORKED BEFORE

C:\Users\nymhole>path
PATH=C:\Users\nymhole\AppData\Local\Programs\Python\Python312\Scripts\;C:\Users\nymhole\AppData\Local\Programs\Python\Python312\;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\libnvvp;C:\Program Files\Smart Projects\IsoBuster;C:\Program Files\Oculus\Support\oculus-runtime;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\TortoiseGit\bin;C:\ProgramData\chocolatey\bin;C:\Program Files\NVIDIA Corporation\Nsight Compute 2024.3.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Users\nymhole\AppData\Local\Programs\Python\Python312\Scripts\;C:\Users\nymhole\AppData\Local\Programs\Python\Python312\;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\libnvvp;C:\Program Files\Smart Projects\IsoBuster;C:\Program Files\Oculus\Support\oculus-runtime;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\TortoiseGit\bin;C:\ProgramData\chocolatey\bin;C:\Program Files\NVIDIA Corporation\Nsight Compute 2024.3.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Users\nymhole\AppData\Local\Microsoft\WindowsApps;;C:\Users\nymhole\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\nymhole\.dotnet\tools;C:\Users\nymhole\AppData\Local\Microsoft\WinGet\Pac

C:\Users\nymhole>pip
'pip' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\nymhole>

these are different paths.

Hi,

just an fyi. So that the PATHs are provided in a list format as opposed to a daisy chain format for easier viewing, type this:

import sys

for index, path in enumerate(sys.path):
    print(f'{str(index+1) + '.':<3} {path}')
C:\Users\nymhole>import sys
'import' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\nymhole>
C:\Users\nymhole>for index, path in enumerate(sys.path):
index was unexpected at this time.
C:\Users\nymhole>    print(f'{str(index+1) + '.':<3} {path}')
The system cannot find the file specified.

You have to type that when you’re in the Python editor and not in the command prompt.

1 Like

my bad, im not sure how to access the python editor and have not been using it thus far.

Python 3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> C:\Users\nymhole>import sys
  File "<stdin>", line 1
SyntaxError: unexpected character after line continuation character
>>> 'import' is not recognized as an internal or external command,
  File "<stdin>", line 1
    'import' is not recognized as an internal or external command,
                               ^
SyntaxError: invalid syntax
>>> operable program or batch file.
  File "<stdin>", line 1
    operable program or batch file.
             ^
SyntaxError: invalid syntax
>>>
>>> C:\Users\nymhole>
  File "<stdin>", line 1
SyntaxError: unexpected character after line continuation character
>>> C:\Users\nymhole>for index, path in enumerate(sys.path):
  File "<stdin>", line 1
SyntaxError: unexpected character after line continuation character
>>> index was unexpected at this time.
  File "<stdin>", line 1
    index was unexpected at this time.
          ^
SyntaxError: invalid syntax
>>> C:\Users\nymhole>    print(f'{str(index+1) + '.':<3} {path}')
  File "<stdin>", line 1
SyntaxError: unexpected character after line continuation character
>>> The system cannot find the file specified.
  File "<stdin>", line 1
    The system cannot find the file specified.
        ^
SyntaxError: invalid syntax
>>>
>>> C:\Users\nymhole>

… if you can see a directory path … then you’re not in a Python editor.

Python editors include, for example: IDLE, PyCharm, Spyder, Anaconda, etc.

okay! i am inexperienced and i am just trying to get pip to work again through the normal “pip” command in windows command prompt, so that it may be accessible through external programs. i am posting lots of extraneous information that may or may not be relevant to my predicament. in the post 21, i posted 2 different paths which appear to be the same but are not, one inside of the command prompt and the other inside of the environmental variables mentioned in post 16 by matther barnett. i found this out because the pip path is not present after CUDA when i use the path command or the echo %PATH% command, which give the same result. and the CUDA paths end differently. furthermore the duplicates which i removed in environmental variables are still present inside of the path command.

Try upgrading it. In the command prompt, type:

py -m pip install --upgrade pip

after opening IDLE i recieved the same thing after pasting the command.

Python 3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> Python 3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> C:\Users\nymhole>import sys
  File "<stdin>", line 1
SyntaxError: unexpected character after line continuation character
>>> 'import' is not recognized as an internal or external command,
  File "<stdin>", line 1
    'import' is not recognized as an internal or external command,
                               ^
SyntaxError: invalid syntax
>>> operable program or batch file.
  File "<stdin>", line 1
    operable program or batch file.
             ^
SyntaxError: invalid syntax
>>>
>>> C:\Users\nymhole>
  File "<stdin>", line 1
SyntaxError: unexpected character after line continuation character
>>> C:\Users\nymhole>for index, path in enumerate(sys.path):
  File "<stdin>", line 1
SyntaxError: unexpected character after line continuation character
>>> index was unexpected at this time.
  File "<stdin>", line 1
    index was unexpected at this time.
          ^
SyntaxError: invalid syntax
>>> C:\Users\nymhole>    print(f'{str(index+1) + '.':<3} {path}')
  File "<stdin>", line 1
SyntaxError: unexpected character after line continuation character
>>> The system cannot find the file specified.
  File "<stdin>", line 1
    The system cannot find the file specified.
        ^
SyntaxError: invalid syntax
>>>
>>> C:\Users\nymhole>
C:\Users\nymhole>py -m pip install --upgrade pip
Requirement already satisfied: pip in c:\users\nymhole\appdata\local\programs\python\python312\lib\site-packages (24.2)

IDLE does not have a path as you are showing. Reference the following screenshot.

idle_screenshot

unsure what happened the first time, as i am using the same porgram. but not the same instance.
image_2024-08-16_150359143

image_2024-08-16_150629912
this is what im opening

image_2024-08-16_150838656
i tried to update it. this is good? it seems to be an earlier version than both of ours, and did not actually change anything

One observation is that you have Python v3.9.0. This was released back in October of 2020. Is there a particular reason why you downloaded this version as opposed to the latest and greatest? There are new features included since then. Including the match conditional statement that can be very useful among other upgrades/bug fixes.

I would recommend uninstalling ALL earlier versions and install the most recent version. Try having only one version installed. It makes it easier when installing new packages as they would all be installed to your active Python version. As you stated, you are new (i am inexperienced and i am ... - from an earlier post). This way, you start with a clean slate.

You can go here to download the latest version. Download Python | Python.org
(make sure you first uninstall ALL other versions, however)

i am not sure. it appears i already have python 3.12.5
image_2024-08-16_151929507
after clicking repair i recieved this message, after some loading:
!screenshot 2Screenshot 2024-08-16 151806|648x399
and after modifying it and leaving everything as default, including “installing” pip, ive recieved a success message:
!screenshot3image_2024-08-16_152106919|651x405

this modification actually fixed my issue.

Ok, great!

… just once small point here. When you enter the script, one line should be entered one at a time and not ‘pasted’ as one unit. Enter as instructed here:

a. import sys (Enter)
b. for index, path in enumerate(sys.path): (Enter)
c. print(f'{str(index+1) + '.':<3} {path}') (Enter, Enter)
(this line should be indented relative to the previous one)

This is why the error shown in red text was generated.