Hi,

Thanks for the resource, I have just tried implementing the fixes provided
in the document, but it still throws up errors,
As per the document, I have added
from gpiozero.pins.pigpio import PiGPIO
Device.pin_factory = PiGPIOFactory()

however, this throws up:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Can't connect to pigpio at localhost(8888)

Did you start the pigpio daemon? E.g. sudo pigpiod

Did you specify the correct Pi host/port in the environment
variables PIGPIO_ADDR/PIGPIO_PORT?
E.g. export PIGPIO_ADDR=soft, export PIGPIO_PORT=8888

Did you specify the correct Pi host/port in the
pigpio.pi() function? E.g. pigpio.pi('soft', 8888)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Traceback (most recent call last):
  File "/home/james/networkerbot.py", line 39, in <module>
    Device.pin_factory =  PiGPIOFactory()
                          ~~~~~~~~~~~~~^^
  File
"/home/james/myenv/lib/python3.13/site-packages/gpiozero/pins/pigpio.py",
line 93, in __init__
    raise IOError(f'failed to connect to {host}:{port}')
OSError: failed to connect to localhost:8888


I have tried, as per the error message suggested, tried running sudo pigpiod
,which returns command not found.

I have a feeling its something to do with being inside of a virtual
environment.

Many thanks
James C


On Fri, 2 Jan 2026 at 12:00, <[email protected]> wrote:

> Send dorset mailing list submissions to
>         [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://mailman.lug.org.uk/mailman/listinfo/dorset
> or, via email, send a message with subject or body 'help' to
>         [email protected]
>
> You can reach the person managing the list at
>         [email protected]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of dorset digest..."
>
>
> Today's Topics:
>
>    1. Missing Default pin factory for gpiozero in a virtual
>       environment. (James)
>    2. Re: Missing Default pin factory for gpiozero in a virtual
>       environment. (Ralph Corderoy)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 1 Jan 2026 21:24:18 +0000
> From: James <[email protected]>
> To: Dorset Linux User Group <[email protected]>
> Subject: [Dorset] Missing Default pin factory for gpiozero in a
>         virtual environment.
> Message-ID:
>         <CAPE1QqDw8iJVVZuF2DFq1vB0FPPZPFnxK8EZ1+G=
> [email protected]>
> Content-Type: text/plain; charset="UTF-8"
>
> Hi,
>
> I have a discord bot running on my raspberry pi 5 in a virtual environment,
> and in the code I am trying to read the cpu temperature, except when the
> code tries to run any gpiozero function (in particular CPUTemperature() )
> it returns this error:
>
> BadPinFactory: Unable to load any default pin factory!
>
> this used to work on my Pi 3 which this was previously running on but I
> cant remember what I had done to make it work, the code is unchanged
> between the Pi3 and the Pi5
>
> Does anyone know how I can fix this?
>
> Many thanks
>
> James C
>
>
> ------------------------------
>
> Message: 2
> Date: Fri, 02 Jan 2026 11:54:22 +0000
> From: Ralph Corderoy <[email protected]>
> To: James <[email protected]>
> Cc: Dorset Linux User Group <[email protected]>
> Subject: Re: [Dorset] Missing Default pin factory for gpiozero in a
>         virtual environment.
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=utf-8
>
> Hi James,
>
> > BadPinFactory: Unable to load any default pin factory!
>
> This page looks like a good resource, especially with the bits of Python
> to try entering directly to see what's going on, e.g.
>
>     from gpiozero import Device
>     Device._default_pin_factory()
>
> and how to change it.
> https://gpiozero.readthedocs.io/en/stable/api_pins.html
>
> --
> Cheers, Ralph.
>
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> dorset mailing list
> [email protected]
> https://mailman.lug.org.uk/mailman/listinfo/dorset
>
>
> ------------------------------
>
> End of dorset Digest, Vol 1055, Issue 5
> ***************************************
>
-- 
  Next meeting: Online, Jitsi, Tuesday, 2026-01-06 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  https://dorset.lug.org.uk
  New thread, don't hijack:  mailto:[email protected]

Reply via email to