0

I've been using pyenv and my own module for years. Giving 3.10.6 a try and things break.

The following works (new install today - runbook is my own code):

pyenv install 3.9.13
pyenv shell 3.9.13
pip install -e ~/code/runbook
runbook -h

When I do the same for 3.10.6 the first 3 steps appear to work fine, but the last fails.

pyenv install 3.10.6
pyenv shell 3.10.6
pip install -e ~/code/runbook
runbook -h

The failure seems to be in the pyenv wrapper script:

$ runbook -h 
Traceback (most recent call last):
  File "<path>/.pyenv/versions/3.10.6/bin/runbook", line 33, in <module>
    sys.exit(load_entry_point('runbook', 'console_scripts', 'runbook')())
  File "<path>/.pyenv/versions/3.10.6/bin/runbook", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "<path>/.pyenv/versions/3.10.6/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "<path>/.pyenv/versions/3.10.6/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'runbook'

I see some similar reports, like this, but no solution. FWIW, I'm on a Mac, but an older Mac, not M1/M2.

Brett Stottlemyer
  • 2,734
  • 4
  • 26
  • 38

1 Answers1

0

I was able to fix this by updating my module's setup.py and adding a packages value to the setup call.

from setuptools import setup
setup(
    name='runbook',
    version='1.0.0',
    packages=['src'],
    entry_points={
        'console_scripts': [
            'runbook=runbook:main'
        ]
    }
)

Without the packages line, any import failed.

Brett Stottlemyer
  • 2,734
  • 4
  • 26
  • 38