oref0 icon indicating copy to clipboard operation
oref0 copied to clipboard

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

Open PieterGit opened this issue 4 years ago • 23 comments

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 avatar Jun 02 '20 01:06 PieterGit

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 avatar Jun 02 '20 01:06 PieterGit

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.

PieterGit avatar Jun 02 '20 10:06 PieterGit

@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

ekazum avatar Jun 09 '20 09:06 ekazum

@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.

yduncan avatar Jul 24 '20 23:07 yduncan

@yduncan Just run: pip install parsedatetime==2.5

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

ekazum avatar Jul 25 '20 10:07 ekazum

@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 avatar Jul 25 '20 14:07 yduncan

@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.

tnharvey avatar Aug 27 '20 17:08 tnharvey

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 avatar Aug 30 '20 05:08 old-square-eyes

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.

old-square-eyes avatar Sep 07 '20 00:09 old-square-eyes

Submitted a PR that fixes this in dev.

sksksksksksksk avatar Sep 18 '20 04:09 sksksksksksksk

Thanks. Merged it.

scottleibrand avatar Sep 18 '20 21:09 scottleibrand

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.

applehat avatar Oct 04 '20 01:10 applehat

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.

sksksksksksksk avatar Oct 04 '20 03:10 sksksksksksksk

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 [email protected] 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 .

applehat avatar Oct 04 '20 03:10 applehat

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

renegadeandy avatar Nov 11 '20 20:11 renegadeandy

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?

scottleibrand avatar Nov 12 '20 00:11 scottleibrand

@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.

old-square-eyes avatar Nov 12 '20 02:11 old-square-eyes

@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

Foxy7 avatar Nov 16 '20 14:11 Foxy7

@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

ichambon avatar Jan 03 '21 20:01 ichambon

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

kimberscott avatar Jan 16 '21 20:01 kimberscott

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

dfmdmx avatar Jan 29 '21 22:01 dfmdmx

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

WKaufman avatar Feb 13 '21 18:02 WKaufman

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.

Xenocide23 avatar Mar 05 '21 05:03 Xenocide23