Python Forum
Noob warning: trying to use pip to install pytest and pep8 in Command Prompt
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Noob warning: trying to use pip to install pytest and pep8 in Command Prompt
#1
I'm learning Python with the book "Head First Python" by Paul Barry.
I'm on chapter 4, in the section titled "Install the Testing Developer Tools" where it teaches how to install the pytest testing framework and pep8 plugin.

It explains how to install pytest in Windows 10 using the Command Prompt.
I'm following the step-by-step guide but getting different results from what is intended and not sure what to do.

Can someone maybe help me out?

The book says to open Command Prompt as Administrator and type:
py -3 -m pip install pytest

When I do that and hit enter, I see the following:

Installing collected packages: colorama, py, pluggy, toml, attrs, iniconfig, pyparsing, packaging, atomicwrites, pytest
WARNING: The scripts py.test.exe and pytest.exe are installed in 'C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Successfully installed atomicwrites-1.4.0 attrs-20.3.0 colorama-0.4.4 iniconfig-1.1.1 packaging-20.8 pluggy-0.13.1 py-1.10.0 pyparsing-2.4.7 pytest-6.2.1 toml-0.10.2
WARNING: You are using pip version 20.2.3; however, version 20.3.3 is available.
You should consider upgrading via the 'C:\Users\username\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe -m pip install --upgrade pip' command.


What do those warnings mean?
Reply
#2
You can't go very long without pip saying it needs to be updated. I just follow the instructions to update pip and am good for another month or so. No major concerns here.

The first message says the package you installed is not on the Python search path. Did you install python as administrator? It installed the package as a user.
Reply
#3
I have made a short video on how to correctly install Python modules/libraries step by step. See if it helps. Most likely the pip command line wasn't in the correct path when you run it.
Reply
#4
Look at this link.
(Dec-20-2020, 12:25 AM)adifrank Wrote: 'C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts' which is not on PATH.
Look at link under Fixing Path if needed
[Image: GUgLry.jpg]
For you need to add these paths in Environment Variables Path.
C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\
C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts\
Restart Pc.
(Dec-20-2020, 12:25 AM)adifrank Wrote: WARNING: You are using pip version 20.2.3; however, version 20.3.3 is available.
After fixing Windows Paths,now will python and pip from work anywhere in cmd.
C:\>python -m pip install --upgrade pip
Collecting pip
  Downloading pip-20.3.3-py2.py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 364 kB/s
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.2.4
    Uninstalling pip-20.2.4:
      Successfully uninstalled pip-20.2.4
Successfully installed pip-20.3.3

C:\>pip -V
pip 20.3.3 from c:\python38\lib\site-packages\pip (python 3.8)

C:\>
MK_CodingSpace Wrote:I have made a short video on how to correctly install Python modules/libraries step by step. See if it helps. Most likely the pip command line wasn't in the correct path when you run it.
Should really be fixing environment variables Path,so don't need to go into Scripts folder for using pip.
So for ease of use should python and pip main Python version work from anywhere in cmd.
py can be used to access other Python version if that's needed.
C:\                                                                                                            
λ py -3.6 -V                                                                                                   
Python 3.6.4                                                        
                                                      
C:\                                                                                                            
λ py -2.7 -V                                                                                                   
Python 2.7.9                                                                                                   
                                                                                                                
C:\                                                                                                            
λ # Using pip to install to 2.7                                                                            
λ py -2.7 -m pip install logzero                                                                               
Requirement already satisfied: logzero in c:\python27\lib\site-packages
adifrank likes this post
Reply
#5
Thanks all! This helped!
@snipsatt - thanks for the detailed step-by-step. I followed it and all looks good now
Big Grin
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pytest Installed, but VS Code Won’t Access Pytest AstralWeeks 9 3,226 Sep-13-2023, 03:00 PM
Last Post: AstralWeeks
  What is the difference between Command Prompt and Sublimes yaoyao22 1 634 Jul-09-2023, 02:56 PM
Last Post: snippsat
  Pytest mocks anthonyrmoss78 0 448 May-30-2023, 08:28 PM
Last Post: anthonyrmoss78
  New to python, question regarding PEP8 AthertonH 3 1,492 Apr-14-2022, 06:49 AM
Last Post: buran
  Facing Problem while opening a file through command prompt vlearner 4 1,904 Jan-30-2022, 08:10 AM
Last Post: snippsat
  Packages inconsistent warning during hdbscan install Led_Zeppelin 0 1,927 Aug-31-2021, 04:10 PM
Last Post: Led_Zeppelin
  Running Python in Command Prompt Anwar 3 3,081 Nov-15-2020, 03:15 PM
Last Post: snippsat
  starting python from windows command prompt MaartenRo 4 2,807 Sep-04-2020, 12:25 PM
Last Post: MaartenRo
  "pip install -e ." returns : ERROR: Command errored out with exit status 1 mostafaPython 3 5,505 Jun-09-2020, 09:28 AM
Last Post: snippsat
  Pytest and rootdirectory Master_Sergius 4 4,663 Jun-01-2020, 05:05 PM
Last Post: Master_Sergius

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020