Skip to content

cannot import name create_environment with virtualenv >= 20 #2093

Closed

Description

@cjw296

Issue

virtualenv 20 was released earlier this month, and looks like CircleCI's images were just rebuilt to use it. So, now, on Python 2, poetry install fails as follows:

circleci@32ce45b8e19b:~/project$ poetry install -v
Creating virtualenv carly-3aSsmiER-py2.7 in /home/circleci/.cache/pypoetry/virtualenvs

[ImportError]
cannot import name create_environment

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/usr/local/lib/python2.7/site-packages/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/usr/local/lib/python2.7/site-packages/clikit/api/command/command.py", line 163, in _do_handle
    self._dispatcher.dispatch(PRE_HANDLE, event)
  File "/usr/local/lib/python2.7/site-packages/clikit/api/event/event_dispatcher.py", line 22, in dispatch
    self._do_dispatch(listeners, event_name, event)
  File "/usr/local/lib/python2.7/site-packages/clikit/api/event/event_dispatcher.py", line 89, in _do_dispatch
    listener(event, event_name, self)
  File "/usr/local/lib/python2.7/site-packages/poetry/console/config/application_config.py", line 89, in set_env
    env = env_manager.create_venv(io)
  File "/usr/local/lib/python2.7/site-packages/poetry/utils/env.py", line 610, in create_venv
    self.build_venv(str(venv), executable=executable)
  File "/usr/local/lib/python2.7/site-packages/poetry/utils/env.py", line 674, in build_venv
    from virtualenv import create_environment

The most pragmatic solution, at this point, is to have poetry pin the virtualenv it uses to <20, or just vendor it, since realistically, it's only going to be used on Python 2, right?

Activity

  1. self-assigned this
    on Feb 27, 2020
  2. finswimmer commented on Feb 27, 2020

    @finswimmer
    Member

    Hey @cjw296,

    could you please test if #2096 fixes this problem?

    fin swimmer

  3. cjw296 commented on Feb 28, 2020

    @cjw296
    Author

    Not easily, how would you recommend I do that?

  4. sdispater commented on Feb 28, 2020

    @sdispater
    Member

    @cjw296 I don't understand how you end up with virtualenv >20 since Poetry restricts the virtualenv version: https://github.com/python-poetry/poetry/blob/master/pyproject.toml#L49. So there must be something wrong with your environment.

  5. Drarok commented on Feb 28, 2020

    @Drarok

    @sdispater I'm also a user of CircleCI and seeing the same issue. CircleCI appear to pre-install poetry on their image, but have also upgraded the system virtualenv to 20. 😕

  6. cjw296 commented on Feb 28, 2020

    @cjw296
    Author
  7. cjw296 commented on Feb 28, 2020

    @cjw296
    Author

    I wonder where pip is coming from and what version it is? Maybe @FelicianoTech can help with this?

  8. cjw296 commented on Feb 28, 2020

    @cjw296
    Author

    Where do we find the docker file for the upstream Python image?

  9. github-actions commented on Mar 3, 2024

    @github-actions

    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.

  10. locked as resolved and limited conversation to collaborators on Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugSomething isn't working as expected

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions