Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using already existing container python interpreter as PyCharm interpreter

I have latest PyCharm installed. I have a docker container and I want to use its python interpreter as my project interpreter. Note that I don't want PyCharm to create new container from image every time I run my script. What are the steps to do so? If I use container interpreter will PyCharm support code completion for the packages installed in containers interpreter?

like image 341
FreeMind Avatar asked Oct 11 '25 16:10

FreeMind


1 Answers

I've submitted a feature request on https://youtrack.jetbrains.com/issue/PY-53854 because this is simply not a feature in PyCharm.

One temporary solution I considered was to ask PyCharm to use the python from the Dockerfile: docker exec -it container-name python, but PyCharm unfortunately doesn't let me set a "command" as a python interpreter for the IDE. It does allow you to set the command for specific run/debug configurations though - so you could use the python interpreter in a running container if you don't want integration with the editor (e.g. import suggestions).


User: Is there a technical reason as to why PyCharm cannot use an interpreter inside an already running container? Or could I expect it to be part of a future release? It would be a very nice feature to have

Jetbrains team: I am not aware of any technical reasons. I couldn't find any feature request for it.

Please feel free to submit a feature request about it to our issue tracker using the link https://youtrack.jetbrains.com/issues/PY and let us know if you need any help.

like image 85
Ben Butterworth Avatar answered Oct 14 '25 05:10

Ben Butterworth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!