Remote docker interpreter not being picked up by IDE

已回答

Intel Mac

After adding/updating libraries in my environment, I typically need to re create the interpreter to get pycharm to recognize the updates. So after doing a recent update, I have done this and now Pycharm is not picking up anything at all. Not sure if related, but although I have many interpreters for other projects to, I have noticed that "Interpreter paths" has nothing to show.

What I am doing to add the interpreter:

- Using docker compose, selecting the service

- Using system interpreter -> Python 3

 

Build #PY-231.9225.15, built on July 11, 2023


Things I've tried:

- Re-creating the environment, and restarting the IDE
- Invalidating caches

- Removing <path>/JetBrains/PyCharm2023.1/tmp/docker_compose.*

- Using IDE repair

Running  `/usr/local/bin/python3 -m pip list` inside of the docker container shows the expected libraries (and this is the interpreter path set when the env was created). However, in the IDE, under the "External Libraries" folder nothing shows up.

EDIT: Updated the interpreter paths manually, now external libraries just shows /usr/local/bin/python3

Is there something else I can try?

0

Kenny

Instead of re-adding the interpreter when you update the libraries try to rebuild the image directly via the Terminal on PyCharm:

docker-compose up --build

After that update the interpreter settings in PyCharm. By re-selecting the remote interpreter:

In case the issue persists attach a sample Dockerfile and docker-compose.yml(if it is possible) and attach the zipped log file from the IDE UI at Help | Collect Logs and Diagnostic Data after reproducing the matter.

Upload the files at https://uploads.jetbrains.com/ and share its uploadID here

0

Hi Miguel, yes I've re-built my Docker images but it is not helping. I forget if I have done that in the past when running into issues, but I feel like I usually have problems with the IDE not picking up the library changes (not sure if due to caching or what).

Anyway, with the issue at hand, I don't have the option to select my interpreter in the area you are showing (I think I am on a newer layout). Here is what I see

However when I go into preferences, I have it selected here as such:

I think my issue is related to the fact that the external libraries folder is not populating:
I notice that my interpreter paths do not get populated at all, where in other projects they do.

Here is my upload ID for logs: 2023_07_24_XiizCdkSTJHJT1zQBb6PyH
I removed the old interpreter, and created a new one before collecting these logs.

Here is a snippet of docker-compose file:

community-backend:
image: community-backend:dev
build:
context: .
cache_from:
- community-backend:dev
env_file: .env.docker
command: >
gunicorn -b 0.0.0.0:5000
-k gevent
-w 4
--chdir /app
--access-logfile -
--reload
app:app
expose:
- "5000"
volumes:
- ./:/app
restart: on-failure

 

And here is the dockerfile:

ARG BASE_IMAGE_TAG=3.10-dev
FROM <our_repo>:$BASE_IMAGE_TAG
ENTRYPOINT []
WORKDIR /app
RUN npm i -g @stoplight/spectral-cli@6.6.0
COPY pyproject.toml poetry.lock /app/
RUN poetry config virtualenvs.create false && poetry install
COPY . /app
USER guest
EXPOSE 5000

 

0

I can see the following on the logs that indicate that the device/partition where your project/Docker resides has run out of space:

2023-07-24 13:07:13,068 [2475850] WARN - #c.j.p.s.PythonSdkUpdater - Update for SDK Remote Python 3.10.9 Docker Compose (community-backend) failed
The following command was executed:

/usr/local/bin/python3 /opt/.pycharmhelpers/remotesync.py /tmp/2845a77b-42f2-4a84-a7bd-f39fa07633c6

The exit code: 1
The error output of the command:


Traceback (most recent call last):
File "/opt/.pycharmhelpers/remotesync.py", line 150, in collectsourcesinroot zf.write(path, relpath)
File "/usr/local/lib/python3.10/zipfile.py", line 1773, in write
with open(filename, "rb") as src, self.open(zinfo, 'w') as dest:
File "/usr/local/lib/python3.10/zipfile.py", line 1178, in close
self.fileobj.seek(self.zinfo.header_offset)
OSError: [Errno 28] No space left on device

Could you please double-check if that's the case? For example, you can try to use docker system prune to remove all unused data but be careful to not remove any unwanted images.

Try also to invalidate the cache on PyCharm at File | Invalidate Caches | Invalidate and Restart

In case the issue persists, provide us with the updated logs after reproducing the matter.

0

Thanks Miguel, that did it! I had pruned my volumes at one point but I guess that was not enough. Cheers!

0

请先登录再写评论。