Friday 19 March 2021

"RuntimeError: invalid slot offset" on trying to run python package

I use the pyhyphen package for a script I run all the time. Recently, I updated to MacOS Big Sur. Spyder was laggy, but I fixed that by running a virtual environment and pip installing what I needed. No issues.

Now, when I try to run from hyphen import Hyphenator (here is the package page), I get the following error:

[autoreload of hyphen.dictools failed: Traceback (most recent call last):
  File "/Users/myname/anaconda3/lib/python3.8/site-packages/IPython/extensions/autoreload.py", line 245, in check
    superreload(m, reload, self.old_objects)
  File "/Users/myname/anaconda3/lib/python3.8/site-packages/IPython/extensions/autoreload.py", line 394, in superreload
    module = reload(module)
  File "/Users/myname/anaconda3/lib/python3.8/imp.py", line 314, in reload
    return importlib.reload(module)
  File "/Users/myname/anaconda3/lib/python3.8/importlib/__init__.py", line 159, in reload
    raise ImportError(msg.format(parent_name),
ImportError: parent 'hyphen' not in sys.modules
]


runcell(0, '/Users/myname/Documents/project/project.py')
Traceback (most recent call last):

  File "/Users/myname/Documents/project/project.py", line 17, in <module>
    from hyphen import Hyphenator

  File "/Users/myname/anaconda3/lib/python3.8/site-packages/hyphen/__init__.py", line 10, in <module>
    from .hyphenator import Hyphenator

  File "/Users/myname/anaconda3/lib/python3.8/site-packages/hyphen/hyphenator.py", line 27, in <module>
    from . import hnj

RuntimeError: invalid slot offset

The from hyphen import Hyphenator is the only line in the script. I've tried uninstalling/reinstalling the package six hundred times - and I cannot find any kind of solution for invalid slot offset. All other packages import fine, no issues.

Spyder (in Anaconda) is running python version 3.8.5. I have non-anaconda 3.9 installed, but I can't imagine that has any effect since I'm running spyder in a virtual environment.



from "RuntimeError: invalid slot offset" on trying to run python package

No comments:

Post a Comment