iiif-prezi / iiif-prezi3

IIIF Presentation API 3 Python Library
https://iiif-prezi.github.io/iiif-prezi3/
Apache License 2.0
28 stars 14 forks source link

Importing fails! #102

Closed digitaldogsbody closed 1 year ago

digitaldogsbody commented 1 year ago

You can install the project from PyPi (or locally), but when you try to use it, it fails out on an error related to relative pathing:

mike@revelator:~/projects$ python -m venv ptest
mike@revelator:~/projects$ source ptest/bin/activate
(ptest) mike@revelator:~/projects$ pip install iiif-prezi3
Collecting iiif-prezi3
  Downloading iiif_prezi3-0.0.4-py3-none-any.whl (23 kB)
Collecting requests<3.0.0,>=2.28.0
  Using cached requests-2.28.1-py3-none-any.whl (62 kB)
Collecting pydantic<2.0.0,>=1.9.2
  Using cached pydantic-1.10.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.6 MB)
Collecting Pillow<10.0.0,>=9.1.1
  Using cached Pillow-9.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB)
Collecting urllib3<1.27,>=1.21.1
  Using cached urllib3-1.26.12-py2.py3-none-any.whl (140 kB)
Collecting charset-normalizer<3,>=2
  Using cached charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
Collecting idna<4,>=2.5
  Using cached idna-3.4-py3-none-any.whl (61 kB)
Collecting certifi>=2017.4.17
  Using cached certifi-2022.9.24-py3-none-any.whl (161 kB)
Collecting typing-extensions>=4.1.0
  Using cached typing_extensions-4.4.0-py3-none-any.whl (26 kB)
Installing collected packages: urllib3, charset-normalizer, idna, certifi, requests, typing-extensions, pydantic, Pillow, iiif-prezi3
Successfully installed Pillow-9.3.0 certifi-2022.9.24 charset-normalizer-2.1.1 idna-3.4 iiif-prezi3-0.0.4 pydantic-1.10.2 requests-2.28.1 typing-extensions-4.4.0 urllib3-1.26.12
(ptest) mike@revelator:~/projects$ python
Python 3.8.10 (default, Jun 22 2022, 20:18:18) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import iiif_prezi3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/mike/projects/ptest/lib/python3.8/site-packages/iiif_prezi3/__init__.py", line 1, in <module>
    from iiif_prezi3.helpers import *  # noqa: F401,F403
  File "/home/mike/projects/ptest/lib/python3.8/site-packages/iiif_prezi3/helpers/__init__.py", line 2, in <module>
    from .add_label import AddLabel  # noqa: F401
  File "/home/mike/projects/ptest/lib/python3.8/site-packages/iiif_prezi3/helpers/add_label.py", line 1, in <module>
    from ..config import configs
ImportError: cannot import name 'configs' from 'iiif_prezi3.config' (unknown location)
>>> 

The file exists in that relative path in the repo, but I think it might not be being installed by the package because it is not listed in the packages key in setup.py:

packages=['iiif_prezi3', 'iiif_prezi3.helpers', 'iiif_prezi3.extensions'],
digitaldogsbody commented 1 year ago

A quick change locally to add the config dir seems to confirm that it fixes the issue - PR incoming