Programming Machine Learning: Setting up your system (p 13)

From page 13:
On Python 3.7, you can install the libraries with pip by running these commands inside a Python venv using Visual Studio Code

pip3 install numpy==1.19.5
pip3 install matplotlib==3.2.2
pip3 install seaborn==0.11.1

With Windows 11 I faced these errors when trying to install Numpy 1.19.5.

  1. Microsoft Visual C++ 14.0 was required. After installing C++ I retried installing numpy to run into…
  2. “TypeError: CCompiler_spawn() got an unexpected keyword argument ‘env’”. I updated the setuptools but that did not help because I got the same error. So I tried Numpy using pip install numpy==1.19.5 --no-binary=:all: --no-build but I got
  3. the error Running cythonize failed so I installed Cython but that did not help because I got the same error after retrying to install numpy

I gave up troubleshooting and decided to install the latest versions of the packages and see what happens when I try to run the code in the book.

Should I try another route? Any suggestions for installing the packages in a Windows 11 environment? Should I expect to run into any issues later in the book because I don’t have the specific version for the packages?

Regards,
roadbike

1 Like

Hello there! I’m sorry that it’s so hard to set up a reproducible Python ML system on Windows (or anywhere else for that matter). I can only tell you that I did my darnedest to provide repeatable instructions, but anything that I wrote tended to become obsolete, and often broken, within a couple of weeks. Now that the book is a few years old, all bets are off.

First of all, did you check the Setup page on the book’s site? The instructions there aren’t guaranteed to work anymore either, but at least I could keep it updated for as long as I managed. Recently, the distance between the versions of the libraries that I used in the books and the versions that you can install on all platforms got wider. I realized that I should just come up with an updated version of the book, with updated code for all examples.

Even if the instructions on the Setup page fail for you, however, you can still install the latest libraries and read the book. To answer your question:

Should I expect to run into any issues later in the book because
I don’t have the specific version for the packages?

Yes, but probably not major ones. Usually, if you install the latest packages, you only need a few tweaks to the code to make it run fine. Most of the issues can be fixed by looking at the “Troubleshooting” section of the setup page. If you find other errors that are not listed there, I’d appreciate it if you let me know.

Thank you for your quick reply. FWIW, I forgot to note that I am using Python 3.11.6. I will proceed with the latest versions of the libraries and if I run into anything I cannot sort out, I will reach out for help.

Please do.