# CS50 web, Ubuntu, pyenv and submit50 - but I'm a Windows girl...

I’ve recently started to follow CS50 for Web. Because why not, I have a week of free time between jobs, and I planned to do it for some time. Watching lectures is fun (while knitting, for example), but when I hit Django lecture I started to follow along. First of all, I’m a frontend dev using a Windows machine (Win11) and I try not to touch Linux until absolutely necessary. To follow a Django lecture, I had to install Django, and to install Django I had to install Python. But I didn’t want any Python, to me it’s logical that if there are multiple versions of something, there should be a version manager. Like for Node, there is `nvm`. After some googling it turned out there is `pyenv` and even a Windows version called `pyenv-win`. And there is a nice tutorial for that at [https://pyenv-win.github.io/pyenv-win/docs/installation.html](https://pyenv-win.github.io/pyenv-win/docs/installation.html).

I installed pyenv-win, I installed [Django](https://www.djangoproject.com/), I followed the lecture. Nice! Btw Django is awesome, it may look scary because it’s using templates (a concept in which I haven’t developed anything yet, but I am familiar with the syntax, I even wrote a bit about Twig - a template engine for PHP (I had to learn it for work, but haven’t used it in the end. The article/tutorial/introduction to Twig is [here](https://witchwrites.hashnode.dev/what-is-twig-and-how-to-start-using-it)).

Watching lectures and coding along with a demonstration is nice, but at some point one has to work on a project. And if one wants to earn a verified certificate with an official stamp from Harvard University (I am one, I want such a cert), one has to submit the required projects that meet the required criteria. For this, after coding the [Project 0](https://cs50.harvard.edu/web/2020/projects/0/search/) (which, btw, I pushed to [my GitHub repo](https://github.com/WitchDevelops/web50) first), I had to figure out how to submit it for grading. The instructions told me to install [`submit50`](https://cs50.readthedocs.io/submit50/), to make things easier. And what’s the first thing I see? To use Linux and install Ubuntu, like a proper human person, not a Windows normie… I’m both gaming and developing on my personal machine, I don’t want to ditch Windows… But WSL comes to the rescue. And with the newer WSL2 version (from Win11) it apparently has a dedicated Linux kernel (I don’t really know what it means, but it sounds professional). And I have already installed WSL on another machine, where I had to set up a dev environment for a big project at work. Seems easy, so let’s do it.

**Problem:** Install Python, `pip` and `pyenv` on a Windows machine using WSL, while keeping Windows versions intact (`pyenv-win`, Python installed on Windows, `pip` installed on Windows) so that they don’t clash

**Starting point:** Win11

**Goal:** be able to use `submit50`

**Steps:**

1. ## Installing WSL and Ubuntu
    

* First, install WSL and Ubuntu, following the official docs: [https://learn.microsoft.com/en-us/windows/wsl/install](https://learn.microsoft.com/en-us/windows/wsl/install)
    
* Restart the system
    
* Open Ubuntu: open terminal and enter `wsl -d Ubuntu`
    

2. ## Installing pyenv
    

* Install `pyenv` following this tutorial: [https://realpython.com/intro-to-pyenv/#installing-pyenv](https://realpython.com/intro-to-pyenv/#installing-pyenv) (also make sure that your system is updated before doing that (`sudo apt update`)
    
* Verify that `pyenv` was correctly installed by running `pyenv --version`
    

And if you have a pyenv-win installed, here is a potential issue. In my case `pyenv` was trying to execute the Windows version `pyenv-win` using Windows commands `cygpath` and `cmd`:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1742839338536/fed57acd-b3eb-4b95-b893-637f6edaf3a9.png align="center")

And that’s not what I want.

By running `which pyenv` I verified that indeed it is looking in the Windows file system:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1742839479540/fd2d9e2c-5920-4605-8b0a-c0bfe04870f3.png align="center")

Steps to fix this and point my Linux `pyenv` to correct executable while keeping my Windows version of `pyenv-win` intact:

* Edit `~/.bashrc` by typing `nano ~/.bashrc` in the terminal
    
* Add those lines at the end of the file:
    
* ```bash
    export PYENV_ROOT="$HOME/.pyenv"
    export PATH="$PYENV_ROOT/bin:$PATH"
    eval "$(pyenv init --path)"
    ```
    
* Save the file (`CTRL + X`, then `Y`, then `Enter`).
    
* Reload your shell by typing `source ~/.bashrc`
    
* Verify the `pyenv` location and version again:
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1742839754288/f00ff815-bfe3-4853-a2d2-6fb3226af0bb.png align="left")

3. ## Installing Python and `pip`
    

Find what is the latest stable Pythin release at [https://www.python.org/downloads/](https://www.python.org/downloads/). Similarly, check what is the LTS for `pip` [https://pypi.org/project/pip/](https://pypi.org/project/pip/). Because I have both aleady installed, but on Windows, I run into a similar issue as with `pyenv`:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1742840387910/7e9ae585-269d-4d72-9e97-16d9a0a4fd10.png align="center")

It is using the Windows version. Because my bashrc profile already contains the path for pyenv, it should be pointing to the correct pyenv version. But it isn’t. I found that adding another line at the end of the file solved the problem. Add this line to ensure that WSL does not point to Windows pyenv-win: `export PATH=$(echo "$PATH" | sed -e 's|/mnt/c/Users/wojew/.pyenv/pyenv-win[^:]*:||g')`

To do this, edit your bash profile similarly to the steps above. So, to repeat for clarity:

* Type `nano ~/.bashrc` in the terminal
    
* Scroll down and add this line to the end of the file: `export PATH=$(echo "$PATH" | sed -e 's|/mnt/c/Users/wojew/.pyenv/pyenv-win[^:]*:||g')`
    
* Save the file (`CTRL + X`, then `Y`, then `Enter`).
    
* Reload your shell by typing `source ~/.bashrc`
    
* Now verify pip and python installation on WSL using the commands: `pyenv which pip` and `pyenv which python`. On my machine it is not finding the commands, meaning the Windsows installation is not being recognized anymore and I successfully separated them:
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1742843083565/5d9977a3-538a-42b4-bd72-be71b199a2b8.png align="center")

Now I need to install `pip` and Python on WSL using `pyenv`.

LTS for Python as I write it is 3.13.2 and for `pip` it is **25.0.1. Let’s install them using** `pyenv`:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1742843262771/5bb0732a-fc2b-4cb1-b942-f8aeec37be21.png align="center")

Set it as global with `pyenv global 3.13.2`. Verify with `python --version` that this Python is actually being used and correctly installed. Now let’s check `pip`. When installing `pyenv`, `pip` should be installed automatically. Let’s verify which version is installed with `pip —version`:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1742844265779/2c37182a-9690-43c6-9c44-1f4aac047fda.png align="center")

Since I haven’t worked on any projects yet, let’s upgrade `pip` to LTS, using `python -m pip install --upgrade pip==25.0.1`:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1742844313548/a0817e31-664d-400d-9e17-102ebb23d543.png align="center")

Verify that it is currenlty using the desired `pip` version.

Now that everything is set up, I can finally submit my Project 0 code for grading using `submit50`! It took me only… 2 hours of faffing about ;)  

4. ## Submitting work with `submit50` - but first you need to install it
    

To install `submit50` using `pyenv`\-managed version of Python, first check where `pip` is located using `which pip3`. If it points to `/usr/bin/pip3`, it’s installing system-wide, bypassing `pyenv`. If it’s pointing to `/home/[username]/.pyenv/`, it is using `pyenv`. The correct way of using `pyenv` to install packages is:

```bash
pyenv exec pip install submit50
or
python -m pip install submit50
```

However, I run into issues. Rust and Cargo were needed to compile it… At this point I started to question all my choices because I don’t know what I’m doing anymore. Thankfully ChatGPT helped me figure out what to do about it.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1742844953070/2cb7760b-da27-4598-8a4a-7e84caf4f9ea.png align="center")

Hint: See above for details. Eh. ChatGPT says “This means **the package** `jellyfish` (a dependency of `submit50`) requires Rust to compile, but Rust is missing in your WSL environment“. Fair. I’ll just provide a screenshot:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1742845047297/1306f1f2-d238-4511-b7b2-ee9f0e58d938.png align="center")

So I installed Rust and Cargo to be able to use submit50. Great. Re-running the installation was successfull. Hurray!

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1742845202702/eda2495a-1445-42ec-bafd-6d46933b148b.png align="center")

Now I can finally follow the instructions at [https://cs50.readthedocs.io/submit50/#submitting-with-submit50](https://cs50.readthedocs.io/submit50/#submitting-with-submit50) to submit my work.

…and I did all that, only to find out that `submit50` doesn’t work anymore and it is easier to just use git…

yay coding!
