Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Import Error involving Metadata #547

Closed
virati opened this issue Aug 20, 2024 · 1 comment
Closed

[BUG] Import Error involving Metadata #547

virati opened this issue Aug 20, 2024 · 1 comment

Comments

@virati
Copy link

virati commented Aug 20, 2024

Import of pysindy in a Google Colab Notebook (pro) does not work - yields a "ContextualVersionConflict" error.

Reproducing code example:

!pip install pysindy
import pysindy as sindy

Error message:


ContextualVersionConflict Traceback (most recent call last)
in <cell line: 2>()
1 get_ipython().system('pip install pysindy')
----> 2 import pysindy as sindy

5 frames
/usr/local/lib/python3.10/dist-packages/pysindy/init.py in
3
4 try:
----> 5 version = get_distribution(name).version
6 except DistributionNotFound:
7 pass

/usr/local/lib/python3.10/dist-packages/pkg_resources/init.py in get_distribution(dist)
544 dist = Requirement.parse(dist)
545 if isinstance(dist, Requirement):
--> 546 dist = get_provider(dist)
547 if not isinstance(dist, Distribution):
548 raise TypeError("Expected str, Requirement, or Distribution", dist)

/usr/local/lib/python3.10/dist-packages/pkg_resources/init.py in get_provider(moduleOrReq)
427 """Return an IResourceProvider for the named module or requirement"""
428 if isinstance(moduleOrReq, Requirement):
--> 429 return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
430 try:
431 module = sys.modules[moduleOrReq]

/usr/local/lib/python3.10/dist-packages/pkg_resources/init.py in require(self, *requirements)
1064 included, even if they were already activated in this working set.
1065 """
-> 1066 needed = self.resolve(parse_requirements(requirements))
1067
1068 for dist in needed:

/usr/local/lib/python3.10/dist-packages/pkg_resources/init.py in resolve(self, requirements, env, installer, replace_conflicting, extras)
891 continue
892
--> 893 dist = self._resolve_dist(
894 req, best, replace_conflicting, env, installer, required_by, to_activate
895 )

/usr/local/lib/python3.10/dist-packages/pkg_resources/init.py in _resolve_dist(self, req, best, replace_conflicting, env, installer, required_by, to_activate)
937 # Oops, the "best" so far conflicts with a dependency
938 dependent_req = required_by[req]
--> 939 raise VersionConflict(dist, req).with_context(dependent_req)
940 return dist
941

ContextualVersionConflict: (importlib-metadata 8.2.0 (/usr/local/lib/python3.10/dist-packages), Requirement.parse('importlib-metadata<8.0.0,>=7.1.0'), {'derivative'})

PySINDy/Python version information:

pysindy-1.7.5-py3

Jacob-Stevens-Haas added a commit to andgoldschmidt/derivative that referenced this issue Aug 26, 2024
This package is a backport of part of the core library in 3.10, so
is extremely stable.  It will no longer be required in a year,
when 3.9 reaches EOL.  In the meantime, it is causing plenty of
failures of pysindy installs.  See dynamicslab/pysindy#547 and
coments on dynamicslab/pysindy#529.
@Jacob-Stevens-Haas
Copy link
Member

Jacob-Stevens-Haas commented Aug 27, 2024

See the linked PR in derivative

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants