in the docs it sayes "Note that you cannot install any Python packages into Docker-based project interpreters."
so what is the alternative for that?
The +
button to add packages it dimped and I can't click it to add packages, despite it work very well when I use vertualenv instead of docker compose, or docker.
If you're using -- for whatever reason -- a container to run your python interpreter, PyCharm cannot handle updating packages on the container, like it can with local (virtual) environments. This is not too surprising, since containers shouldn't be considered "long lasting." As you pointed out, installing packages directly in the container is one option. Another is using Pycharm's ssh feature to ssh into the container and the run pip to install your needed packages. However, I think the less temporary solution is to use an image with all the packages you need already installed. Two options here: (1) Either pull from a python image on DockerHub with pre-installed apps, e.g.: use
FROM python:3.8-slim-buster
in your Dockerfile or (2) save your own container with all the packages you want as a new image, by using the docker commit
command, eg. docker commit CONTAINER NEW-IMAGE-TAG
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With