Ask Your Question

How to manage a virtual environment with Wing?

asked 2021-01-12 22:41:41 -0600

Huggable Bear gravatar image

updated 2021-01-15 08:29:04 -0600

Hello, I am new to Wing and coming from PyCharm and I am having some issues finding find the answer to some of these questions.

I am trying to use my projects venv but my OS Commands are not working. I have tried several test projects with both first poetry and then venv with commands like pip install dearpygui, python -m MyModule, poetry shell, poetry add, poetry run python -m MyModule and the result is always:

Process failed to start:
Could not create process (last error=2): pip install dearpygui

The only command that does not return this exception is python abs\path\to\ and then it only runs in my system wide python, not the venv. While trying to figure out the IDE I see the command Start Terminal under Tools in the toolbar but it is greyed out, is there a way to enable a terminal on windows so I can manage my python environment? It would be useful if I could run some standard commands like dir to figure out where I am in my system because it does not appear my current working directory is my project directory.

  • I understand my project needs to point to the activate.bat file, but is it supposed to be in quotes? Does the path need to be absolute?
  • How do I (or can I) access the terminal?
  • Once my venv is activated, how can i install/update my packages?

Any input or ideas on how to further troubleshoot would be much appreciated, thanks :)

Windows 10

Python-64bit 3.8

WingIDE (rev 87ca750566c6)

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2021-01-13 09:42:34 -0600

To use virtualenv, set the Python Executable in Project Properties to Activated Env and enter the full path to the activate or activate.bat script (without any quotes).

Looking at this, there seem to be some problems with OS Commands and virtualenvs. The venv is not being activated before running most commands. It would be for Start Terminal but that is disabled on Windows.

For now, it may make more sense to run poetry and pip outside of Wing, but you could add a command like this to OS Commands:

${WING:PYTHON} -m pip install <etc>

The special env ${WING:PYTHON} is replaced with the value of sys.executable set in the Python Executable selected in Project Properties, so the command will be run in the activated env.

We do plan to add a package management tool to Wing in the future, to make this easier to do from the IDE.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2021-01-12 22:41:41 -0600

Seen: 9 times

Last updated: Jan 13