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 ignores virtualenvs.in-project when initialized within a conda environment #4050

Closed
2 of 3 tasks
dmcauslan opened this issue May 7, 2021 · 3 comments
Closed
2 of 3 tasks
Labels
kind/bug Something isn't working as expected

Comments

@dmcauslan
Copy link

dmcauslan commented May 7, 2021

  • 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: macOs 10.15.7

  • Poetry version: 1.1.6

  • Link of a Gist with the contents of your pyproject.toml file:

[tool.poetry]
name = "poetry-envs"
version = "0.1.0"
description = ""
authors = ["Don McAuslan"]

[tool.poetry.dependencies]
python = "^3.8"
requests = "^2.25.1"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

Issue

When creating a new project with poetry init inside an activated conda environment, Poetry will install packages into that environment rather than creating a local virtual env in .venv.

$ poetry --version
Poetry version 1.1.6

$ poetry config --list
cache-dir = "/Users/[my user id]/Library/Caches/pypoetry"
experimental.new-installer = true
installer.parallel = true
virtualenvs.create = true
virtualenvs.in-project = true
virtualenvs.path = "{cache-dir}/virtualenvs"  # /Users/[my user id]/Library/Caches/pypoetry/virtualenv

$ conda create -n py38_poetry python=3.8
... create the environment

$ conda activate py38_poetry

(py38_poetry) $ poetry init
... accept all defaults

(py38_poetry) $ poetry add requests@latest
Using version ^2.25.1 for requests
...

(py38_poetry) $ poetry env info

Virtualenv
Python:         3.8.8
Implementation: CPython
Path:           /usr/local/Caskroom/miniconda/base/envs/py38_poetry
Valid:          True

System
Platform: darwin
OS:       posix
Python:   /usr/local/Caskroom/miniconda/base/envs/py38_poetry

(py38_poetry)  $ poetry run which python
/usr/local/Caskroom/miniconda/base/envs/py38_poetry/bin/python

Since virtualenvs.create and virtualenvs.in-project are both true, I would expect the virtualenv path to be .venv within the current folder rather than /usr/local/Caskroom/miniconda/base/envs/py38_poetry

@dmcauslan dmcauslan added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels May 7, 2021
@mforbes
Copy link

mforbes commented May 10, 2021

I believe this is related to the discussion in issue #1724 and is consistent with the current design of poetry, hence, not a bug. Still, I think it would be useful to be able to turn this feature off somehow.

@finswimmer
Copy link
Member

Hello @dmcauslan,

as @mforbes explained this is the expected behavior. I would suggest you add you reasons why this would be useful to #4055

fin swimmer

@abn abn removed the status/triage This issue needs to be triaged label Mar 3, 2022
Copy link

github-actions bot commented Mar 2, 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 2, 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

4 participants