Tuesday, 22 March 2022

Setting up a new Python environment

Over many years of working in software development, managing dependencies to you code, whether in binary or source code format has always been a pain, to be honest. Take your pick from:

  • Cut and paste code
  • Linking against common libraries
  • Coping .zip files (with suitably convoluted folder structure)
  • Installing files to a common location
    • dlls
    • .NET GAC
  • Maven
  • NuGet
  • And so on..

And now into the mix comes Python with its 2.x (OK not really now) and 3.x versions, pip and conda..

A discussion of pip and conda can be found here

Anyway, having installed a new Ubuntu partition I wanted to get back the development environment I'd been using for the last couple of years. This is what I did...

Install Visual Studio Code

It's my tool of choice for Python. On Ubuntu I followed these instructions

I then installed the Python and Pylance extensions for VS Code

To check the Python environment being used, Open the Command Palette with Ctrl-Shift-P and then Python : Select Interpreter

Install Anaconda

It has its quirks but I have been using Anaconda. I installed from scratch using the instructions here.

The default installation included all the necessary libraries for simple machine learning code. 

Installing Cirq

I've been looking at Quantum Computing over the last year using Cirq. I couldn't get this installed using the instructions here.

However python -m pip install Cirq worked and it appeared in my Anaconda base (root) environment in VS Code. Success!

Installing Pygame

And finally, for some playing around with game programming I installed Pygame  with python -m pip install pygame.

So my environment is back up and running on a new OS installation.

No comments:

Post a Comment