Use virtualenv with Python with Visual Studio Code

With the latest update to the extension all you need to do is just specify the “python.pythonPath” as follows. The values for “python.autoComplete.extraPaths” will be determined during runtime, but you are still free to specify custom paths in there. Please, remember to restart Visual Studio Code once the necessary changes have been made. { “python.pythonPath”: … Read more

How to enable a virtualenv in a systemd service unit?

The virtualenv is “baked into the Python interpreter in the virtualenv”. This means you can launch python or console_scripts directly in that virtualenv and don’t need to activate the virtualenv first or manage PATH yourself.: ExecStart={{ venv_home }}/bin/fooservice –serve-in-foreground or ExecStart={{ venv_home }}/bin/python {{ venv_home }}/fooservice.py –serve-in-foreground and remove the EnvironmentFile entry. To verify that … Read more

Multiprocessing AsyncResult.get() hangs in Python 3.7.2 but not in 3.6

I think this is a regression in Python 3.7.2 as described here. It seems to only affect users when running in a virtualenv. For the time being you can work-around it by doing what’s described in this comment on the bug thread. import _winapi import multiprocessing.spawn multiprocessing.spawn.set_executable(_winapi.GetModuleFileName(0)) That will force the subprocesses to spawn using … Read more