I am running V5 and I put all my venv files into /opt so I have to remember 
to run the full path:
EG sudo /opt/weewx/weewx-venv/bin/wee_reports 
--config=/opt/weewx/weewx-data/weewx.conf

To use the venv I run :source /opt/weewx/weewx-venv/bin/activate
also if you want to exit the venv type the command: *deactivate*

Like Tom said the systemctl uses the full path:
ExecStart=/opt/weewx/weewx-venv/bin/python3 
/opt/weewx/weewx-venv/lib/python3.11/site-packages/weewxd.py 
/opt/weewx/weewx-data/weewx.conf

I am running weewx as root user but my config files have my user 
permissions and ownership.

On Saturday, 26 August 2023 at 09:12:48 UTC+10 Tom Keffer wrote:

> Running the venv's binaries (versus activation) is completely acceptable. 
> Indeed, that's what the systemctl unit file does.
>
> On Fri, Aug 25, 2023 at 3:27 AM Greg Troxel <g...@lexort.com> wrote:
>
>> Graham Eddy <g...@geddy.au> writes:
>>
>> > use ‘python3 -m venv ~/venv’ to create the environment in ~/venv.
>> > then in your shell run ’source ~/venv/bin/activate’ to set up the shell 
>> environment (initialised python bindary, PYTHONPATH etc). i put this in my 
>> ~/.bashrc
>> >
>> > a key trick is that running the initialised python binary 
>> (~/venv/bin/python3) on its own sucks in the environment - really, really 
>> handy in systemctl unit files
>> > ⊣GE⊢
>>
>> I have never activated a venv and always been puzzled by this being the
>> standard approach.  Simply running the venv' python binary, either
>> explicitly on the command line, or via a #!, has been entirely fine.  I
>> have home assistant working this way, which is super comlicated compared
>> to weewx.
>>
>> I also run, when in the venv dir
>>
>>   bin/pip install foo
>>
>> which runs the venv's pip which uses the venv's python.
>>
>> I'm glad to hear that there is no special 'have to activate' rule about
>> weewx.
>>
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "weewx-user" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to weewx-user+...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/weewx-user/rmi1qfre7t2.fsf%40s1.lexort.com
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/f60c2332-6151-48d3-8573-3d282460355bn%40googlegroups.com.

Reply via email to