question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Poetry 1.1.13] Unable to create virtualenvs

See original GitHub issue

running into some issues creating virtual environments after updating to 1.1.13

poetry update -vvv                                                                                                                                                                                                          
Creating virtualenv my_cool_project in /path/to/project/.venv

  Stack trace:

  19  ~/.poetry/lib/poetry/_vendor/py3.9/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

  18  ~/.poetry/lib/poetry/_vendor/py3.9/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():

  17  ~/.poetry/lib/poetry/_vendor/py3.9/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():

  16  ~/.poetry/lib/poetry/_vendor/py3.9/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

  15  ~/.poetry/lib/poetry/_vendor/py3.9/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

  14  ~/.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():

  13  ~/.poetry/lib/poetry/utils/env.py:794 in create_venv
        792β”‚             )
        793β”‚ 
     β†’  794β”‚             self.build_venv(venv, executable=executable)
        795β”‚         else:
        796β”‚             if force:

  12  ~/.poetry/lib/poetry/utils/env.py:835 in build_venv
        833β”‚         if isinstance(executable, Path):
        834β”‚             executable = executable.resolve().as_posix()
     β†’  835β”‚         return virtualenv.cli_run(
        836β”‚             [
        837β”‚                 "--no-download",

  11  ~/.poetry/lib/poetry/_vendor/py3.9/virtualenv/run/__init__.py:30 in cli_run
        28β”‚     """
        29β”‚     env = os.environ if env is None else env
     β†’  30β”‚     of_session = session_via_cli(args, options, setup_logging, env)
        31β”‚     with of_session:
        32β”‚         of_session.run()

  10  ~/.poetry/lib/poetry/_vendor/py3.9/virtualenv/run/__init__.py:48 in session_via_cli
        46β”‚     """
        47β”‚     env = os.environ if env is None else env
     β†’  48β”‚     parser, elements = build_parser(args, options, setup_logging, env)
        49β”‚     options = parser.parse_args(args)
        50β”‚     creator, seeder, activators = tuple(e.create(options) for e in elements)  # create types

   9  ~/.poetry/lib/poetry/_vendor/py3.9/virtualenv/run/__init__.py:76 in build_parser
        74β”‚         CreatorSelector(interpreter, parser),
        75β”‚         SeederSelector(interpreter, parser),
     β†’  76β”‚         ActivationSelector(interpreter, parser),
        77β”‚     ]
        78β”‚     options, _ = parser.parse_known_args(args)

   8  ~/.poetry/lib/poetry/_vendor/py3.9/virtualenv/run/plugin/activators.py:13 in __init__
       11β”‚         self.default = None
       12β”‚         possible = OrderedDict(
     β†’ 13β”‚             (k, v) for k, v in self.options("virtualenv.activate").items() if v.supports(interpreter)
       14β”‚         )
       15β”‚         super(ActivationSelector, self).__init__(interpreter, parser, "activators", possible)

   7  ~/.poetry/lib/poetry/_vendor/py3.9/virtualenv/run/plugin/base.py:46 in options
       44β”‚     def options(cls, key):
       45β”‚         if cls._OPTIONS is None:
     β†’ 46β”‚             cls._OPTIONS = cls.entry_points_for(key)
       47β”‚         return cls._OPTIONS
       48β”‚ 

   6  ~/.poetry/lib/poetry/_vendor/py3.9/virtualenv/run/plugin/base.py:25 in entry_points_for
       23β”‚             return OrderedDict((e.name, e.load()) for e in cls.entry_points().select(group=key))
       24β”‚         else:
     β†’ 25β”‚             return OrderedDict((e.name, e.load()) for e in cls.entry_points().get(key, {}))
       26β”‚ 
       27β”‚     @staticmethod

   5  ~/.poetry/lib/poetry/_vendor/py3.9/virtualenv/run/plugin/base.py:25 in <genexpr>
       23β”‚             return OrderedDict((e.name, e.load()) for e in cls.entry_points().select(group=key))
       24β”‚         else:
     β†’ 25β”‚             return OrderedDict((e.name, e.load()) for e in cls.entry_points().get(key, {}))
       26β”‚ 
       27β”‚     @staticmethod

   4  /usr/lib/python3.9/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)

   3  /usr/lib/python3.9/importlib/__init__.py:127 in import_module
       125β”‚                 break
       126β”‚             level += 1
     β†’ 127β”‚     return _bootstrap._gcd_import(name[level:], package, level)
       128β”‚ 
       129β”‚ 

   2  <frozen importlib._bootstrap>:1030 in _gcd_import

   1  <frozen importlib._bootstrap>:1007 in _find_and_load

  ModuleNotFoundError

  No module named 'virtualenv.activation.xonsh'

  at <frozen importlib._bootstrap>:984 in _find_and_load_unlocked

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

12reactions
christopherpickeringcommented, Mar 9, 2022

Doing pip uninstall virtualenv in the base python env that poetry is using seems to fix this.

4reactions
Tetfretgurucommented, Mar 9, 2022

Hi, I just installed using install-poetry,py script and still having the same issue.

  ModuleNotFoundError

  No module named 'virtualenv.activation.xonsh'

  at <frozen importlib._bootstrap>:973 in _find_and_load_unlocked

Any idea?

Read more comments on GitHub >

github_iconTop Results From Across the Web

The virtual environment found seems to be broken | python ...
sudo apt-get install python3.7-venv. Other way is to disable virtual environment poetry config virtualenvs.create false.
Read more >
Introduction | Documentation | Poetry - Python dependency ...
Introduction Poetry is a tool for dependency management and packaging in Python. It allows you to declare the libraries your project depends on...
Read more >
poetry 1.1.13 - PyPI
Poetry : Dependency Management for Python. Poetry helps you declare, manage and install dependencies of Python projects, ensuring you have the right stackΒ ......
Read more >
Django setup in 2022 with pyenv + Poetry on macOS - Medium
Alternatively you can use virtualenvs with pip freeze, but poetry uses a virtualenv under the hood and I find the poetry features includingΒ ......
Read more >
Announcing Poetry 1.2.0 -- Python dependency management ...
This is up there with those npm packages that intentionally fail on ... It's one line in poetry.toml and venv will be created...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found