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

Hi,

I’m not able to authorize my

When I try to do:

root@DietPi:~# cps-auth

This happens:

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:

root@DietPi:~# systemctl status cloudprintd -l

returns:

● 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)

Hi,

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

sudo pip install -U requests

(The ‘-U’ may not be needed)

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 :slight_smile: Thanks

ahh I see you are using python3. So can you try pip3 instead of pip command?

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… :frowning:.
However I fixed it for DietPi v6.29 by manually install python3-requests package:

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? :thinking:

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

This didn’t work:

root@DietPi:~# sudo pip3 install -U requests
sudo: pip3: command not found

But this installed fine:

root@DietPi:~# apt install python3-requests
Reading package lists... Done

But then, we get this error:

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

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

 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

apt-get -qq --allow-change-held-packages install cloudprint-service python3-requests

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.

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+

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
from pkg_resources import load_entry_point
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 3191, in
@_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

mail2rst

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

apt install python3-requests

Joulinar
Good find, we used an invalid variable name there: dashes are not allowed in variable names, hence the package was not added correctly. dev branch only issue, fixed with: https://github.com/MichaIng/DietPi/commit/9837b376f20e298be3d3beff393263fe263fa001
Probably you found the new error handler convenient here which allows to fix a failing command in such cases without a need to exit the installer :smiley:.

thanks after giving “apt install python3-requests” command system able to work with google printer. thanks for your kind help

MichaIng
first I was a little bit irritated on the error handling as I was not expecting it. But than I was using the feature to change the executed command and was thinking: What an awesome development. Well done. Really nice und useful. :sunglasses:

I uninstalled and reinstalled GCP and it worked for a bit – I could use cps-auth and it replied with “no printers available”. Adding my printer is what caused the issue. I have a non-standard Dell color laser printer (C1660w) but there is no option to add this particular printer. Maybe adding it properly would help. Anyone know what profile to use?

Thanks

So you have cloud print working now? I’m not an expert on cloud print but on my test I have seen, that you could select drivers during printer installation. So maybe you need to check with Dell if they have driver packages for Debian/Linux. Next to that, you could check using some PS drivers. These are more generic drivers and could work.