These integrations we have working are awesome! PyCharm IDE can also process Dockerfiles. The IDE configurations can be shared aswell, minimizing the setup time. And everything is in GitHub! All there is to do, is to start up the IDE (PyCharm Pro), clone the repository, and set a docker remote interpreter for the project! Need to have the drivers and nvidia-tools to have full GPU support, which was covered earlier.
But I had some trouble with my setup…
Reason 1: External drive I/O errors
Earlier on I have been running Ubuntu 18.04 LTS from an external drive, and it seemed to work well: if the SSD was plugged in, I would get the grub giving me options for Ubuntu or Arch Linux. If the SSD was not plugged in, I would get my usual grub-menu, as it resides on my laptops main efi-partition.
But in the long run, everything was not working nice and fine. Running a separate distro for only this project was a good idea in itself, but while running Ubuntu from the external SSD (Samsung SSD T5) , it occasinally had I/O errors which fully crashed the system.
I was thinking to move Ubuntu to the internal partition, as this was quite annoying. Until today.
Reason 2: Ubuntu screwed up my GRUB
I booted today happily to my loyal Arch (without the exteral SSD plugged in), and found myself sitting in a grub shell.
Thanks for the automation I didn’t ask for. This was the reason I specifically installed Ubuntu to a separate drive. It managed anyway to mess with another hard drive’s EFI partition. Pfft, plugged in the SSD and booted to my Arch. After working other stuff for a while, I started to look at our project, and decided to test the new supernice PyCharm integration with Arch Linux!
Setting up the environment on Arch Linux
First I had to install the professional version of PyCharm, which was not in the official repositories. I found it from AUR, which meant the installation could be easily be done with Arch’s default package manager: pacman.
IDE installed, I had to install docker and the nvidia-toolkits. Sure, Docker was in the official repos as expected, but the nvidia-tools weren’t. Somehow ArchWiki’s docker article happened to have the precise instructions to my needs: install the nvidia container support, again found from AUR.
I had to install one more dependency from AUR (libnvidia-container) to get the nvidia-container-runtime to work. I followed ArchWiki’s instructions, and after restarting docker service, I was ready to start PyCharm.
First time’s the charm
Everything is clean to start with: Docker is clean having no images at all and the nvidia container tools are freshly installed from AUR.
Running PyCharm for the first time: After the mandatory paperwork (accept licence, register the product): I’m sitting on the welcome screen. Lets clone it!
After the cloning, I want to run the test code to see GPU support work:
…but the interpreter is missing. We don’t actually have the interpreting container built yet. This can be accomplished by running the docker/Dockerfile (small green arrow there).
What PyCharm does here, is executing a ‘docker build’ -command using the Dockerfile configured to this project. Have to wait a bit for the download to finish.
After the container is built, the project interpreter is configured to point to the container.
After pressing OK here, the interpreter gets set correctly, and I get a list of all the python packages in the container’s Python runtime. Before running the test script, I’m waiting out while PyCharm does some resource intensive stuff with ‘configuring skeletons’.
Now I’m able to run the test script:
Even if the text is red, it is debugging information. And that information tells me everything is working correctly! And on the very first attempt!
Now I still have to fix my GRUB, then it is time to start with machine learning basics. We decided on this one for starters: