How can I set up VSCode and Python which is in Docker? - python

I like to use VSCode as an IDE.
I'm starting to develop python application. I want to know if there is a way I can set up Miniconda environment in Docker and connect it to VSCode for compilation and debugging.

Not at the moment. The issue tracking this sort of thing is https://github.com/Microsoft/vscode-python/issues/79 .

Related

How to use python console of pycharm with a poetry environment?

Context : I am trying to find the best environment to develop analytics ml project in python where I can both write my main pipeline functions as a script (and access variable through a console) and then do analytic on notebooks.
Each project is different and so I am defining new poetry env to settle the right python packages. At each step when running my script I need to be able to access the variables easily to debug and code faster. I am currently using pycharm as IDE, but I can't find a way to activate and use my poetry env when running a python file through the python console of pycharm. I can only choose the python version, but the packages used when running the python console seem to be the one installed globally on my computer. Being able to access variables through python console while still using poetry env would help me save a lot of time when developing my script.
If it's not possible to run python console on pycharm with poetry env, I might change IDE to go to VS Code, as some friends advice me to do. If you have any advice, I will take them gladly :) !
Thank you very much and have a nice day !

How to integrate ns3 module with pycharm?

I'm new to the ns3, and I was trying to integrate ns3 to PyCharm cause I'm familiar with PyCharm. It seems that ns3 is installed correctly on my machine, running ./waf python works fine but when I use ./waf shell, there are some modules it couldn't find, such as ns.application...etc. So, when I try the solution on this page: add waf libraries to PyCharm, it doesn't work too. Could anyone help me to solve this issue? I would really really appreciate it. By the way, the file I test was the sample from ns3: ns3_root/source/example/tutorial/first.py.
If you have enabled the python bindings and have built them, you need to add the ns3_root/build/bindings/python to the environment variable PYTHONPATH. After that running first.py should work.
You can do that running
export PYTHONPATH=$PYTHONPATH:/path/to/ns3_root/build/bindings/python
Or select first.py, edit the target settings and add that environment variable.
Or if you want this to persist, add this line to the end of the ~/. bashrc file.

Arrow up / previous command in VSCode Python Interactive not working

I'm working with VSCode on an Ubuntu 18.04 machine. Everything is fine except that I can't get back to the previous command in Python Interactive Window via Arrow Up. It works in the integrated terminal though, integrated shell is /bin/bash.
I have no idea where this is coming from. I changed "keyboard.dispatch" to "keyCode", but that's not the problem. I also tried different versions of the python-extension.
Do you have any idea?
Thanks!
Not sure if this is helpful for you as an Ubuntu user, but I came across the same problem in Windows this week. In my case, the issue cropped up after I installed the Python extension in VS Code (or at least I didn't notice the issue before this). The combination of using the Python extension, Git Bash for terminal, and python virtual environment killed the up arrow feature for me. Using python outside a virtual environment works fine. My solution was to use Command Prompt as the terminal when I wanted to use a virtual environment interactively.
In my situation, although I delete all the shortcuts of UpArrow, I still can get the previous command through UpArrow in Python interactive. This means there's no way to configure this shortcut, it was built in the plugin which built in Python extension.
So it's some problem with your Python extension, but you said you have tried to install a different version of Python extension but still not work. Make sure you have deleted it completely -> delete the extension folder manually(it's under C:\Users[UserName].vscode\extensions\ms-python.python-xxx).

Can we remotely run and debug Python code from a Docker container using Spyder

JetBrains PyCharm is able to remotely run and debug Python code from inside a Docker container. Also, it is able to do the same task using an Anaconda environment.
I would like to ask if it possible to perform such a task (using either Anaconda or Docker) with the Spyder IDE.
My objective is to run and debug Python code using a Docker container that lives remotely to a different machine. The Docker container contains the appropriate Python interpreter as well as the Python modules I need.
Please help.
According to the spyder doc it is possible for conda environment using ssh : http://docs.spyder-ide.org/ipythonconsole.html#connect-to-an-external-kernel.
For Docker container the same steps should work according to this issue.
But I have not tried this myself.
EDIT : Otherwise, if you like to edit your remote code as well as running it. You can use Visual Studio Code Insider (available here) It is a preliminary version of what should be included natively in Visual Studio Code soon.

Python: "No virtualenv active"

I installed PyCharm 2.7 under Windows 8.1. It works fine, but every time I run a program, I get the following warning:
WARNING:root:No virtualenv active
Why does it happen and how can I fix it?
Program you run needs a virtual environment to run. This is a nice python feature that allows you to isolate a python program within the scope of the specific python set of libraries it may need. If you do not run more than one Python program you may not be really worried about it. However, it you do, I would recommend to ready about virtualenv first.
ps. Also, it might be just a debug log for developers to make sure they switched virtual env.

Categories

Resources