profile
viewpoint

Ask questionspoetry env use python3.7 gives error No module named 'virtualenv.seed.via_app_data'

Hi,

I found issue on poetry 1.0.10 when I run poetry env use python3.7 as follows:

Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'PosixPath' is not defined

So I tried to upgrade to poetry preview version by:

poetry self update --preview ∞ Updating to 1.1.0b4

  • Downloading poetry-1.1.0b4-darwin.tar.gz 100%

Then I tried to execute poetry env use python3.7, now I am getting a different error:

ModuleNotFoundError

No module named 'virtualenv.seed.via_app_data'

at <frozen importlib._bootstrap>:973 in _find_and_load_unlocked

  • OS version and name: MacOS Mojave
  • Poetry version: 1.1.0b4

Any help is really appreciated. Please let me know if anymore information is needed.

python-poetry/poetry

Answer questions zoopp

I experience this issue with Python 3.8.5 as well (when running poetry install). I'll attach the stack trace in case it's relevant:

 Stack trace:

  23  ~/.poetry/lib/poetry/_vendor/py3.8/clikit/console_application.py:131 in run
       129│             parsed_args = resolved_command.args
       130│ 
     → 131│             status_code = command.handle(parsed_args, io)
       132│         except KeyboardInterrupt:
       133│             status_code = 1

  22  ~/.poetry/lib/poetry/_vendor/py3.8/clikit/api/command/command.py:120 in handle
       118│     def handle(self, args, io):  # type: (Args, IO) -> int
       119│         try:
     → 120│             status_code = self._do_handle(args, io)
       121│         except KeyboardInterrupt:
       122│             if io.is_debug():

  21  ~/.poetry/lib/poetry/_vendor/py3.8/clikit/api/command/command.py:163 in _do_handle
       161│         if self._dispatcher and self._dispatcher.has_listeners(PRE_HANDLE):
       162│             event = PreHandleEvent(args, io, self)
     → 163│             self._dispatcher.dispatch(PRE_HANDLE, event)
       164│ 
       165│             if event.is_handled():

  20  ~/.poetry/lib/poetry/_vendor/py3.8/clikit/api/event/event_dispatcher.py:22 in dispatch
        20│ 
        21│         if listeners:
     →  22│             self._do_dispatch(listeners, event_name, event)
        23│ 
        24│         return event

  19  ~/.poetry/lib/poetry/_vendor/py3.8/clikit/api/event/event_dispatcher.py:89 in _do_dispatch
        87│                 break
        88│ 
     →  89│             listener(event, event_name, self)
        90│ 
        91│     def _sort_listeners(self, event_name):  # type: (str) -> None

  18  ~/.poetry/lib/poetry/console/config/application_config.py:119 in set_env
       117│ 
       118│         env_manager = EnvManager(poetry)
     → 119│         env = env_manager.create_venv(io)
       120│ 
       121│         if env.is_venv() and io.is_verbose():

  17  ~/.poetry/lib/poetry/utils/env.py:645 in create_venv
        643│             )
        644│ 
     →  645│             self.build_venv(venv, executable=executable)
        646│         else:
        647│             if force:

  16  ~/.poetry/lib/poetry/utils/env.py:686 in build_venv
        684│         if isinstance(executable, Path):
        685│             executable = executable.resolve().as_posix()
     →  686│         return virtualenv.cli_run(
        687│             [
        688│                 "--no-download",

  15  ~/.poetry/lib/poetry/_vendor/py3.8/virtualenv/run/__init__.py:26 in cli_run
        24│     :return: the session object of the creation (its structure for now is experimental and might change on short notice)
        25│     """
     →  26│     of_session = session_via_cli(args, options, setup_logging)
        27│     with of_session:
        28│         of_session.run()

  14  ~/.poetry/lib/poetry/_vendor/py3.8/virtualenv/run/__init__.py:42 in session_via_cli
        40│     :return: the session object of the creation (its structure for now is experimental and might change on short notice)
        41│     """
     →  42│     parser, elements = build_parser(args, options, setup_logging)
        43│     options = parser.parse_args(args)
        44│     creator, seeder, activators = tuple(e.create(options) for e in elements)  # create types

  13  ~/.poetry/lib/poetry/_vendor/py3.8/virtualenv/run/__init__.py:69 in build_parser
        67│     elements = [
        68│         CreatorSelector(interpreter, parser),
     →  69│         SeederSelector(interpreter, parser),
        70│         ActivationSelector(interpreter, parser),
        71│     ]

  12  ~/.poetry/lib/poetry/_vendor/py3.8/virtualenv/run/plugin/seeders.py:8 in __init__
        6│ class SeederSelector(ComponentBuilder):
        7│     def __init__(self, interpreter, parser):
     →  8│         possible = self.options("virtualenv.seed")
        9│         super(SeederSelector, self).__init__(interpreter, parser, "seeder", possible)
       10│ 

  11  ~/.poetry/lib/poetry/_vendor/py3.8/virtualenv/run/plugin/base.py:39 in options
       37│     def options(cls, key):
       38│         if cls._OPTIONS is None:
     → 39│             cls._OPTIONS = cls.entry_points_for(key)
       40│         return cls._OPTIONS
       41│ 

  10  ~/.poetry/lib/poetry/_vendor/py3.8/virtualenv/run/plugin/base.py:18 in entry_points_for
       16│     @classmethod
       17│     def entry_points_for(cls, key):
     → 18│         return OrderedDict((e.name, e.load()) for e in cls.entry_points().get(key, {}))
       19│ 
       20│     @staticmethod

   9  ~/.poetry/lib/poetry/_vendor/py3.8/virtualenv/run/plugin/base.py:18 in <genexpr>
       16│     @classmethod
       17│     def entry_points_for(cls, key):
     → 18│         return OrderedDict((e.name, e.load()) for e in cls.entry_points().get(key, {}))
       19│ 
       20│     @staticmethod

   8  /usr/lib/python3.8/importlib/metadata.py:77 in load
        75│         """
        76│         match = self.pattern.match(self.value)
     →  77│         module = import_module(match.group('module'))
        78│         attrs = filter(None, (match.group('attr') or '').split('.'))
        79│         return functools.reduce(getattr, attrs, module)

   7  /usr/lib/python3.8/importlib/__init__.py:127 in import_module
       125│                 break
       126│             level += 1
     → 127│     return _bootstrap._gcd_import(name[level:], package, level)
       128│ 
       129│ 

   6  <frozen importlib._bootstrap>:1014 in _gcd_import

   5  <frozen importlib._bootstrap>:991 in _find_and_load

   4  <frozen importlib._bootstrap>:961 in _find_and_load_unlocked

   3  <frozen importlib._bootstrap>:219 in _call_with_frames_removed

   2  <frozen importlib._bootstrap>:1014 in _gcd_import

   1  <frozen importlib._bootstrap>:991 in _find_and_load

  ModuleNotFoundError

  No module named 'virtualenv.seed.via_app_data'

  at <frozen importlib._bootstrap>:973 in _find_and_load_unlocked

I've been iterating stable release versions backwards starting from v1.1.2 and the latest one in which this doesn't happen is 1.0.10.

useful!
source:https://uonfu.com/
Github User Rank List