Poetry: Virtualenv is not detected.

Created on 19 Apr 2018  路  19Comments  路  Source: python-poetry/poetry

virtualenv .venv
.venv/bin/pip install poetry
poetry debug:info
Shows I have a virtualenv at /home/buriy/.cache/pypoetry/virtualenvs/myproject-py3.6

Most helpful comment

Commit 74614a4 in the develop branch adds support for .venv detection. It will be available in the next 0.9.0 release.

All 19 comments

You have to activate your virtualenv for it to be detected.

And you should not install poetry in your virtualenv but globally.

But you wrote in #9 that virtualenvs are properly supported... A mistake?
And anyway I want to put .venv into the project folder, not in ~/.cache/pypoetry ...

But you have to activate your virtualenv for it to be picked up by poetry. If you do not do that poetry will have to create its own to work isolated.

And how to activate the virtualenv?
I haven't found any docs on that action so far...

Thanks, got it now. Would you make it work without a virtualenv activate?

I don't see how, since poetry has no way of knowing where your virtualenv resides if it's not activated.

So if you don't want to activate it each time, you can let poetry create its own virtualenv.

@sdispater it is activated by running the poetry command from inside the virtualenv.
This can be checked like this: https://stackoverflow.com/a/42580137/217895
Or do you mean this kind of activation can be confusing?

And I guess #60 should help you with the python path detection for the virtualenvs .

.venv looks like a somewhat standard accross tools. If it's a file, it is supposed to contain the name of the virtualenv relative to WORKON_HOME or absolute. If it's a directory, it is supposed to be a plain virtualenv.

This is the case for Spacemacs and anaconda and in Pipenv. See this gist for example聽: https://gist.github.com/twidi/049c1eb6ed359d3e9e7f

And you should not install poetry in your virtualenv but globally.

Why? Will something break?

@brettdh No, nothing will break but can if you install poetry in your virtualenv with pip since in this case its dependencies will not be vendorized so your project's dependencies can break poetry's ones.

That's why the recommended way to install poetry is the custom installer.

And, besides, I don't see why you would want to install poetry in every virtualenv you create since your globally installed poetry will detect them and use them.

@sdispater and what about different versions of python? What if system python version is 2.7 ?
You said that poetry is only going to work with python 3.6+ .
That's one of the reasons behind virtualenv-specific poetry installs.

@buriy for myself, i install poetry in user directory with pip install --user. poetry works well on Py3.5 too.

Really, poetry is like pip, just install it globally, either in /usr/local/bin or in ~/.local/bin. npm does it too.

@buriy As of version 0.8.0 poetry supports Python 2.7 and 3.4+

Commit 74614a4 in the develop branch adds support for .venv detection. It will be available in the next 0.9.0 release.

芦poetry is like pip禄 but pip is installed in every virtualenv! In the past you could have one global pip and use pip -e path/to/venv, but now the usage is to run pip from a venv (with activation or with path/to/venv/bin/pip).

@merwok Yes, I wouldn't say that poetry is like pip since you don't have to install poetry in every single virtualenv. poetry will detect if you already are in a virtualenv or create its own. So you only need to install it once.

Release 0.9.0 is out!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kierun picture kierun  路  3Comments

mozartilize picture mozartilize  路  3Comments

ulope picture ulope  路  3Comments

AWegnerGitHub picture AWegnerGitHub  路  3Comments

EdgyEdgemond picture EdgyEdgemond  路  3Comments