xonsh / xontrib-vox

Python virtual environment manager for xonsh.
MIT License
15 stars 3 forks source link

Out of the box xonsh will not execute within a Python Virtual Env on Windows 10 #4

Open eruber opened 4 years ago

eruber commented 4 years ago

After downloading and unarchiving xonsh-master.zip, and then following the "Windows Install from Source" directions at https://xon.sh/windows.html, the following (abbreviated) console output was generated;

python -m venv TEST_XONSH TEST_ONSH\Scripts\activate.bat (TEST_ONSH) > pip list Package Version


pip 10.0.1 setuptools 39.0.1

(TEST_XONSH) xonsh-master>python Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

^Z

(TEST_ONSH) > pip install prompt-toolkit (TEST_ONSH) > pip list Package Version


pip 19.1.1 prompt-toolkit 2.0.9 setuptools 39.0.1 six 1.12.0 wcwidth 0.1.7 (TEST_ONSH) > cd xonsh-master (TEST_ONSH) xonsh-master> python setup.py install <<much output deleted, which I have if questions arise.>> (TEST_XONSH) > xonsh-master>xonsh xonsh-master\xonsh__amalgam__.py:16197: UserWarning: prompt_toolkit is not available, using readline instead. "prompt_toolkit is not available, using " "readline instead." Skipping setup. Because no readline implementation available. Please install a backend (readline, prompt-toolkit, etc) to use xonsh interactively. See https://github.com/xonsh/xonsh/issues/1170

After looking at xonsh code and sampling sys.path at runtime, I determined what the problem and fix was...

The reason this error happens is because the xonsh.bat file is making decisions about what Python interpreter to use; namely the one in C:\Windows\py.exe (who put that there??) rather than the one in the defined virtual env.

Replacing xonsh.bat with just the single line: python -m xonsh %* fixes the problem; so does just invoking the xonsh module like this:

(TEST_XONSH) xonsh-master>python -m xonsh --version xonsh/0.9.6

My expectations were that the application would do nothing to automatically select a python interpreter; since the virtual environment creation and "activation" takes care of all those details so the virtual environment is usable.

I am looking forward to playing with xonsh. Thanks for working so hard, writing so much code, and releasing it for others to use!!

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

scopatz commented 4 years ago

Thanks for opening this @eruber - PRs very welcom here!