1

I am using the CMD to install the pyautogui module and keep getting the following error:

Command "python setup.py egg_info" failed with error code 1 in C:\Users\ANDBOD~1\AppData\Local\Temp\pip-build-pmc8kstd\pyscreeze\

I use pip install pyautogui to start the install, and cmd displays the following code before the error appears:

    C:\WINDOWS\system32>pip install pyautogui
Collecting pyautogui
  Using cached PyAutoGUI-0.9.33.zip
Collecting pymsgbox (from pyautogui)
  Using cached PyMsgBox-1.0.3.zip
Collecting PyTweening>=1.0.1 (from pyautogui)
  Using cached PyTweening-1.0.3.zip
Collecting Pillow (from pyautogui)
  Downloading Pillow-4.0.0-cp36-cp36m-win32.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 78kB/s
Collecting pyscreeze (from pyautogui)
  Using cached PyScreeze-0.1.8.zip
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\ANDBOD~1\AppData\Local\Temp\pip-build-pmc8kstd\pyscreeze\setup.py", line 6, in <module>
        version=__import__('pyscreeze').__version__,
      File "C:\Users\ANBDOD~1\AppData\Local\Temp\pip-build-pmc8kstd\pyscreeze\pyscreeze\__init__.py", line 21, in <module>
        from PIL import Image
    ModuleNotFoundError: No module named 'PIL'

I believe the error is happening because cmd is searching the C:\Users\ANDBOD... file path and that is not where I have my python files saved. I've tried opening cmd as admin but received the same error.

I used the exact same process to install openpyxl 2 weeks ago and had no issue, but now I get the same issue no matter which module I try to install.

Thanks in advance for the help!

  • Try this http://stackoverflow.com/questions/8863917/importerror-no-module-named-pil – Nilesh Jan 11 '17 at 22:30
  • 1
    The directory shown is just a temp directory, don't worry about it. If you read down through the output, it will tell you exactly what is wrong. pip is trying to install `pyautogui`, which has a number of dependencies. One of those dependencies, `pyscreeze`, needs the `PIL` module, which is provided by the `Pillow` package (yeah, it's confusing). You'll see that Pillow has already been downloaded, but not installed yet, so when the `setup.py` from PyScreeze tries to import `pyscreeze`, it fails because it can't yet find the `PIL` module. Solution? `pip install pillow`, then install pyautogui. – MattDMo Jan 11 '17 at 22:38
  • @Lafada gold... I just used variations of what they posted there until it suddenly decided to work. Thanks! – iStillHaveToGoPee Jan 11 '17 at 22:41
  • @MattDMo Thanks! That's exactly what the link Lafada posted said. – iStillHaveToGoPee Jan 11 '17 at 22:43
  • This has nothing to do with the cmd shell. cmd searches for and executes pip.exe, which is responsible for parsing the rest of the command line. pip inherits its standard handles for the console (conhost.exe) from cmd.exe, and thereafter cmd waits in the background for pip to exit. pip.exe in turn executes python.exe to run the main entry point for the pip package that's installed in "Lib/site-packages". – Eryk Sun Jan 12 '17 at 01:51

2 Answers2

1

The following comments from above are how I solved this issue:

@Lafada - ImportError: No module named PIL

@MattDMo - The directory shown is just a temp directory, don't worry about it. If you read down through the output, it will tell you exactly what is wrong. pip is trying to install pyautogui, which has a number of dependencies. One of those dependencies, pyscreeze, needs the PIL module, which is provided by the Pillow package (yeah, it's confusing). You'll see that Pillow has already been downloaded, but not installed yet, so when the setup.py from PyScreeze tries to import pyscreeze, it fails because it can't yet find the PIL module. Solution? pip install pillow, then install pyautogui.

Community
  • 1
  • 1
0

when there is no module PIL only then this error will occur, its simle. Install PIL while you could also check some other threads.

ImportError: No module named PIL

Community
  • 1
  • 1