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

Error if pyenv-virtualenv not installed #2

Open
paugier opened this issue Jun 12, 2020 · 10 comments
Open

Error if pyenv-virtualenv not installed #2

paugier opened this issue Jun 12, 2020 · 10 comments

Comments

@paugier
Copy link

paugier commented Jun 12, 2020

If pyenv-virtualenv is not installed, I get:

xonsh: For full traceback set: $XONSH_SHOW_TRACEBACK = True
subprocess.CalledProcessError: Command '['bash', '-c', 'source "/home/pierre/.bashrc"\npyenv virtualenv-init -\n']' returned non-zero exit status 1.
@dyuri
Copy link
Owner

dyuri commented Jul 8, 2020

Sorry, I missed this issue completely. Checking.

@dyuri
Copy link
Owner

dyuri commented Jul 8, 2020

Hmm, I can't reproduce this, for me if pyenv-virtualenv is not installed then the result of $(pyenv virtualenv-init -) is an empty string, and nothing happens (no exceptions).
Using xonsh 0.9.18.
If you still have this issue, please enable $XONSH_SHOW_TRACEBACK and provide more details.

@mjmare
Copy link

mjmare commented Aug 4, 2021

When starting a XONSH shell (with xontrib load pyenv in .xonshrc) I get the message:

pyenv: no such command `virtualenv-init'

(I have $XONSH_SHOW_TRACEBACK set to True).

Then I brew installed pyenv-virtualenv. It makes the message/error go away.
However, it seems pyenv virtualenv myvenv + pyenv activate myvenv does NOT work properly the virtualenv is not activated.

@dyuri
Copy link
Owner

dyuri commented Aug 5, 2021

I've commited a change into master to suppress the "no such command" error while checking for pyenv-virtualenv, if you have a chance, please check.

The other issue is more interesting, for me it works as inteded:

❯ pyenv virtualenv test
Looking in links: /tmp/tmpahxyqpfz
Requirement already satisfied: setuptools in /home/dyuri/.pyenv/versions/test/lib/python3.9/site-packages (56.0.0)
Requirement already satisfied: pip in /home/dyuri/.pyenv/versions/test/lib/python3.9/site-packages (21.1.3)
❯ pyenv activate test
pyenv-virtualenv: prompt changing will be removed from future release. configure `export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
❯ which python
/home/dyuri/.pyenv/shims/python
❯ $VIRTUAL_ENV
'/home/dyuri/.pyenv/versions/test'
❯ pyenv deactivate cica
❯ $VIRTUAL_ENV
Traceback (Most recent call last):
1 <xonsh-code> <module> -->
KeyError: 'Unknown environment variable: $VIRTUAL_ENV'
❯ pyenv virtualenv-delete test
pyenv-virtualenv: remove /home/dyuri/.pyenv/versions/test? y

Is the pyenv alias working in your session? You can check that this way:

❯ which pyenv
<function create_alias.<locals>.pyenv at 0x7faefcbb58b0>

@mjmare
Copy link

mjmare commented Aug 5, 2021

I brew uninstalled pyenv-virtualenv.
I did a brew update+upgrade.
I brew uninstalled + installed pyenv.
I still get the error message. Maybe you haven't pushed to Home-brew (don't know how that works)?

@dyuri
Copy link
Owner

dyuri commented Aug 5, 2021

No, I did not, and no, pyenv-virtualenv is not my package, xontrib-pyenv is. A minute and I publish a new version to PyPI.

@mjmare
Copy link

mjmare commented Aug 5, 2021

I see. What is the best procedure to get your latest version?

@dyuri
Copy link
Owner

dyuri commented Aug 5, 2021

New version (1.0.6) released to PyPI (https://pypi.org/project/xontrib-pyenv/), I hope brew uses that.

@dyuri
Copy link
Owner

dyuri commented Aug 5, 2021

I'm using pip to install python packages, but I use Linux (I suppose you use Mac).

@mjmare
Copy link

mjmare commented Aug 5, 2021

Everything seems to work now, including the virtualenv stuff. Great! Thanks for the prompt action.

For others who may read this: xpip uninstall xontrib-pyenv, followed by a similar install.
If pyenv-virtualenv is not installed: no more error message. With pyenv-virtualenv installed, pyenv virtualenvs work.

BTW it would be useful if you could add to the contributing-pyenv docs that no other installation steps (as stipulated in the pyenv docs) are necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants