Stanford-NavLab / gnss_lib_py

Modular Python tool for parsing, analyzing, and visualizing Global Navigation Satellite Systems (GNSS) data and state estimates
MIT License
130 stars 33 forks source link

importlib.metadata.PackageNotFoundError: No package metadata was found for gnss-lib-py #160

Open mikehb opened 5 months ago

mikehb commented 5 months ago

Describe the bug "poetry run pytest" reports package metadata not found

To Reproduce Steps to reproduce the behavior:

  1. git clones the gnss_lib_py repository;
  2. run poetry run pytest

Expected behavior Could execute the test scripts

Screenshots [mikehuang@localhost gnss_lib_py-1.0.2]$ poetry run pytest Creating virtualenv gnss-lib-py-7gV7y9ay-py3.11 in /home/mikehuang/.cache/pypoetry/virtualenvs ImportError while loading conftest '/home/mikehuang/Downloads/gnss_lib_py-1.0.2/tests/conftest.py'. tests/conftest.py:14: in from gnss_lib_py.navdata.navdata import NavData gnss_lib_py/init.py:39: in version = metadata.version("gnss-lib-py") E importlib.metadata.PackageNotFoundError: No package metadata was found for gnss-lib-py [mikehuang@localhost gnss_lib_py-1.0.2]$

System Information (please complete the following information):

Additional context

betaBison commented 5 months ago

Were you following the "Developer Installation" instructions here? https://gnss-lib-py.readthedocs.io/en/latest/install.html

Did you have any errors when installing gnss_lib_py with poetry install after you cloned the repository ?

When you run the poetry install command you should see a print statement that says gnss_lib_py was installed.

mikehb commented 5 months ago

poetry install -r requirements.txt reports following errors at the end.

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
google-auth 2.22.0 requires urllib3<2.0, but you have urllib3 2.1.0 which is incompatible.
Successfully installed anyio-4.2.0 argon2-cffi-23.1.0 argon2-cffi-bindings-21.2.0 arrow-1.3.0 asttokens-2.4.1 async-lru-2.0.4 babel-2.14.0 beautifulsoup4-4.12.3 certifi-2023.11.17 cffi-1.16.0 comm-0.2.1 contourpy-1.1.1 cycler-0.12.1 debugpy-1.8.0 defusedxml-0.7.1 executing-2.0.1 fastjsonschema-2.19.1 fonttools-4.47.2 fqdn-1.5.1 georinex-1.16.1 importlib-resources-6.1.1 ipykernel-6.29.0 ipython-8.12.3 ipywidgets-8.1.1 isoduration-20.11.0 jedi-0.19.1 json5-0.9.14 jsonpointer-2.4 jsonschema-4.21.1 jsonschema-specifications-2023.12.1 jupyter-1.0.0 jupyter-client-8.6.0 jupyter-console-6.6.3 jupyter-core-5.7.1 jupyter-events-0.9.0 jupyter-lsp-2.2.2 jupyter-server-2.12.5 jupyter-server-terminals-0.5.1 jupyterlab-4.0.11 jupyterlab-pygments-0.3.0 jupyterlab-server-2.25.2 jupyterlab-widgets-3.0.9 kaleido-0.2.1 markupsafe-2.1.3 matplotlib-3.7.4 mistune-3.0.2 nbclient-0.9.0 nbconvert-7.14.2 nbformat-5.9.2 ncompress-1.0.1 nest-asyncio-1.5.9 notebook-7.0.7 notebook-shim-0.2.3 numpy-1.24.4 overrides-7.4.0 packaging-23.2 pandas-2.0.3 pandocfilters-1.5.1 pillow-10.2.0 platformdirs-4.1.0 plotly-5.18.0 pluggy-1.3.0 prometheus-client-0.19.0 prompt-toolkit-3.0.43 pycparser-2.21 pygments-2.17.2 pyparsing-3.1.1 pytest-7.4.4 python-dateutil-2.8.2 python-json-logger-2.0.7 pytz-2023.3.post1 pyzmq-25.1.2 qtconsole-5.5.1 qtpy-2.4.1 referencing-0.32.1 rfc3339-validator-0.1.4 rfc3986-validator-0.1.1 rpds-py-0.17.1 scipy-1.10.1 send2trash-1.8.2 sniffio-1.3.0 soupsieve-2.5 stack-data-0.6.3 terminado-0.18.0 tinycss2-1.2.1 tornado-6.4 traitlets-5.14.1 types-python-dateutil-2.8.19.20240106 tzdata-2023.4 uri-template-1.3.0 urllib3-2.1.0 wcwidth-0.2.13 webcolors-1.13 websocket-client-1.7.0 widgetsnbextension-4.0.9 xarray-2023.1.0

After commenting the last line of gnss_lib_py/init.py, poetry run pytest works for me,

# single location of version exists in pyproject.toml
# __version__ = metadata.version("gnss-lib-py")
betaBison commented 5 months ago

Hi again, @mikehb I'll need some additional information to be able to help you.

It sounds like you may be interchanging installing with pip vs. poetry and switching between the "Standard Installation" and "Developer Installation" on our Installation page guide.

In the latest poetry, poetry install -r requirements.txt is not valid command. Were you running pip install -r requirements.txt? For the developer installation, the correct installation command is simply running poetry install in the gnss_lib_py directory as shown in the image below: image

The error you sent indicates an incompatibility between the version of urllib3 that gnss-lib-py requires and that google-auth 2.22.0 requires. gnss-lib-py has no dependency on google-auth so I'm guessing you're trying to install both packages into the same environment which is causing the problems.

You could try to remedy the issue by either

  1. following our developer instructions which use pyenv to isolate gnss-lib-py in its own virtual environment
  2. google-auth may have happend to update their dependencies which you could check by upgrading google-auth with pip install --upgrade google-auth then removing gnss-lib-py with pip uninstall gnss_lib_py and starting the installation process again

I was able to install the latest versions of both google-auth and gnss_lib_py without any issues on my computer, so I don't know how else to replicate your problem.

I hope this helps.