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

[Poetry 1.1.13] Unable to create virtualenvs #5186

Closed
danieleades opened this issue Feb 11, 2022 · 6 comments
Closed

[Poetry 1.1.13] Unable to create virtualenvs #5186

danieleades opened this issue Feb 11, 2022 · 6 comments
Labels
kind/bug Something isn't working as expected

Comments

@danieleades
Copy link
Contributor

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
@danieleades danieleades added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Feb 11, 2022
@finswimmer
Copy link
Member

Hello @danieleades,

I'm not able to reproduce it.

Looks like your poetry is installed via the deprecated get-poetry.py script. I would recommend uninstalling Poetry and reinstall via install-poetry.py.

fin swimmer

@danieleades
Copy link
Contributor Author

Hello @danieleades,

I'm not able to reproduce it.

Looks like your poetry is installed via the deprecated get-poetry.py script. I would recommend uninstalling Poetry and reinstall via install-poetry.py.

fin swimmer

using the new installer solves it

@Tetfretguru
Copy link

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?

@christopherpickering
Copy link

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

@ShanSanear
Copy link

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

For future reference - this also fixed this issue for me in Windows 10 environment

Copy link

github-actions bot commented Mar 1, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

6 participants