Live coding discussion

At least for me, everything in my Linux home dir that I want to keep, is in github repos.

4 Likes

WSL can access your C: drive … at least that’s how I do it. I just ‘cd’ to a windows folder on my C: drive (made available as /mnt/c in I think?) and put files there, and I can get to it from windows explorer side. If your dropbox folder is c:/dropbox you should be able to see it from within WSL as /mnt/c/dropbox if I’m not mistaken.

1 Like

Just be aware that accessing Windows directory files from WSL is far slower than accessing them from WSL.

BTW you can backup your whole WSL distribution like sohttps://medium.com/codex/setting-up-regular-automatic-backup-of-your-windows-subsystem-for-linux-wsl2-data-using-task-b36d2b2519dd

1 Like

To add to this, it is a fun activity to create your own scripts (like the scripts we learned about in the walk-thru) for setting everything up that you might need on a new machine.

It changes the experience of setting up a new machine from a horrible chore to something you barely think about :slight_smile:

I have config scripts that I use myself here. Jeremy has a much nicer repo here. The rest is getting backed up automatically as I work on stuff to github, but that is nearly an afterthought.

That bit from Jeremy’s repo is crucial I feel:

I suggest you create a fork of this, so you can modify it.

The approach used here is from How to store dotfiles | Atlassian Git Tutorial

Well, both these bits :slight_smile: The second part actually describes how the method works, so it is really cool, though I don’t remember when was the last time I actually updated my dot files like that :smile: There is just so much value in them getting pulled at the start.

4 Likes

I am sure we have a lot of goodies planned to cover, so I am not listing them here (tmux, for instance), but on things directly associated with what was covered in he walk-thru, three things that we might want to consider covering next might be:

  • we have seen a lot of python stuff getting installed, but what does it mean for a library to be installed?
  • what is a wheel? is there something we should know about setup.py or not necessarily so at this point?
  • how do you “install” your own stuff? say you write a script or a python program and using the shebang (!#) you tell your computer what to run it with and make the file executable (chmod +x `) But how do you “install it” so that you can run it from anywhere in the file system?

And on navigating the file system:

  • the cd without anything after that we covered was cool!
  • I am not sure if we covered ~?
  • maybe pushd and popd?

BTW these are just loose thoughts, if none of this is helpful then no worries :slight_smile: Just thought I’d throw it out there in case it might be helpful (there is a high chance this might not be the time to discuss the more elusive aspects of what setup.py is for instance, in the interest of first learning to play the whole game)

3 Likes

An alternative that I found useful was to backup my entire home directory on WSL (/home/<wsl-username>) and Windows home directory (/mnt/c/Users/<windows-username>) using borgbackup to an external drive. For the windows user directory I also exclude /mnt/c/Users/<windows-username>/AppData/Local. The advantage of using borgbackup is that it compresses and deduplicates the files it backs up, resulting in a smaller backup file. I can also mount a particular backup checkpoint as part of the filesystem, so it can serve as a coarse version control system, even for those files I didn’t intend to version.

HTH!

1 Like

I wrote a blogpost on Installing Python packages and setting a proper environment for Datascience. This is based on notes I had written while attending Fastai walk-thrus session conducted by Jeremy on Introduction to the terminal. How to install Python and libraries. Do check it out:

6 Likes

Hi, everyone. This walkthrough is exactly what I need. I have no coding experience, and used fastai as a springboard to learn Python, Linux, etc. It’s been a tough slog, if I’m being honest. It’s often the issues not pertaining to fastai specifically that slow me down.

Over time, I’ve installed a Ubuntu distribution and created several virtual environments to work in using a full Anaconda distro. I’ve taken several data science courses from Coursera. These are often old and need specific environments to work. I’ve also had to apt-get some things into the system to get them to work. So now I have an (older) Unbuntu version with several environments and system versions of things like Python and Jupyter notebooks. Watching the walkthrough, I notice that Jeremy is encouraging a “fresh” environment with new installs for Python, Jupyter, mamba, etc. I’m updating to Windows 11 now, and I could uninstall and reinstall Ubuntu, but I’m concerned that I’ll make my older files unworkable. It’s not the end of the world to lose them, but I’d prefer not to.

Long way of asking whether there is a way to create the “fresh” environment with all of the versions of everything that Jeremy recommends (especially at the level of the shell) without losing the functionality of what I have? I had the idea of creating a new user on Ubuntu. Will that solve the problem, or does it maintain the same installations of, for example, anaconda on Ubuntu?

The other choice is to copy the files, uninstall and reinstall Ubuntu using Windows 11, and start fresh. I’ll lose some of the functionality but I have the notes which is most important. It just really seems inelegant.

Sorry if this question is basic. I’ve read through the other comments here and if they answer my question I’m not recognizing it.

This is an incredible course and resource. I hope to join you in person for these walkthroughs at some point, but timing is always hard…

5 Likes

Just watched a bit further. Looks like removing anaconda directory will do the trick, followed by installing mamba? It won’t change the system files in Ubuntu but I guess that doesn’t matter?

1 Like

You may find these useful…

2 Likes

Hi Mark, it depends what kind of Ubuntu environment you currently have. Is it Ubuntu on an actual machine? or Ubuntu in a WSL install in windows. If it’s an actual machine you could try to make an ISO out of your ubuntu install and then just restore it to a virtualbox VM. If it’s WSL based, then you could probably look into what @bencoman suggested.

BTW, if you go the WSL route on windows11, just note that you can have multiple versions (“Images”?) of Ubuntu running on WSL. So you could probably import your older image into an Ubuntu version on your new machine’s WSL and then create another brand new WSL based Ubuntu environment where you can follow Jeremy’s walkthroughs.

Personally, I’m a serial course taker myself, and like you mentioned, those environments can get old because they use older versions of everything … so, I periodically go through these old directories and find that most of that stuff is not that useful to me. The only thing that’s useful is the code that I wrote and use git to keep a copy of that anyway. In your case, you might just want to run multiple Ubuntu instances and port your older ubuntu to your new Win11+WSL and then use another Ubuntu install for fastai 2022 stuff.

All the best!

1 Like

Thanks @mike.moloch and @bencoman.

I am using WSL.

I used your tips to create an image of Ubuntu, then deleted and reinstalled. The files are really just Jupyter notebooks with my own notes in them and will mostly work fine with the new install as long as I don’t try to run actual code. They’re more my “notes”. Not really appropriate for github since they are Coursera’s notebooks.

Actually had to still do a manual install of Ubuntu despite upgrading to Windows 11 and deleting old version. Did everything Jeremy did, but still didn’t quite work. Nothing ever seems to go exactly right with Linux, packages, etc. That’s why this walkthrough is really valuable for me.

Really appreciate the help.

1 Like

Darn! looks like I missed tonight’s walk thru!

Darn! Me too!

@jeremy I assume the walkthough tonight is at the same time (yesterday still listed in top post)? Does the same Zoom link work?

Thanks for a really useful session last night (yesterday morning for you).

I believe there is a session each day/night (were ever you are) this week I believe at the same Australian time

2 Likes

Yup same time. I’ve updated the Zoom link.

For those that are interested in conda and pip and how that all came into being you might enjoy Lex Fridman’s interview with Travis Oliphant where they talk about packaging in Python and why it is hard and how conda was designed to help that.
It is a long interview, as all of Lex’s are, so here is a link to the section on conda and packaging: Travis Oliphant: NumPy, SciPy, Anaconda, Python & Scientific Programming | Lex Fridman Podcast #224 - YouTube

6 Likes

Great session tonight.

I had another question about the use of environments but didn’t want to further derail the conversation, so I’m posting it here. Just to summarize, Jeremy advised that he does not like (as a general rule) to use virtual environments, preferring to periodically update the mamba directory and use the latest version. The part that I don’t get is that as the codebase of the dependencies is updated, this will require constant updating of your own code. As commands get depricated, for example, your code will stop working. Unless you are constantly running each program or notebook, you will not notice until you get the bug. How do you “evergreen” your code?

I encountered this when I was taking Coursera courses. I downloaded the course to use locally, but the notebooks used older versions of libraries like pandas. I had to dig into several functions to figure out why they weren’t working. I did this deliberately because I figured there was no point in using outdated versions of libraries, but sometimes you just want your code to work.

2 Likes

I think that would be a very interesting discussion! :slight_smile:

2 Likes