Skip to content

Poetry not using specified virtual environment  #6141

@TNonet

Description

@TNonet
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name:
>>>cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.4 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
  • Poetry version: 1.1.14
  • Link of a Gist with the contents of your pyproject.toml file:

Issue

Poetry seems to use a different python version when installing packages than specified in the install output:

poetry install -vvv
The currently activated Python version 3.10.6 is not supported by the project (>=3.9,<3.10).
Trying to find and use a compatible version.
Trying python3
Using python3 (3.9.13)
Creating virtualenv [PACKAGE]-rMAC0O7B-py3.9 in /home/circleci/.cache/pypoetry/virtualenvs
Using virtualenv: /home/circleci/.cache/pypoetry/virtualenvs/[PACKAGE]-rMAC0O7B-py3.9
Installing dependencies from lock file

Finding the necessary packages for the current system

  Stack trace:

  8  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/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

  7  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/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():

  6  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/clikit/api/command/command.py:171 in _do_handle
      169│         handler_method = self._config.handler_method
      170│
    → 171│         return getattr(handler, handler_method)(args, io, self)
      172│
      173│     def __repr__(self):  # type: () -> str

  5  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cleo/commands/command.py:92 in wrap_handle
       90│         self._command = command
       91│
    →  92│         return self.handle()
       93│
       94│     def handle(self):  # type: () -> Optional[int]

  4  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/console/commands/install.py:71 in handle
       69│         self._installer.verbose(self._io.is_verbose())
       70│
    →  71│         return_code = self._installer.run()
       72│
       73│         if return_code != 0:

  3  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/installer.py:103 in run
      101│         local_repo = Repository()
      102│
    → 103│         return self._do_install(local_repo)
      104│
      105│     def dry_run(self, dry_run=True):  # type: (bool) -> Installer

  2  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/installer.py:305 in _do_install
      303│
      304│         with solver.use_environment(self._env):
    → 305│             ops = solver.solve(use_latest=self._whitelist)
      306│
      307│         # We need to filter operations so that packages

  1  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/puzzle/solver.py:65 in solve
       63│         with self._provider.progress():
       64│             start = time.time()
    →  65│             packages, depths = self._solve(use_latest=use_latest)
       66│             end = time.time()
       67│

  SolverProblemError

  The current project's Python requirement (3.10.6) is not compatible with some of the required packages Python requirement:
    - tfcausalimpact requires Python >=3, <3.10, so it will not be satisfied for Python 3.10.6

  Because tfcausalimpact (0.0.9) requires Python >=3, <3.10
   and no versions of tfcausalimpact match >0.0.9,<0.0.10, tfcausalimpact is forbidden.
  So, because [PACKAGE] depends on tfcausalimpact (^0.0.9), version solving failed.

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/puzzle/solver.py:241 in _solve
      237│             packages = result.packages
      238│         except OverrideNeeded as e:
      239│             return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
      240│         except SolveFailure as e:
    → 241│             raise SolverProblemError(e)
      242│
      243│         results = dict(
      244│             depth_first_search(
      245│                 PackageNode(self._package, packages), aggregate_package_nodes

  • Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties

    For tfcausalimpact, a possible solution would be to set the `python` property to "<empty>"

    https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies,
    https://python-poetry.org/docs/dependency-specification/#using-environment-markers

Poetry claims to use Using python3 (3.9.13), but when installing, it uses the 3.10.6 python.

  system
* 3.9.13 (set by /home/circleci/.pyenv/version)
  3.10.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expectedstatus/triageThis issue needs to be triagedstatus/waiting-on-responseWaiting on response from author

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions