pw_machine_vision
pw_machine_vision

Reputation: 95

poetry install doesnt create .env folder inside project folder with Anaconda python 3.9 env

I have anaconda 3.8 on windows 10. I created python3.9 virtual environment and set poetry config virtualenvs.in-project true. But when I do poetry install it doesnt create the .envn folder inside the project. Below is the poetry env info results:

(python39) C:\Users\username\Developer\Packages\test5>poetry env info

Virtualenv

Python:         3.9.6

Implementation: CPython

Path:           C:\Users\username\Anaconda3\envs\python39

Valid:          True


System

Platform: win32

OS:       nt

Python:   C:\Users\username\Anaconda3\envs\python39***

However, when deactivate the python39 environment and run poetry install it creates the .envn folder inside project. and the poetry env info results the following:

Virtualenv

Python: 3.9.6

Implementation: CPython

Path: C:\Users\username\Developer\Packages\test2\.venv

Valid: True


System

Platform: win32

OS: nt

Python: C:\Users\username\Anaconda3\envs\python39

how can I make it work in python39 environment?

Upvotes: 7

Views: 12413

Answers (1)

finswimmer
finswimmer

Reputation: 15202

This is an expected behavior. Whenever poetry detect it's running within a virtual environment it will not create a new one ( Exception: condas "base" environment is not detected as a virtual environment).

To create an in-project venv for python3.9 using conda you can do this:

  • set the config to virtualenvs.in-project true
  • without being in a venv run poetry env use /path/to/python3.9 once
  • run poetry install

Also have a look into the docs about poetry env use.

(Question and are answer are cross-posted in poetry's issue tracker)

Upvotes: 10

Related Questions