Skip to content

20230228 import pykern error #339

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

Closed
robnagler opened this issue Jan 31, 2023 · 4 comments
Closed

20230228 import pykern error #339

robnagler opened this issue Jan 31, 2023 · 4 comments

Comments

@robnagler
Copy link
Member

import pykern yields:

Traceback (most recent call last):
  File "t.py", line 1, in <module>
    import pykern
  File "/home/vagrant/src/radiasoft/pykern/pykern/__init__.py", line 8, in <module>
    import pkg_resources
  File "/home/vagrant/.pyenv/versions/py3/lib/python3.7/site-packages/pkg_resources/__init__.py", line 84, in <module>
    __import__('pkg_resources.extern.packaging.requirements')
  File "/home/vagrant/.pyenv/versions/py3/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 10, in <module>
    from pkg_resources.extern.pyparsing import (  # noqa
  File "/home/vagrant/.pyenv/versions/py3/lib/python3.7/site-packages/pkg_resources/extern/__init__.py", line 52, in create_module
    return self.load_module(spec.name)
  File "/home/vagrant/.pyenv/versions/py3/lib/python3.7/site-packages/pkg_resources/extern/__init__.py", line 48, in load_module
    "distribution.".format(**locals())
ImportError: The 'pyparsing' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.
@e-carlin
Copy link
Contributor

I've seen this before. I believe an uninstall of pykern and installing again "fixes" the problem.

I have a hunch that installing some other package that we use is causing this problem. No data to back this up other than I've seen this appear after installing "things".

@robnagler
Copy link
Member Author

I'll debug a little today then since my install is messed up.

@robnagler
Copy link
Member Author

It's a stupid problem. It's based on the fact that python puts "." in the path automatically so that "html" gets found. The error is obscured here:

            except ImportError:
                pass
        else:
            raise ImportError(
                "The '{target}' package is required; "
                "normally this is bundled with this package so if you get "
                "this warning, consult the packager of your "
                "distribution.".format(**locals())
            )

pyparsing imports html. sirepo.html exists and I was running "t.py" in sirepo/sirepo/. #204 will fix this.

@e-carlin
Copy link
Contributor

How many times will that "feature" bite us...

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