First time here? Check out the FAQ!
1

How to manage a virtual environment with Wing?

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\file.py 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 7.2.8.0 (rev 87ca750566c6)

Huggable Bear's avatar
21
Huggable Bear
asked 2021-01-12 22:41:41 -0600
Wingware Support's avatar
4.2k
Wingware Support
updated 2022-05-05 09:37:50 -0600
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

1

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.

Wingware Support's avatar
4.2k
Wingware Support
answered 2021-01-13 09:42:34 -0600
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer