How important is it to do virtual environments for all installations?

79 views
Skip to first unread message

D R

unread,
Jun 17, 2024, 7:55:22 PMJun 17
to weewx-user
With my Pi5 having arrived and run in for a week or so and a multitude of projects now under control, I want to start playing with WeeWx 5  (or 5.1).

I plan on a fresh install on a freshly updated Reap OS installation.  I expect to fiddle with it a lot, and if my past experience is anything, a few complete re-installs .

I've seen it mentioned that it is important to do all the WeeWx in a virtual environment.  I really don't have anything important on this computer, have been pretty good at installing according to instructions for previous versions, and now wonder if it is crucial to do Venv, or just go ahead as I have?  I'm seeing Tom say that Venv is a piece of cake, but until I figure stuff out (paths especially) I want to cut out anything which my interfere with learning and configuring.

Am I foolish to not try to master Venv until my final install? Are there bad actors lurking under every stone which I should be more concerned about?

Thanks. Dale
Oh, is it OK to begin to use 5.1 as a learning and testing program?  For awhile it will be just running the simulator, I think. 

Tom Keffer

unread,
Jun 17, 2024, 8:03:11 PMJun 17
to weewx...@googlegroups.com
The problem with installing pip into something other than a venv is that the latest versions of pip will declare an error, "error: externally-managed-environment". See PEP 668. You can press on ahead with appropriate pip options, but then you run the risk of breaking some other program. 

If you ever remove WeeWX, you will be faced with the choice of whether to remove its dependencies. You may not know, or remember, whether other programs depend on them.

Add it all up and, yes, it's worth using virtual environments.

Stick with v5.0 until v5.1 is released, which should be Real Soon Now.

--
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/0652a5a7-9ed1-4f80-afff-d7800928330cn%40googlegroups.com.

vince

unread,
Jun 17, 2024, 8:37:24 PMJun 17
to weewx-user
Short answer is it is not important.  You can always use the pre-packaged version with apt if you are more comfortable with that.

It's not rocket science.  Before you run pip or weectl you just 'source /home/pi/weewx-venv/bin/activate' and that's that.  Then you're running in the venv from a code perspective.  Super simple and just one more step.

Running a pip install gets you a lot of benefits if you like to fiddle around:
  • easy to install multiple versions (just create the venv with a different target directory)
  • easy to test upgrades in test-use-only instances without risking your prod instance (just specify which weewx.conf to use)
  • easy to back it all up - it's all in one directory for 'code' and one directory for 'data'
  • and many many more things if you want to fiddle a lot, heck you could run vs. a different python version if you wanted to...
The python folks induced the pip venv thing and all the os distributions just accepted it, so you might as well accept it as a breaking change we all have to deal with.  Wouldn't surprise me if in the future the prepackaged variants also run in a venv under the hood someday.  We're all kinda victims here on the venv thing.

DR

unread,
Jun 17, 2024, 10:25:34 PMJun 17
to weewx...@googlegroups.com
Thank you Vince and Tom for the concise answer and way to proceed.

I just didn't want to get caught chasing my tail while playing, but it
sounds more tail chasing might happen if I DON'T use Venv.


Thank you again for what must seem like a very basic question that all
'real' programmers would instinctively know the answer to!

Thanks. Dale


Reply all
Reply to author
Forward
0 new messages