This is ‘due’ to pep 668 and a ‘push’ for users to use virtual 
environments. It is warning the person installing the python module, 
sortedcontainers, that they  are installing into an ‘global’ 
(externally-managed-environment) location. There are a few ways to solve 
this.
Create a virtual environment, activate it, and install the module. Since 
WeeWX was a package install, this is not reasonable.
As the message states, override the warning using the 
‘--break-system-packages’ option. It would look something like this, ‘pip3 
install sortedcontainers --break-system-packages’.
If it exists, install the OS package. It would be something like this, 
‘sudo apt install python3-sortedcontainers’

Additional information:
http://rptl.io/venv
https://peps.python.org/pep-0668/
https://packaging.python.org/en/latest/specifications/externally-managed-environments/#externally-managed-environments

rich
On Monday 29 July 2024 at 10:10:36 UTC-4 Tom Keffer wrote:

> The user is doing a package install (the clue is paths such as 
> '/usr/share/weewx/...'
>
> My thinking is that you are using an extension that needs 
> 'sortedcontainers'.
>
> Please post your configuration file, /etc/weewx/weewx.conf. Make sure you 
> look it over and remove any passwords or other sensitive information before 
> posting. 
>
>
>
> On Sun, Jul 28, 2024 at 11:41 PM Marty b <[email protected]> wrote:
>
>> Should point out that I did try installing the missing module, but got 
>> the following error:
>>
>>  $ pip3 install sortedcontainers
>> error: externally-managed-environment
>>
>> × This environment is externally managed
>> ╰─> To install Python packages system-wide, try apt install
>>     python3-xyz, where xyz is the package you are trying to
>>     install.
>>
>>     If you wish to install a non-Debian-packaged Python package,
>>     create a virtual environment using python3 -m venv path/to/venv.
>>     Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
>>     sure you have python3-full installed.
>>
>>     For more information visit http://rptl.io/venv
>>
>> note: If you believe this is a mistake, please contact your Python 
>> installation or OS distribution provider. You can override this, at the 
>> risk of breaking your Python installation or OS, by passing 
>> --break-system-packages.
>>
>> On Sunday, July 28, 2024 at 11:14:11 PM UTC-7 Marty b wrote:
>>
>>> Hello,
>>>
>>> Just built a new SD card with Raspbian bookworm 64 bit and WeeWx.  When 
>>> starting weewx I get an error "No module named 'sortedcontainers'.  Please 
>>> let me know how to resolve this.
>>>
>>> Thanks!
>>>
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: INFO weewx.engine: StdConvert 
>>> target unit is 0x1
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: INFO weewx.wxservices: 
>>> StdWXCalculate will use data binding wx_binding
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: INFO weewx.engine: Archive will 
>>> use data binding wx_binding
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: INFO weewx.engine: Record 
>>> generation will be attempted in 'hardware'
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: INFO weewx.engine: Using archive 
>>> interval of 300 seconds (specified by hardware)
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: INFO weewx.restx: 
>>> StationRegistry: Registration not requested.
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: INFO weewx.restx: Wunderground: 
>>> Posting not enabled.
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: INFO weewx.restx: PWSweather: 
>>> Posting not enabled.
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: INFO weewx.restx: CWOP: Posting 
>>> not enabled.
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: INFO weewx.restx: WOW: Posting 
>>> not enabled.
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: INFO weewx.restx: AWEKAS: 
>>> Posting not enabled.
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: INFO weewx.engine: 'pyephem' 
>>> detected, extended almanac data is available
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__: Caught 
>>> unrecoverable exception:
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****  No 
>>> module named 'sortedcontainers'
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     **** 
>>>  Traceback (most recent call last):
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****   
>>>  File "/usr/share/weewx/weewxd.py", line 121, in main
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****     
>>>  engine = weewx.engine.StdEngine(config_dict)
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****     
>>>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****   
>>>  File "/usr/share/weewx/weewx/engine.py", line 89, in __init__
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****     
>>>  self.loadServices(config_dict)
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****   
>>>  File "/usr/share/weewx/weewx/engine.py", line 157, in loadServices
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****     
>>>  obj = weeutil.weeutil.get_object(svc)(self, config_dict)
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****     
>>>        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****   
>>>  File "/usr/share/weewx/weeutil/weeutil.py", line 1404, in get_object
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****     
>>>  module = importlib.import_module(module_name)
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****     
>>>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****   
>>>  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in 
>>> import_module
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****     
>>>  return _bootstrap._gcd_import(name[level:], package, level)
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****     
>>>         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****   
>>>  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****   
>>>  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****   
>>>  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****   
>>>  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: Traceback (most recent call 
>>> last):
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]:   File 
>>> "/usr/share/weewx/weewxd.py", line 226, in <module>
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****   
>>>  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]:     main()
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]:   File 
>>> "/usr/share/weewx/weewxd.py", line 121, in main
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****   
>>>  File "<frozen importlib._bootstrap>", line 241, in 
>>> _call_with_frames_removed
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]:     engine = 
>>> weewx.engine.StdEngine(config_dict)
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]:             
>>>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]:   File 
>>> "/usr/share/weewx/weewx/engine.py", line 89, in __init__
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****   
>>>  File "/etc/weewx/bin/user/loopdata.py", line 30, in <module>
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]:     
>>> self.loadServices(config_dict)
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]:   File 
>>> "/usr/share/weewx/weewx/engine.py", line 157, in loadServices
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]:     obj = 
>>> weeutil.weeutil.get_object(svc)(self, config_dict)
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     ****     
>>>  from sortedcontainers import SortedDict
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]:           
>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]:   File 
>>> "/usr/share/weewx/weeutil/weeutil.py", line 1404, in get_object
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     **** 
>>>  ModuleNotFoundError: No module named 'sortedcontainers'
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]: CRITICAL __main__:     **** 
>>>  Exiting.
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]:     module = 
>>> importlib.import_module(module_name)
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]:             
>>>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]:   File 
>>> "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
>>> Jul 28 23:12:10 WeeWx2024 weewxd[2632]:     return 
>>> _bootstrap._gcd_import(name[level:], package, level)
>>>
>> -- 
>> 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 [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/weewx-user/3cb59936-0567-4c41-a53a-62e752879775n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/weewx-user/3cb59936-0567-4c41-a53a-62e752879775n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/d8a08cdb-d5b1-4db2-9f9f-54855503f901n%40googlegroups.com.

Reply via email to