for COMP 353/453
Below are installation and setup instructions for each module of
- General course orientation
editor of your choice (I am using Notepad++. You
may want to use Sublime, Atom or any other text editor.)
- Database design and SQL
- All students may skip installation entirely and simply use the
Virtual Machine that is available. You still have to submit
Orientation Screenshots, to demonstrate that you are able to login, to
access your database, to build a basic application using Flask, and so
forth, but you may do these activities using the Virtual
Machine. Further, it is not an "either/or" choice. You may
install the environment on your own computer, and you may also use a
Virtual Machine when it is convenient for you to do so, or in case you
have any database connection issues. Mac users in particular are
encouraged to use the VM if you any issues with installation on your
install XAMPP (If you are using a
Mac, skip to the bullet point "What about Mac users?")
- Why XAMPP? We're not using PHP!!!
- XAMPP is a convenient way to install MySQL (or its clone,
MariaDB) and Apache, without having to install each component
separately and getting them to work together.
- PHPMyAdmin widely used as a convenient GUI that comes with
XAMPP. It is used to manage/view/test MySQL databases, regardless of the application
- You could certainly use the localhost setup by XAMPP together
with your python programs. In our case, we will not, since
it's easier to use flask for that. But you certainly could,
and many do.
- Do you have to use XAMPP?
- NO! If you want to use WAMP-Server, or AMPS, or even
install each component separately, you may do so.
- Do you have to use PHPMYAdmin to see and work on my
database? What about IDLE for editing my Python code?
- NO! I will demonstrate many of our queries on PHPMyAdmin, and
use it for "quick-and-dirty" database checks, even when using
Python. You may use WorkBench, or HeidiSQL, or pyMySQL, of
Raspberry Pi, or PyCharm, or any type of database connection and
any IDE you want to use. If you use an alternative setup,
please make sure you can access and view your database, and send
similar screenshots to the ones required in this
orientation. On the Mac, since we'll be installing Anaconda,
you might want to use Sypder, especially on the Mac, if you don't
have a separate Python 3 installation beyond Anaconda's.
(Sypder comes with your Anaconda installation.)
- What about Mac users?
- Please submit a
screenshot on Sakai, for the assignment named Orientation:
XAMPP/MAMP Installation screenshot , as per the
instructions in the assignment.
and set up a root user and a new user username and password
If you are using the VM, you do not have to configure phpmyadmin. It
is already configured.
The username and password for phpmyadmin on the VM is "student" and
You still have to test the installation, just to show me that you know
how to access everything.
test your XAMPP/MAMP installation Please
take a screenshot (as per instructions) and submit on Sakai to the
assginment named Orientation:
Test MySQL/PHP Installation
test your command-line (Terminal) installation Please
take a screenshot (as per instructions) and submit on Sakai to the
assginment named Orientation:
Test Terminal (Command Line) Installation
- If you have difficulty with the installation, or for some reason you
feel that you cannot install it, or if you do not a laptop available
for this installation, you can request from me a Virtual Machine that
has a WAMP stack already installed. Please let me know as soon
as possible, as I have to request this VM from our tech support
- If you are installing on the VM, you may see a pop up warning
about the activated User Account Control, etc. Ignore
it. It should install in C:\ instead of in the Programs(86)
- You may also want to install
SublimeText, atom, TextWrangler (or any
good text editor)
on the mac,
on Windows. (You can even install
Notepadd++ on the Mac, using Winebottler, but that's really out
of scope for this course.)
- For modeling your ER diagrams, use any modeling tool you want.
As a fallback position, you may use even
Word or PPT. MUCH BETTER: try ERDPlus (seems
cool and very clear!) has been a student favorite in past semesters;
(I don't prefer their EER notation, but no biggie); StarUML; ErDraw
EER notation) Dia (Windows or mac); Lucid (You
can keep renewing the free trial)
- Python, Flask, flask-sqlAlchemy
- Python: https://www.python.org/
There is a checkbox in the installation box to add Python to the
Windows path. Check that box!! See note below under
Installation of Database Packages, regarding some incompatibilities of
Python with some of the standard database packages. You may want
to install Python 3.6 instead.
- If you want to use PyCharm or any other IDE, feel free to do so, but
you are responsible for making sure that you can run flask, install
all packages, and connect to the database both through
flask_sqlalchemy and through the other database connectors that we use
It will redirect you to "products" and select the Anaconda Products
Individual, which will scroll you to the bottom of the page to
select your OS. As of this writing, it's using Python 3.8 for
Windows. For the Mac, be very careful to install the Anaconda
version for Python 3.x!!
Windows: I already had Python installed, and installing
Anaconda over my existing Python installation works just fine.
Python 2 comes installed with a Mac OS. However, you want
Python 3. You do not have to install it separately (although
you certainly may). When you install Anaconda 3, Python 3.x
will be installed, if you are careful to select the Python 3.x
version when you download/install.
Anaconda installation will give you an option to add python to the
path. Say "Yes"!!!
Anaconda will automatically add python and anaconda to the
$PATH. You can always check:
recommended to create a new “virtual environment” in Anaconda for
each project. For this course, I will
only use one environment; therefore I will be using the (base)
environment. Feel free to setup
multiple environments, but it is not required for this course, nor
will I demonstrate it.
installation: from within your
means, on Windows, Start-->Anaconda-->Anaconda prompt.
If you are using the VM, you have to run Anaconda as
administrator. Right-click the little Anaconda prompt
icon-->more--run as administrator). On Mac, start the
Anaconda Navigator, and open a terminal window. In both
cases, you should see the prompt with your acanconda environment,
for instance (base), as part of the prompt.)
into Python (type python at the command prompt, from within
import flask. There should be no error.
- Take a screenshot from within
Anaconda terminal/command, showing import flask with no error.
file which contains the sample code that you will need for
the Python ORM part of the course. Unzip. There will
be a few (very few) changes in the Mac version, so
here is the Mac zip file. The Virtual Machine
already has everything downloaded onto the Desktop.
However, if you mess it up or need a fresh version, here
is the VM zip file.
the first three minutes of the video, and duplicate the
- Take a screenshot of "Hello,
World!" on your web browser .
- Submit the import
Flask screenshot and
the Flask HelloWorld screenshot for the assignment named Orientation: Screenshot of
Fask Installation and HelloWorld.
- ***Please note: The
folder structure in the video is slightly different from the one
that I give you in the zip file that you downloaded. In
the video, the flaskHelloWorld.py program is in the folder
FlaskDemoLectures. However, I changed it slightly after
making the video. Your flaskHelloWorld.py program is in
Flask-Demo/Lectures/1-GettingStarted of your unzipped folder
structure. When I navigate to the folder containing the
flaskHelloDemo.py program, be sure that you navigate to the
folder where your
program is located
- Installation of database packages: (There are no specific
orientation assignments for this part, since Lab-4a-connect covers
this material. However, I am including it here, so that all
installation instructions are in one place, and also because you may
want to get things up and running earlier than required.
- Instructions for Windows users:
- MySQL connector: From within your Anaconda environment:
- MySQL Client and MySQLdb: We want to use
Flask-mysqldb. It has a dependency of Mysqlclient, so that
must be installed first. However, on the most recent
installations (newest upgrades on Anaconda), you can try to pip
install Flask-mysqldb. It worked for me, and it never did
before, not even last semester. So try that first. If
that is successful, you can skip the rest of this document.
- From within your Anaconda environment, attempt:
- Mac users: continue 6 below, where it
says "Instructions for Mac Users". Be aware
that you should also attempt to pip install Flask-mysqldb
first, and maybe you will be as lucky as the Windows users
and you can then skip the whole conversation about
You may get an error that you don't have the VB Build
Tools installed (I have not experienced that error
on the Mac, nor have I found others who have encountered
- Go to: https://visualstudio.microsoft.com/visual-cpp-build-tools/
- install as per instructions
- Close Anaconda terminal
- Run the Anaconda prompt as administrator
- right-click the prompt icon and select run as
- Windows and Mac,
- type: conda install -c bioconda mysqlclient
(Ignore any warnings about conda packages being
deprecated. It is a bug in conda and is being fixed
as of this writing.)
IMPORTANT NOTE: A student has encountered an
incompatibility error when trying to install mysqlclient
while using python 3.8.7. This may indeed be an
incompatibility or it may be a conda thing.
Apparently, 3.8 is having some compatibility issues with
several packages (not just database ones).
So I tried this on a clean VM, using Anaconda with
Python 3.8.5, and I also got this error. Before
trying some of the suggestions below, I just went ahead
and did pip install Flask-mysqldb, and lo and behold, it
installed Flask-mysqldb and also installed the
dependency mysqlclient!! If this works for you,
you can ignore the next two bullet points.
- You can try to install MySQLClient manually. See this
video, with a link to where the package can be
downloaded and installed manually (not installed through
either PIP or Conda). Just be sure to install it
from within Anaconda.
You can opt to install python 3.6 instead. Or,
you can use python 3.8 with everything else (I hope!!),
and use the VM for the few labs which require flask
mysqldb (which has mysqlclient as a dependency). I
do know that students ran everything successfully in the
Fall, 2020, semester. So its possible that the
December, 2020, update to 3.8.7 is where the
So if you want to be safe, install python 3.6 (you can
specify that when you install anaconda, and/or when you
install directly from the python site). Or, as I
said, use python 3.8 and use the VM if you run into
problems. For many of the labs, you don't need
flask mysqldb anyway. There are many proposed
solutions to this incompatibility on the web, but I
don't want to mess up my installation in order to test
them, right when the semester is beginning. I will
set something up and continue testing on another
computer. But meanwhile, if anyone finds a
workable solution, please share it with the rest of us
on Teams. We are not using this package until just
before 3/22, so I'll have some kind of answer for you
- Flask-Mysqldb (install after MySQLClient is successfully
- pip install Flask-mysqldb
- If you were unable to install MySQLClient correctly, the you
will not be able to install Flask-mysqldb. You may to
use the VM, or downgrade to Python 3.6
- Instructions for Mac Users:
->BTW, Mac users. Sometimes,
there are just too many configuration issues or conflicts to
make this local installation worth your while. You may want to
seriously consider using the VM.
2 comes installed on macOS, however, you want Python
3. You do not have to install it separately (although
you certainly may). When you install Anaconda 3,
Python 3.x will be installed, if you are careful to select
the Python 3.x version when you download/install.
will automatically add python and anaconda to the
a terminal window (either by starting Anaconda Navigator or
a terminal app of your choosing), you should see the prompt
with your acanconda environment, for instance (base), as
part of the prompt.
- Flask installation:
- pip install flask
- pip install flask-sqlalchemy
- pip install flask-login
- pip install flask-bcrypt
- pip install flask-wtf
- Then go into Python (type python at the
command prompt, from within anaconda)
- type import flask. There should be no
- type import flask_sqlalchemy
- type exit()
- Take a screenshot from within Anaconda
terminal/command, showing import flask with no error.
- Download the Mac zip file
which contains the sample code that you will need for the
Python ORM part of the course. Unzip.
- Note: There will be a few (very
few) changes in the Mac version
- Installation of
database packages: (There
are no specific orientation assignments for this part, since
Lab-4a-connect covers this material. However, I am
including it here, so that all installation instructions are
in one place, and also because you may want to get things up
and running earlier than required. Recommended.
your Anaconda environment:
Client and MySQLdb:
within your Anaconda environment, attempt:
conda install -c bioconda mysqlclient (Ignore
any warnings about conda packages being
deprecated. It is a bug in conda and is being
fixed as of this writing.)
(install after MySQLClient is successfully installed):
As we build our applications, we may be required to install