4

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.

2 Answers 2

5

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.

Sign up to request clarification or add additional context in comments.

Comments

0

The problem was that I was using Docker Compose before PyCharm fully supported it, which didn't really start to happen until PyCharm 2016.1. The PyCharm blog posted about how to use it with Docker Compose about a month after I asked this question.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.