Problem with package import
serjisa opened this issue · comments
Hi!
When I'm trying to import schema
, a problem occurs:
KeyError Traceback (most recent call last)
File ~/miniconda3/envs/scrna-seq/lib/python3.10/pkgutil.py:417, in get_importer(path_item)
416 try:
--> 417 importer = sys.path_importer_cache[path_item]
418 except KeyError:
KeyError: PosixPath('/home/sisaev/miniconda3/envs/scrna-seq/lib/python3.10/site-packages/schema')
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
Input In [2], in <cell line: 1>()
----> 1 import schema
File ~/miniconda3/envs/scrna-seq/lib/python3.10/site-packages/schema/__init__.py:18, in <module>
10 # from pkgutil import iter_modules
11 # from pathlib import Path
12 # from importlib import import_module
(...)
15 # iterate through the modules in the current package
16 #
17 package_dir = pathlib.Path(__file__).resolve().parent
---> 18 for (_, module_name, _) in pkgutil.iter_modules([package_dir]):
19 if 'datasets' in module_name:
20 module = importlib.import_module(f"{__name__}.{module_name}")
File ~/miniconda3/envs/scrna-seq/lib/python3.10/pkgutil.py:129, in iter_modules(path, prefix)
126 importers = map(get_importer, path)
128 yielded = {}
--> 129 for i in importers:
130 for name, ispkg in iter_importer_modules(i, prefix):
131 if name not in yielded:
File ~/miniconda3/envs/scrna-seq/lib/python3.10/pkgutil.py:421, in get_importer(path_item)
419 for path_hook in sys.path_hooks:
420 try:
--> 421 importer = path_hook(path_item)
422 sys.path_importer_cache.setdefault(path_item, importer)
423 break
File <frozen importlib._bootstrap_external>:1632, in path_hook_for_FileFinder(path)
File <frozen importlib._bootstrap_external>:1504, in __init__(self, path, *loader_details)
File <frozen importlib._bootstrap_external>:182, in _path_isabs(path)
AttributeError: 'PosixPath' object has no attribute 'startswith'
Could you please help me? I use Python 3.10.
Hi, I'm taking a look at it now. I hadn't tested with 3.10 so that might be the issue. will keep you posted. If you can, can you pls report if you see issues with Python 3.8 too?
It seems that it works with Python 3.8 and also with Python 3.9.
Please try installing the updated release 0.1.5.4 ("pip install schema_learn==0.1.5.4")? There was an issue in one of the standard library packages with Python 3.10 and I put in a workaround for it.
I can't install this version even with other Python versions. Look at the Google Colab (I have the same issue while using the server): https://colab.research.google.com/drive/1yl92rNW1-Jj06WrSmYGcZy85cClwouln?usp=sharing
yikes! i did a fresh release from scratch. Pls try 0.1.5.5 ? "pip install schema_learn==0.1.5.5"
Woohoo, it works! Thank you so much :)
Thanks for your patience and the bug report!