- PYCHARM WINDOWS PREFERENCES INSTALL
- PYCHARM WINDOWS PREFERENCES UPGRADE
- PYCHARM WINDOWS PREFERENCES WINDOWS 10
- PYCHARM WINDOWS PREFERENCES CODE
So, to avoid this, just let Poetry store your venvs outside the project, and all is well. If you try and select a Python binary from your virtual envs bin directory in Pycharm, that resides within your project, well…it just doesn’t work. Remember earlier, when I said that we were disabling putting our virtual envs inside our project directory? Well, this is the reason. Hit OK, and let Pycharm index the interpreter. If you’re not sure where yours is located, in your WSL shell, run poetry env info, and take note of the path variable). Point this to the location of your poetry virtualenv (mine is located at the default Poetry location of /home/jcerise/.cache/pypoetry/virtualenvs. The Python Interpreter Path option below that is what we’re really interested in. Clicking that will auto-populate with your distro, or if you have multiple, allow you to choose which distro you want to use. You should see an option on the left for WSL, with a little Tux icon. From there, hit the gear icon, and add a new interpreter. Once you’ve done that, go to settings->project->python interpreter.
To do this, we need to first open our project in Pycharm. Pycharm has a relatively recent feature that allows for using WSL Python interpreters in your Windows environment, meaning that we can utilize the Poetry environment we just created as our project interpreter in Pycharm.
PYCHARM WINDOWS PREFERENCES CODE
This will allow us to run all our code via the WSL, without actually having Python installed on Windows. Next we’re going to wire up Pycharm to use our Poetry virtualenv as the environment for our project, under Windows. Up until now, we haven’t really done much interesting, aside from play around inside the WSL a bit. You can verify this by going to the folder location using Windows File Explorer. This will create our new project and virtual environment, including a tests directory, project directory, and a. This location indicates that we are on the Windows C drive, under the Users directory. So, somewhere like /mnt/c/Users//python_projects, lets create our new project. We need to make sure that we’re creating this on the Windows filesystem, and not the WSL filesystem (this will make it easier to access our code using Pycharm, though it will be slower to access via WSL tools like Vim). This can be a convenience, but for our needs, we’re going to leave it set to False. This creates the new poetry virtualenv inside the poetry project directory. One note, a lot of Poetry tutorials and such recommend setting the virtualenvs.in-project setting to true. We’re installing this on our WSL environment, not in Windows. Poetry is a really nice package manager, which handles creation of virtual environments for us, and is generally pleasant to use. Again, I will leave the particulars to their own tutorial.
PYCHARM WINDOWS PREFERENCES INSTALL
The first thing we’re going to do is install Poetry. You can use Pyenv or similar if you need to juggle python versions (and I may write another article about that…), but for our needs, 3.8 will serve just fine. My version of Ubuntu comes with Python 3.8.2 installed by default, and this is what we’ll be using. This tutorial assumes Debian (mainly the presence of apt for package management), but if you’re more comfortable with a different distro, the general steps will remain the same. I chose Ubuntu 20.04, as I’m decently familiar with Debian based distros. Next, you’ll need to pick a Linux distro to use the WSL. There are many, many tutorials on accomplishing this, so I’ll just reference MIcrosofts official Docs on the subject and leave it at that.
PYCHARM WINDOWS PREFERENCES UPGRADE
I may expand on some of these concepts later though.įirst things first, you need to enable the WSL on your Windows install, and then upgrade to WSL2. Note, this is intended to be an overview, not an in-depth tutorial. What we’re going to go over in this article is WSL2 powered Python setup, where we won’t even be installing Python on Windows at all. And this is a fine approach, but it makes for a much less interesting article, and there are, at least for some of my use cases, limitations to doing things this way.
PYCHARM WINDOWS PREFERENCES WINDOWS 10
In this article, I’ll go over my preferred setup on Windows, using the WSL2, Windows 10 Pro, and Pycharm.Ĭertainly, you could just install Python for Windows, install Pycharm, and use Windows or Pycharms terminals to do most of what you need.
With the WSL, and some new fancy terminal emulators, I’m finding that I don’t miss my Linux box nearly as much as I used to. While Linux is and will always be, my preferred environment for developing Python, recently, I’ve been re-visiting Windows as my primary development platform.
There is no one platform that is better for writing Python programs, though certainly, there are some that make it a bit easier. One of the great things about Python is the fact that it can be developed, and runs on, many different platforms.