Pyautogui error: The Pillow package is required to use this function - python

My pyautogui program gives me the following error when I do:
position = pyautogui.locateCenterOnScreen(image, confidence=.7)
Error message:
File "C:\Users\ashis\AppData\Local\Programs\Python\Python39\lib\site-packages\pyscreeze\__init__.py", line 144, in wrapper
raise PyScreezeException('The Pillow package is required to use this function.')
pyscreeze.PyScreezeException: The Pillow package is required to use this function.
Other pyautogui functions are working properly only when I do pyautogui.locateCenterOnScreen() gives and error.
I already have pillow properly installed:
Requirement already satisfied: pillow in c:\users\ashis\appdata\local\programs\python\python310\lib\site-packages (9.0.0)
Can anyone help please? I am following a tutorial.

That's a small problem, just update your Pillow package.
pip install Pillow --upgrade
Pillow-4.2.1 was on my system, it upgraded to Pillow-5.1.0 and now everything works just fine.

pip install pyautogui --upgrade

Here, is what worked for me
pip install pyscreeze
then,
import pyscreeze
position = pyscreeze.locateCenterOnScreen(image, confidence=.7)
Thanks,

Related

Error while importing lime_tabular package

I am trying to install lime_tabular but this message occurs and I cannot solve it:
ERROR: Could not find a version that satisfies the requirement lime_tabular (from versions: none)
ERROR: No matching distribution found for lime_tabular
I have upgraded pip and downloaded lime successfully, the problem only with lime_tabular.
lime_tabular is a module in the lime package. After running pip install lime, import with:
from lime import lime_tabular
if you have a requirements.txt file in your project directory, check the version written there. Maybe the version mentioned there is not correct. Remove the version number from there. Try to install again using
pip install -r requirements.txt
OR
If this package is installing a dependency of another package installation. Try to Upgrade the versions as well.
OR
If any of the two solution doesn't fix your solution. What u can do is to check the current version of this package and install it directly in your virtual environment or your current environment. Using
pip install <package-name>
After manually installing all the dependency packages then install your desired package. \
After installing try to import using the correct syntax
from lime import lime_tabular
or
import lime.lime_tabular
or
self.explainer = lime.lime_tabular.LimeTabularExplainer() // like this
I hope you find it useful.

Can't install rospy

I need to use rospy for my app, and when i try to install it via pip3 install rospy or pip3 install python-rospy it results an error: ERROR: Could not find a version that satisfies the requirement python-rospy (from versions: none) ERROR: No matching distribution found for python-rospy
I have no idea how to use it and where to download it
Thanks for any responces!
There could be multiple reasons behind these errors. I think you should first check if you have ROS1 installed on your system. Since you're going to use Python3, you'll have to install ROS1 Noetic. You can follow the instructions mentioned on http://wiki.ros.org/noetic/Installation/Ubuntu
If you already have ROS1 Noetic on your system, you should check if you've source ROS1 in your .bashrc. If source /opt/ros/neotic/setup.bash is already there, then something went wrong during the installation. You should install ROS again.
Hope this helps.

pyautogui.locateCenterOnScreen ERROR "pyscreeze.PyScreezeException: The Pillow package is required to use this function"

I am running into an issue and I am not sure what is causing it.
The code I am running is as follows:
gs_empty_search_btn_x, gs_empty_search_btn_y = pyautogui.locateCenterOnScreen('pictures/shopping/search_bar_empty.png',
confidence=.8)
print(gs_empty_search_btn_x)
For reference:
My OS is Windows
I am using PyCharm Community 2022.2.1
I have PIL (9.2.0) installed
PyAutoGui (0.9.53) installed
I ran pip install Pillow & pip install --upgrade Pillow" already and got "Requirement already satisfied" for both
I tried File -> Settings -> Project name -> Python Interpreter -> + -> Type pyautogui -> Install Package
I tried Python Packages > Pillow > Uninstalled Pillow > Re-Installed Pillow , still got the same error.
I added import PIL and Installed Pillow manually, still not working
I did pip freeze and got Pillow ==9.2.0
Nothing I am doing is working. Please help!
I figured it out! Had to delete everything and start over and delete a few packages that relied on other Python versions

I'm trying to get pyqt so i can get pylint but i cant seem to install it i am a absolute noob to python and coding in general

As stated in the title i cant get pylint. I'm on a mac using vs code and keep on getting this error
ERROR: pyqtwebengine 5.14.0 has requirement PyQt5>=5.14, but you'll have pyqt5 5.9 which is incompatible.
ERROR: pyqtwebengine 5.14.0 has requirement PyQt5-sip<13,>=12.7, but you'll have pyqt5-sip 4.19.19 which is incompatible.```
The dependencies aren't the right version, I'm assuming you probably used pip? Try
pip install --upgrade pyqt5
or whatever the equivalent version is for vscode. Then try again.

Installing PyAutoGUI Error in pip.exe install pyautogui

I have been installing PyautoGui on my WIN10 PC. But I am getting the following error, i have been getting a lot of errors jut to get this far.
i have been reinstalling python so its destination folder is in C:\Python instead of C:\Users\Home\AppData\Local\Programs\Python\Python35-32 mabye thats why ? How do i fix this ?
C:\Python\Scripts>pip.exe 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) Using cached Pillow-3.3.1-cp35-cp35m-win32.whl 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 "", line 1, in
File "C:\Users\Home\AppData\Local\Temp\pip-build-kxm3249e\pyscreeze\setup.py",
line 6, in
version=import('pyscreeze').version,
File "c:\users\home\appdata\local\temp\pip-build-kxm3249e\pyscreeze\pyscreeze__init__.py",
line 21, in
from PIL import Image
ImportError: No module named 'PIL'
Command "python setup.py egg_info" failed with error code 1 in
C:\Users\Home\AppData\Local\Temp\pip-build-kxm3249e\pyscreeze\
I encountered the same error message as you did. This workaround worked for me. Try these steps in order...
Install PyScreeze 0.1.7.
Update PyScreeze to 0.1.8.
Install PyAutoGui.
I hope this helps.
I also encountered the same error (albeit on Ubuntu 14.04). The missing module PIL is named Pillow (As said in this answer). So what I tried was (same in MacOS I think):
sudo pip3 install pillow
That translated to Windows would be:
pip.exe install pillow
Hope this helps you further.
Instead of letting PyautoGUI get all the packages for you.
Install all of them individually. Then, run the pip install --upgrade _packageName_
Then run pip install pyautogui.
Hope this helps.
I'm happy to report that this installation error has been fixed as of version 0.9.34. All you have to do is install or update PyAutoGUI from PyPI.
try
pip uninstall pyautogui
then
pip install pyautogui
There is a possibility that on windows it is not rightly configured on windows path and therefore it cant find the module, to fix this try:
Control Panel \ System and Security \ System
then click: Environment Variables, and double click on path and append the directory you want to use.
full explanation on: https://helpdeskgeek.com/windows-10/add-windows-path-environment-variable/
you can also try:
Cmd:
python -m pip install < module >
git clone https://github.com/USERNAME/REPOSITORY
or
To append to PYTHONPATH:
IDE:
import sys
sys.path.append('< path >')

Categories