Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCharm Remote Interpreter: Cannot Execute Docker's Python Binary

I have configured PyCharm to target the Python binary in my Docker container, but am getting this error:

Couldn't refresh skeletons for remote interpreter
failed to run generator3.py for docker://app:latest//usr/local/python/bin/python, exit code 126, stderr: ----- /usr/local/python/bin/python: /usr/local/python/bin/python: cannot execute binary file -----

Running PyCharm 5.0.4 with Docker 1.10.0 in a VM with Python 3.4.3.

Here are my PyCharm Remote Interpreter settings: enter image description here

Saving those settings gives a Non-zero exit code. and the above error.

like image 404
Steely Avatar asked Oct 20 '25 14:10

Steely


1 Answers

In the Dockerfile of your docker image you will probably find an ENTRYPOINT ["bash"] or similar. PyCharm will try to run the interpreter like so :

docker run app:latest /usr/local/python/bin/python

In combination with the ENTRYPOINT that results in the following command within the container:

bash /usr/local/python/bin/python

From that the error message makes sense. If you have control over the Dockerfile you can either change the ENTRYPOINT to CMD or - if that's not an option for you - change the entrypoint so that it can work with /usr/local/python/bin/python as parameter and do the right thing with it.

like image 119
Tim-Erwin Avatar answered Oct 23 '25 04:10

Tim-Erwin



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!