18 months ago I wrote about setting up Anaconda for Python. The post is here
I highly recommend using Anaconda. I have now come to a natural break in projects and I want to upgrade my version to Python 3.7 – which is the default version that Anaconda uses (3.7.7 as of the start of April 2020). Previously I was running Python 3.6.5.
I tried a number of ways including the following commands:
conda update python
conda install python=3.7
I had no success with these. Basically the documentation says you cannot do it, unless you want to create a virtual environment:
When you create a new environment, conda installs the same Python version you used when you downloaded and installed Anaconda. If you want to use a different version of Python, for example Python 3.5, simply create a new environment and specify the version of Python that you want.
To create a virtual environment, using the Python version that you want, is a reasonable approach. You can do this with a command such as (where py37 is the name of my new virtual environment):
conda create --name py37 python=3.7
If you want to change your base environment, and at somepoint I think you are going to want to do that, then the only option I found was to uninstall your Anaconda version. Then download the latest version and install. Allow yourself ~20mins to uninstall and reinstall.
Open the prompt and check your version:
I have built a yml file with all the Geospatial, Computer Vision, Machine Learning Libraries that you should need. This will mean that in one line you should be able to get up and running.
Download the file (geospatial_python.yml) and save it to the location where you have installed anaconda. If you have accepted the default (windows) installation it should be:
Open the Anaconda prompt and, assuming you want your base environment setup, type:
conda env update -n base --file geospatial_python.yml
If though you’d rather set up a virtual environment (assuming you have one called py37):
conda env update -n py37 --file geospatial_python.yaml
Either way you just need to wait now for Anaconda to do the installation.
Post-running this and for future Python 3.7 maintainance it’s worth running occassionally (or now if you are reading this post after the end of April 2020). :
conda update --all
I wrote this post because I feel the pain of beginners all the time and I try and ease that. Without a doubt, installing Python is the hardest thing about teaching courses with Python.
Please let me know at email@example.com if this has worked for you. Feel free to adapt my yml file or even improve it! After running you should check that all the imports work as expected. Below is a virtual environment called py37 working.
I hope this has helped!
yml file on github gist is here https://gist.github.com/acgeospatial/ec38df103151d3b50c9523a73c4424e6
image credit https://unsplash.com/photos/WiONHd_zYI4
I am a freelancer able to help you with your projects. I offer consultancy, training and writing. I’d be delighted to hear from you.
Feel free to connect or follow me; I am always keen to talk about Earth Observation.