openaps / oref0

oref0: The open reference implementation of the OpenAPS reference design.
http://www.OpenAPS.org
MIT License
431 stars 394 forks source link

Fresh install fails with "AttributeError: 'module' object has no attribute 'Locale'" while importing device.json #1377

Open PieterGit opened 4 years ago

PieterGit commented 4 years ago

Describe the bug Fresh install fails oref0-setup with AttributeError: 'module' object has no attribute 'Locale' while importing device.json.

To Reproduce Steps to reproduce the behavior:

  1. Jubilinux 0.3.0
  2. Install according to docs

Expected behavior A succesfull install

Errors The install fails with

2020-06-02 02:38:48,581 INFO All permissions in Nightscout are ok
Importing /root/src/oref0/lib/oref0-setup/vendor.json
openapscontrib.timezones://
mmeowlink.vendors.mmeowlink://
Importing /root/src/oref0/lib/oref0-setup/device.json
Traceback (most recent call last):
  File "/usr/local/bin/openaps-import", line 89, in <module>
    app( )
  File "/usr/local/lib/python2.7/dist-packages/openaps/cli/__init__.py", line 51, in __call__
    self.run(self.args)
  File "/usr/local/bin/openaps-import", line 81, in run
    incoming = self.Make(candidate)
  File "/usr/local/bin/openaps-import", line 65, in Make
    inst = Configurable.FromImport(configurable, self.config)
  File "/usr/local/lib/python2.7/dist-packages/openaps/devices/device.py", line 66, in FromImport
    vendor = vendors.lookup_dotted(fields['vendor'], config)
  File "/usr/local/lib/python2.7/dist-packages/openaps/vendors/__init__.py", line 30, in lookup_dotted
    vendors = all_vendors(config)
  File "/usr/local/lib/python2.7/dist-packages/openaps/vendors/__init__.py", line 36, in all_vendors
    return get_vendors( ) + find_plugins(config)
  File "/usr/local/lib/python2.7/dist-packages/openaps/vendors/__init__.py", line 16, in find_plugins
    return [ v.get_module( ) for v in vendors ]
  File "/usr/local/lib/python2.7/dist-packages/openaps/vendors/plugins/vendor.py", line 19, in get_module
    return importlib.import_module(self.name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/usr/local/lib/python2.7/dist-packages/openapscontrib/timezones/__init__.py", line 132, in <module>
    import recurrent
  File "/usr/local/lib/python2.7/dist-packages/recurrent/__init__.py", line 1, in <module>
    from recurrent.event_parser import RecurringEvent
  File "/usr/local/lib/python2.7/dist-packages/recurrent/event_parser.py", line 10, in <module>
    pdt = parsedatetime.Calendar()
  File "/usr/local/lib/python2.7/dist-packages/parsedatetime/__init__.py", line 270, in __init__
    self.ptc = Constants()
  File "/usr/local/lib/python2.7/dist-packages/parsedatetime/__init__.py", line 2381, in __init__
    self.locale = get_icu(self.localeID)
  File "/usr/local/lib/python2.7/dist-packages/parsedatetime/pdt_locales/icu.py", line 56, in get_icu
    result['icu'] = icu = pyicu.Locale(locale)
AttributeError: 'module' object has no attribute 'Locale'
Could not import /root/src/oref0/lib/oref0-setup/device.json

Setup Information (please complete the following information): Pump WW, CGM Dexcom G6 / oref 0.7.0-dev / rig Explorer board

Additional context Fresh install. Temporary workaround. disable: do_openaps_import statements from oref0-setup.sh

   # import template
   #do_openaps_import $HOME/src/oref0/lib/oref0-setup/vendor.json
   #do_openaps_import $HOME/src/oref0/lib/oref0-setup/device.json
   #do_openaps_import $HOME/src/oref0/lib/oref0-setup/report.json
   #do_openaps_import $HOME/src/oref0/lib/oref0-setup/alias.json

Please tell me what the suggested route is to fix, and I'll create a PR.

PieterGit commented 4 years ago

Somehow 0.7.0 still seems to depend on some parts of openaps. When running, the settings/profile.json didn't get updated (and stayed 0 bytes). I will look into it later. Any help to fix this is welcome.

PieterGit commented 4 years ago

Tracked cause down on the import recurrent statement from https://github.com/openaps/openaps-contrib/blob/master/openapscontrib/timezones/__init__.py#L132-L139

When I remove the recurrent references I managed to do a succesfull install.

@scottleibrand : can you give some guidance on how to proceed with this issue? I thought openaps was deprecated for 0.7.0, but I don't think the rig works without it at this moment.

ekazum commented 4 years ago

@PieterGit Solution found for now - replace version of python package from 2.6 to 2.5 pip install parsedatetime==2.5

After running this, run again the installation, it finishes successfuly

yduncan commented 4 years ago

@ekazum Could you explain to me how to replace version of python package from 2.7 to 2.5? I believe I'm seeing the 2.7 in my script, but could be wrong.

ekazum commented 4 years ago

@yduncan Just run: pip install parsedatetime==2.5

It will replace the relevant package (not entire python, just one package in my case)

yduncan commented 4 years ago

@yduncan Just run:

pip install parsedatetime==2.5

It will replace the relevant package (not entire python, just one package in my case)

Before running the bootstrap script? Or change it in the bootstrap?

Or it may have been in the setup script. I'm not that technical sorry.

tnharvey commented 4 years ago

@yduncan Just run: pip install parsedatetime==2.5 It will replace the relevant package (not entire python, just one package in my case)

Before running the bootstrap script? Or change it in the bootstrap?

Or it may have been in the setup script. I'm not that technical sorry.

@yduncan I was able to get up and running by running pip install parsedatetime==2.5 right after the first setup failed as noted. I ran oref0-setup again after the pip command and setup completed successfully.

I'm not sure that this is a common problem, so I wouldn't know whether this should result in updates to the oref0-setup script or not.

old-square-eyes commented 4 years ago

Happened to me. And the fix has worked in other scenarios. Though running the bootstrap on a clean flash I get in a loop. It fails with this error, I run the fix successfully, then when I run the bootstrap again it reverts the change before running into the error again.

Installing collected packages: parsedatetime
  Found existing installation: parsedatetime 2.5
    Uninstalling parsedatetime-2.5:
      Successfully uninstalled parsedatetime-2.5
Successfully installed parsedatetime-2.6
Traceback (most recent call last):
  File "/usr/local/bin/activate-global-python-argcomplete", line 23, in <module>
    argcomplete.autocomplete(parser)
AttributeError: 'module' object has no attribute 'autocomplete'
Couldn't run activate-global-python-argcomplete
old-square-eyes commented 4 years ago

I was able to back out of my corner with a Jubilinux reflash, repeatedly rerun bootstrap (fails several times), and then apply the fix pip install parsedatetime==2.5 before I came to finally run install.

sksksksksksksk commented 4 years ago

Submitted a PR that fixes this in dev.

scottleibrand commented 4 years ago

Thanks. Merged it.

applehat commented 4 years ago

Just as a note, Doing a clean install on latest Raspberry Pi OS following documentation nets this same error still, and the above pip command gets past the error.

sksksksksksksk commented 4 years ago

After switching to the dev branch of oref0, does this still happen? The fix has only been applied to the dev branch, and I installed 2 rigs this morning without encountering this issue.

I'm not saying there's not an issue. I'm trying to narrow down where the issue is.

applehat commented 4 years ago

Initially I thought I was (was passing dev to oref0-setup) but my loops are reporting they are up to date with Master, so I'm not on dev.

Sorry about that.

On Sat, Oct 3, 2020, 10:48 PM Sarah King notifications@github.com wrote:

After switching to the dev branch of oref0, does this still happen? The fix has only been applied to the dev branch, and I installed 2 rigs this morning without encountering this issue.

I'm not saying there's not an issue. I'm trying to

narrow down where the issue is.

-------- Original Message -------- On Oct 3, 2020, 8:21 PM, Cameron Chunn wrote:

Just as a note, Doing a clean install on latest Raspberry Pi OS following documentation nets this same error still, and the above pip command gets past the error.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openaps/oref0/issues/1377#issuecomment-703197544, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACAC7BLKSP2KKNAJBO6UTLSI7WCTANCNFSM4NQI4D4Q .

renegadeandy commented 4 years ago

Just got stuck with this for about 6 hours this evening. Really can this be merged into master as a priority please?

scottleibrand commented 4 years ago

Are you saying you had this issue with master, but using dev fixed it, and are proposing we do a release of current dev to master to avoid issues for those not otherwise using dev?

old-square-eyes commented 4 years ago

@scottleibrand that's how I read it. 7.0 is due a patch release yeah? If I recall there are quite a few bug fixes.

Foxy7 commented 3 years ago

@scottleibrand. I agree with @old-square-eyes

As i understand it, this remains an issue for installing Master on an Edison. I've put a small PR in the updating Master docs https://github.com/openaps/docs/pull/1563, but not in the main instructions for first time installation.

i can see that the rPi installation instructions were updated at the start of summer which directs users to load Dev. https://github.com/openaps/docs/pull/1547

And installing Dev on Edison works fine following https://github.com/openaps/oref0/pull/1387

ichambon commented 3 years ago

@ekazum I had the same issue and was solved with the same command you have posted: pip install parsedatetime==2.5

I have a RPI Zero w/ Explorer HAT board and started the install from the instance curl -s https://raw.githubusercontent.com/openaps/oref0/master/bin/openaps-install.sh > /tmp/openaps-install.sh && bash /tmp/openaps-install.sh dev

Many thanks

kimberscott commented 3 years ago

Same issue on a Raspberry Pi 0 w/ Explorer HAT, fresh install of master, fixed by installing parsedatetime 2.5.

dfmdmx commented 3 years ago

Same issue on a Raspberry Pi 3 + Explorer HAT, fresh install of master, fixed by installing parsedatetime 2.5.

WKaufman commented 3 years ago

Same issue after reflashing an Edison with Explorer. Found the solution in the Looped Facebook group, but nowhere in the OpenAPS docs.

Xenocide23 commented 3 years ago

Confirming that I ran into this issue as well with a rasberry pi + explorer hat on a fresh install. Using "pip install parsedatetime==2.5" I was able to complete installation. This was following the most recent OpenAPS documentation and using the dev branch.