Google Cloud Print service errors -- can't authorize. Ideas welcome! Topic is solved

Having issues with your DietPi installation, or, found a bug? Post it here.
fionaellie
Posts: 4
Joined: Fri Mar 27, 2020 8:11 pm

Google Cloud Print service errors -- can't authorize. Ideas welcome!

Post by fionaellie »

Hi,

I'm not able to authorize my

When I try to do:

Code: Select all

root@DietPi:~# cps-auth
This happens:

Code: Select all

Traceback (most recent call last):
  File "/usr/bin/cloudprint", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3191, in <module>
    @_call_aside
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3175, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3204, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 583, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'requests' distribution was not found and is required by cloudprint
Also:

Code: Select all

root@DietPi:~# systemctl status cloudprintd -l
returns:

Code: Select all

● cloudprintd.service - Google Cloud Print proxy service
   Loaded: loaded (/lib/systemd/system/cloudprintd.service; disabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Fri 2020-03-27 19:12:39 GMT; 1min 41s ago
     Docs: man:cloudprint-service
  Process: 10502 ExecStart=/usr/sbin/cloudprintd -a /var/lib/cloudprintd/authfile.json (code=exited
, status=1/FAILURE)
 Main PID: 10502 (code=exited, status=1/FAILURE)
User avatar
Joulinar
Posts: 2044
Joined: Sat Nov 16, 2019 12:49 am

Re: Google Cloud Print service errors -- can't authorize. Ideas welcome!

Post by Joulinar »

Hi,

looks like you are missing cloudprint dependency python-requests. Can you try:

Code: Select all

sudo pip install -U requests
(The '-U' may not be needed)
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
fionaellie
Posts: 4
Joined: Fri Mar 27, 2020 8:11 pm

Re: Google Cloud Print service errors -- can't authorize. Ideas welcome!

Post by fionaellie »

Thanks for the fast reply! I did some research and found that suggestion and tried it but pip command not found. Not enough of an expert to know what to do next :) Thanks
User avatar
Joulinar
Posts: 2044
Joined: Sat Nov 16, 2019 12:49 am

Re: Google Cloud Print service errors -- can't authorize. Ideas welcome!

Post by Joulinar »

ahh I see you are using python3. So can you try pip3 instead of pip command?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: Google Cloud Print service errors -- can't authorize. Ideas welcome!

Post by MichaIng »

That is btw a known issue as cloudprint APT package lacks python3-requests dependency on Buster. This has already been fixed for upstream, but it will very likely never reach the Debian stable repo, also since cloudprint service will be shutdown until the end of the year, so motivation to start effort on this is low... :(.
However I fixed it for DietPi v6.29 by manually install python3-requests package:

Code: Select all

apt install python3-requests
I think pip does not work as we do not install/use pip to install cloudprint in DietPi-Software. Probably we should? :?
fionaellie
Posts: 4
Joined: Fri Mar 27, 2020 8:11 pm

Re: Google Cloud Print service errors -- can't authorize. Ideas welcome!

Post by fionaellie »

Thanks for the suggestions, but I didn't manage to make it work:

This didn't work:

Code: Select all

root@DietPi:~# sudo pip3 install -U requests
sudo: pip3: command not found
But this installed fine:

Code: Select all

root@DietPi:~# apt install python3-requests
Reading package lists... Done
But then, we get this error:

Code: Select all

root@DietPi:~# cps-auth
Traceback (most recent call last):
  File "/usr/bin/cloudprint", line 11, in <module>
    load_entry_point('cloudprint==0.14', 'console_scripts', 'cloudprint-cmd')()
  File "/usr/share/cloudprint/cloudprint/cloudprint.py", line 608, in main
    ppd, description = get_printer_info(cups_connection, name)
  File "/usr/share/cloudprint/cloudprint/cloudprint.py", line 359, in get_printer_info
    ppd = ppd_file.read()
  File "/usr/lib/python3.7/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 12705: invalid continuation byte
User avatar
Joulinar
Posts: 2044
Joined: Sat Nov 16, 2019 12:49 am

Re: Google Cloud Print service errors -- can't authorize. Ideas welcome!

Post by Joulinar »

@fionaellie
puuhh I'm not a python specialist but looks like incorrect code page is used. But don't ask me how to fix it

@MichaIng
btw I tested cloud print installation on v6.29 DEV and looks like still something wrong during python3-requests installation

Code: Select all

 DietPi-Software
─────────────────────────────────────────────────────
 Mode: Installing CloudPrint: print server for google cloud print

/boot/dietpi/dietpi-software: line 5270: local: `python-requests=': not a valid identifier
/boot/dietpi/dietpi-software: line 5271: python-requests=python3-requests: command not found
[ INFO ] DietPi-Software | APT install for: cloudprint-service -requests, please wait...
E: Command line option 'r' [from -requests] is not understood in combination with the other options.
[FAILED] DietPi-Software | APT install for: cloudprint-service -requests
 - Command: apt-get -qq --allow-change-held-packages install cloudprint-service -requests
seems the -requests is not interpreted correctly

AAAH I guess it needs to be

Code: Select all

apt-get -qq --allow-change-held-packages install cloudprint-service python3-requests
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
Joulinar
Posts: 2044
Joined: Sat Nov 16, 2019 12:49 am

Re: Google Cloud Print service errors -- can't authorize. Ideas welcome!

Post by Joulinar »

Hi Guys,

now I tried to setup Google Cloud Print as well on regular DietPi v6.28 and I could not replicate the issue.

Once dietpi-software + python3-requests installation finished, I created a demo printer on the web admin page, restarted cloudprintd and try to run cps-auth.

Code: Select all

root@DietPiVM3:~# systemctl restart cloudprintd.service
root@DietPiVM3:~# systemctl status cloudprintd.service
● cloudprintd.service - Google Cloud Print proxy service
   Loaded: loaded (/lib/systemd/system/cloudprintd.service; disabled; vendor preset: enabled)
   Active: active (running) since Wed 2020-04-01 00:37:27 CEST; 2s ago
 Main PID: 894 (cloudprintd)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/cloudprintd.service
           └─894 /usr/bin/python /usr/sbin/cloudprintd -a /var/lib/cloudprintd/authfile.json

Apr 01 00:37:27 DietPiVM3 systemd[1]: Started Google Cloud Print proxy service.
root@DietPiVM3:~# cps-auth
Go to https://goo.gl/printer/xxxxx to claim this printer
trying for the win
trying for the win
trying for the win
It is working fine on a VM as well as RPi3B+
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
mail2rst
Posts: 51
Joined: Fri Apr 13, 2018 4:53 pm

Re: Google Cloud Print service errors -- can't authorize. Ideas welcome!

Post by mail2rst »

I also try to install google cloud print service. everything working till cups installation but struck at "sudo cps-auth" command. i found following error. i also install python PIP through dietpi software after that i run "sudo cps-auth" command







=================================================================================
root@DietPi:~# sudo cps-auth
Traceback (most recent call last):
File "/usr/bin/cloudprint", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3191, in <module>
@_call_aside
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3175, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3204, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 583, in _build_master
ws.require(__requires__)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 900, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'requests' distribution was not found and is required by cloudprint
root@DietPi:~#
=================================================================================



through the printer web page(http://192.168.1.XX:631) i can able to print test page(print comes with debian icon).i will thankful to anybody who guide me how i can install network printer on window10 pc. if google printer not works i will happy i can print through local network(LAN). my printer is USB connected to Raspberry pi & window10 pc connected in same LAN. every device having static IP address through DHCP reservation. thanks
User avatar
Joulinar
Posts: 2044
Joined: Sat Nov 16, 2019 12:49 am

Re: Google Cloud Print service errors -- can't authorize. Ideas welcome!

Post by Joulinar »

@mail2rst

your are missing as well the python3-requests package. pls do following and restart cloudprint service afterwards.

Code: Select all

apt install python3-requests
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply