MichaelAquilina / zsh-autoswitch-virtualenv

🐍 ZSH plugin to automatically switch python virtualenvs (including pipenv and poetry) as you move between directories
GNU General Public License v3.0
507 stars 80 forks source link

Pycharm terminal error message #155

Open KungFuLucky7 opened 3 years ago

KungFuLucky7 commented 3 years ago

Issue Details

Please provide the following details when opening an issue:

Operating System (uname -a)

Mac OSX

zsh version (zsh --version)

zsh 5.8 (x86_64-apple-darwin20.0)

autoswitch-virtualenv version

echo "$AUTOSWITCH_VERSION"
<your version here>

3.1.1

How is zsh-autoswitch-virtualenv installed?

Steps to reproduce the issue

Every time I open up PyCharm terminal I get this verbose, prolonged error message:

...
    {file = "zope.interface-5.4.0-cp38-cp38-win32.whl", hash = "sha256:a9506a7e80bcf6eacfff7f804c0ad5350c8c95b9010e4356a4b36f5322f09abb"},
    {file = "zope.interface-5.4.0-cp38-cp38-win_amd64.whl", hash = "sha256:3c02411a3b62668200910090a0dff17c0b25aaa36145082a5a6adf08fa281e54"},
    {file = "zope.interface-5.4.0-cp39-cp39-macosx_10_14_x86_64.whl", hash = "sha256:0cee5187b60ed26d56eb2960136288ce91bcf61e2a9405660d271d1f122a69a4"},
    {file = "zope.interface-5.4.0-cp39-cp39-manylinux1_i686.whl", hash = "sha256:a8156e6a7f5e2a0ff0c5b21d6bcb45145efece1909efcbbbf48c56f8da68221d"},
    {file = "zope.interface-5.4.0-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:205e40ccde0f37496904572035deea747390a8b7dc65146d30b96e2dd1359a83"},
    {file = "zope.interface-5.4.0-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:3f24df7124c323fceb53ff6168da70dbfbae1442b4f3da439cd441681f54fe25"},
    {file = "zope.interface-5.4.0-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:5208ebd5152e040640518a77827bdfcc73773a15a33d6644015b763b9c9febc1"},
    {file = "zope.interface-5.4.0-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:17776ecd3a1fdd2b2cd5373e5ef8b307162f581c693575ec62e7c5399d80794c"},
    {file = "zope.interface-5.4.0-cp39-cp39-win32.whl", hash = "sha256:d4d9d6c1a455d4babd320203b918ccc7fcbefe308615c521062bc2ba1aa4d26e"},
    {file = "zope.interface-5.4.0-cp39-cp39-win_amd64.whl", hash = "sha256:0cba8477e300d64a11a9789ed40ee8932b59f9ee05f85276dbb4b59acee5dd09"},
    {file = "zope.interface-5.4.0.tar.gz", hash = "sha256:5dba5f530fec3f0988d83b78cc591b58c0b6eb8431a85edd1569a0539a8a5a0e"},
]: File name too long
Unable to find  virtualenv
If the issue persists run rmvenv && mkvenv in this directory

zsh-autoswitch-virtualenv is a very nice tool because it supports poetry, however, it doesn't seem to be able to detect virtual environment already activated properly.

One additional side note unrelated to this issue is if there's already a .venv folder created with python3 -m venv .venv as suggested by official doc (https://docs.python.org/3/library/venv.html), it doesn't seem to recognize that virtualenv in-place and insists on creating new virtual environment in ~/.virtualenvs with mkdir. Maybe you can provide a configuration option to enable in-place virtualenv similar to poetry's configuration option.

gist link to your zshrc

MichaelAquilina commented 2 years ago

One additional side note unrelated to this issue is if there's already a .venv folder created with python3 -m venv .venv as suggested by official doc (https://docs.python.org/3/library/venv.html), it doesn't seem to recognize that virtualenv in-place and insists on creating new virtual environment in ~/.virtualenvs with mkdir. Maybe you can provide a configuration option to enable in-place virtualenv similar to poetry's configuration option.

Yep this is a known issue and one I wish I had known about in hindsight!

It might be I'll have to rename this file and provide backwards compatibility for a short period of time while users move over.

MichaelAquilina commented 2 years ago

however, it doesn't seem to be able to detect virtual environment already activated properly.

Does pycharm activate the virtualenv for you automatically (I'm unfamiliar with the way pycharm works)

KungFuLucky7 commented 2 years ago

I can set PyCharm Python interpreter to the .venv path and it activates the environment whenever I open a new terminal.