Dinowars Test 0.0.2 Mac OS
With IPv4 address pool exhaustion imminent, enterprise and cellular providers are increasingly deploying IPv6 DNS64 and NAT64 networks. A DNS64/NAT64 network is an IPv6-only network that continues to provide access to IPv4 content through translation. Depending on the nature of your app, the transition has different implications:
I am having the same issue - my HP ENVY Photo 7858 running OS 11.1 won't print. When I send a print job to the printer, it makes all the usual noises and spits out a blank page. I have checked for firmware updates - none. My OS is updated. I have removed the printer from the queue twice and reinstalled it using the AirPrint option. Gutenprint on Mac OS X would not be possible without CUPS, the open-source print spooler built-in for Mac OS X starting with version 10.2 (Jaguar). Gutenprint is strictly a printer support package. For multi-function devices, it supports only the printer function. The last release that will work under Mac OS X 10.2.x (Jaguar) is 5.0.2. MacOS Big Sur elevates the most advanced desktop operating system in the world to a new level of power and beauty. Experience Mac to the fullest with a refined new design. Enjoy the biggest Safari update ever. Discover new features for Maps and Messages. Test for IPv6 DNS64/NAT64 Compatibility Regularly. The easiest way to test your app for IPv6 DNS64/NAT64 compatibility—which is the type of network most cellular carriers are deploying—is to set up a local IPv6 DNS64/NAT64 network with your Mac. You can then connect to this network from your other devices for testing purposes. See Figure 10-6.
If you’re writing a client-side app using high-level networking APIs such as
NSURLSession
and the CFNetwork frameworks and you connect by name, you should not need to change anything for your app to work with IPv6 addresses. If you aren’t connecting by name, you probably should be. See Avoid Resolving DNS Names Before Connecting to a Host to learn how. For information on CFNetwork, see CFNetwork Framework Reference.If you’re writing a server-side app or other low-level networking app, you need to make sure your socket code works correctly with both IPv4 and IPv6 addresses. Refer to RFC4038: Application Aspects of IPv6 Transition.
What’s Driving IPv6 Adoption
Major network service providers, including major cellular carriers in the the United States, are actively promoting and deploying IPv6. This is due to a variety of factors.
Note: World IPv6 Launch is an organization that tracks deployment activity at a global scale. To see recent trends, visit the World IPv6 Launch website.
IPv4 Address Depletion
For decades, the world has known that IPv4 addresses would eventually be depleted. Technologies such as Classless Inter-Domain Routing (CIDR) and network address translation (NAT) helped delay the inevitable. However, on January 31, 2011, the top-level pool of Internet Assigned Numbers Authority (IANA) IPv4 addresses was officially exhausted. The American Registry for Internet Numbers (ARIN) is projected to run out of IPv4 addresses in the summer of 2015—a countdown is available here.
IPv6 More Efficient than IPv4
Aside from solving for the IPv4 depletion problem, IPv6 is more efficient than IPv4. For example, IPv6:
Avoids the need for network address translation (NAT)
Provides faster routing through the network by using simplified headers
Prevents network fragmentation
Avoids broadcasting for neighbor address resolution
4G Deployment
The fourth generation of mobile telecommunication technology (4G) is based on packet switching only. Due to the limited supply of IPv4 addresses, IPv6 support is required in order for 4G deployment to be scalable.
Multimedia Service Compatibility
IP Multimedia Core Network Subsystem (IMS) allows services such as multimedia SMS messaging and Voice over LTE (VoLTE) to be delivered over IP. The IMS used by some service providers is compatible with IPv6 only.
Cost
Service providers incur additional operational and administrative costs by continuing to support the legacy IPv4 network while the industry continues migrating to IPv6.
DNS64/NAT64 Transitional Workflow
To help slow the depletion of IPv4 addresses, NAT was implemented in many IPv4 networks. Although this solution worked temporarily, it proved costly and fragile. Today, as more clients are using IPv6, providers must now support both IPv4 and IPv6. This is a costly endeavor.
Ideally, providers want to drop support for the IPv4 network. However, doing so prevents clients from accessing IPv4 servers, which represent a significant portion of the Internet. To solve this problem, most major network providers are implementing a DNS64/NAT64 transitional workflow. This is an IPv6-only network that continues to provide access to IPv4 content through translation.
In this type of workflow, the client sends DNS queries to a DNS64 server, which requests IPv6 addresses from the DNS server. When an IPv6 address is found, it’s passed back to the client immediately. However, when an IPv6 address isn’t found, the DNS64 server requests an IPv4 address instead. The DNS64 server then synthesizes an IPv6 address by prefixing the IPv4 address, and passes that back to the client. In this regard, the client always receives an IPv6-ready address. See Figure 10-3.
When the client sends a request to a server, any IPv6 packets destined for synthesized addresses are automatically routed by the network through a NAT64 gateway. The gateway performs the IPv6-to-IPv4 address and protocol translation for the request. It also performs the IPv4 to IPv6 translation for the response from the server. See Figure 10-4.
IPv6 and App Store Requirements
Compatibility with IPv6 DNS64/NAT64 networks will be an App Store submission requirement, so it is essential that apps ensure compatibility. The good news is that the majority of apps are already IPv6-compatible. For these apps, it’s still important to regularly test your app to watch for regressions. Apps that aren’t IPv6-compatible may encounter problems when operating on DNS64/NAT64 networks. Fortunately, it’s usually fairly simple to resolve these issues, as discussed throughout this chapter.
Common Barriers to Supporting IPv6
Several situations can prevent an app from supporting IPv6. The sections that follow describe how to resolve these problems.
IP address literals embedded in protocols. Many communications protocols, such as Session Initiation Protocol (SIP), File Transfer Protocol (FTP), WebSockets, and Peer-to-Peer Protocol (P2PP), include IP address literals in protocol messages. For example, the
FTP
parameter commandsDATA PORT
andPASSIVE
exchange information that includes IP address literals. Similarly, IP address literals may appear in the values of SIP header fields, such asTo
,From
,Contact
,Record-Route
, andVia
. See Use High-Level Networking Frameworks and Don’t Use IP Address Literals.IP address literals embedded in configuration files. Configuration files often include IP address literals. See Don’t Use IP Address Literals.
Network preflighting. Many apps attempt to proactively check for an Internet connection or an active Wi-Fi connection by passing IP address literals to network reachability APIs. See Connect Without Preflight.
Using low-level networking APIs. Some apps work directly with sockets and other raw network APIs such as
gethostbyname
,gethostbyname2
, andinet_aton
. These APIs are prone to misuse or they only support IPv4—for example, resolving hostnames for theAF_INET
address family, rather than theAF_UNSPEC
address family. See Use High-Level Networking Frameworks.Using small address family storage containers. Some apps and networking libraries use address storage containers—such as
uint32_t
,in_addr
, andsockaddr_in
—that are 32 bits or smaller. See Use Appropriately Sized Storage Containers.
Ensuring IPv6 DNS64/NAT64 Compatibility
Adhere to the following guidelines to ensure IPv6 DNS64/NAT64 compatibility in your app.
Use High-Level Networking Frameworks
Apps requiring networking can be built upon high-level networking frameworks or low-level POSIX socket APIs. In most cases, the high-level frameworks are sufficient. They are capable, easy to use, and less prone to common pitfalls than the low-level APIs.
WebKit. This framework provides a set of classes for displaying web content in windows, and implements browser features such as following links, managing a back-forward list, and managing a history of pages recently visited. WebKit simplifies the complicated process of loading webpages—that is, asynchronously requesting web content from an HTTP server where the response may arrive incrementally, in random order, or partially due to network errors. For more information, see WebKit Framework Reference.
Cocoa URL loading system. This system is the easiest way to send and receive data over the network without providing an explicit IP address. Data is sent and received using one of several classes—such as
NSURLSession
,NSURLRequest
, andNSURLConnection
—that work withNSURL
objects.NSURL
objects let your app manipulate URLs and the resources they reference. Create anNSURL
object by calling theinitWithString:
method and passing it a URL specifier. Call thecheckResourceIsReachableAndReturnError:
method of theNSURL
class to check the reachability of a host. For more information, see URL Loading System Programming Guide.CFNetwork. This Core Services framework provides a library of abstractions for network protocols, which makes it easy to perform a variety of network tasks such as working with BSD sockets, resolving DNS hosts, and working with HTTP/HTTPS. To target a host without an explicit IP address, call the
CFHostCreateWithName
method. To open a pair of TCP sockets to the host, call theCFStreamCreatePairWithSocketToCFHost
method. For more information, see CFNetwork Concepts in CFNetwork Programming Guide.
If you do require the low-level socket APIs, follow the guidelines in RFC4038: Application Aspects of IPv6 Transition.
Note:Getting Started with Networking, Internet, and Web and Networking Overview provide detailed information on networking frameworks and APIs.
Don’t Use IP Address Literals
Make sure you aren’t passing IPv4 address literals in dot notation to APIs such as getaddrinfo
and SCNetworkReachabilityCreateWithName
. Instead, use high-level network frameworks and address-agnostic versions of APIs, such as getaddrinfo
and getnameinfo
, and pass them hostnames or fully qualified domain names (FQDNs). See getaddrinfo(3) Mac OS X Developer Tools Manual Page
and getnameinfo(3) Mac OS X Developer Tools Manual Page
.
Note: In iOS 9 and OS X 10.11 and later, NSURLSession
and CFNetwork
automatically synthesize IPv6 addresses from IPv4 literals locally on devices operating on DNS64/NAT64 networks. However, you should still work to rid your code of IP address literals.
Connect Without Preflight
The Reachability APIs (see SCNetworkReachability Reference) are intended for diagnostic purposes after identifying a connectivity issue. Many apps incorrectly use these APIs to proactively check for an Internet connection by calling the SCNetworkReachabilityCreateWithAddress
method and passing it an IPv4 address of 0.0.0.0
, which indicates that there is a router on the network. However, the presence of a router doesn’t guarantee that an Internet connection exists. In general, avoid preflighting network reachability. Just try to make a connection and gracefully handle failures. If you must check for network availability, avoid calling the SCNetworkReachabilityCreateWithAddress
method. Call the SCNetworkReachabilityCreateWithName
method and pass it a hostname instead.
Some apps also pass the SCNetworkReachabilityCreateWithAddress
method an IPv4 address of 169.254.0.0
, a self-assigned link-local address, to check for an active Wi-Fi connection. To check for Wi-Fi or cellular connectivity, look for the network reachability flag kSCNetworkReachabilityFlagsIsWWAN
instead.
Use Appropriately Sized Storage Containers
Use address storage containers, such as sockaddr_storage
, that are large enough to store IPv6 addresses.
Check Source Code for IPv6 DNS64/NAT64 Incompatibilities
Check for and eliminate IPv4-specific APIs, such as:
inet_addr()
inet_aton()
inet_lnaof()
inet_makeaddr()
inet_netof()
inet_network()
inet_ntoa()
inet_ntoa_r()
bindresvport()
getipv4sourcefilter()
setipv4sourcefilter()
If your code handles IPv4 types, make sure the IPv6 equivalents are handled too.
IPv4 | IPv6 |
---|---|
|
|
|
|
|
|
|
|
|
|
Use System APIs to Synthesize IPv6 Addresses
If your app needs to connect to an IPv4-only server without a DNS hostname, use getaddrinfo
to resolve the IPv4 address literal. If the current network interface doesn’t support IPv4, but supports IPv6, NAT64, and DNS64, performing this task will result in a synthesized IPv6 address.
Listing 10-1 shows how to resolve an IPv4 literal using getaddrinfo
. Assuming you have an IPv4 address stored in memory as four bytes (such as {192, 0, 2, 1}
), this example code converts it to a string (such as '192.0.2.1'
), uses getaddrinfo
to synthesize an IPv6 address (such as a struct sockaddr_in6
containing the IPv6 address '64:ff9b::192.0.2.1'
) and tries to connect to that IPv6 address.
Listing 10-1 Using getaddrinfo
to resolve an IPv4 address literal
Note: The ability to synthesize IPv6 addresses was added to getaddrinfo
in iOS 9.2 and OS X 10.11.2. However, leveraging it does not break compatibility with older system versions. See getaddrinfo(3) Mac OS X Developer Tools Manual Page
.
Test for IPv6 DNS64/NAT64 Compatibility Regularly
The easiest way to test your app for IPv6 DNS64/NAT64 compatibility—which is the type of network most cellular carriers are deploying—is to set up a local IPv6 DNS64/NAT64 network with your Mac. You can then connect to this network from your other devices for testing purposes. See Figure 10-6.
Important: IPv6 DNS64/NAT64 network setup options are available in OS X 10.11 and higher. In addition, a Mac-based IPv6 DNS64/NAT64 network is compatible with client devices that have implemented support for RFC6106: IPv6 Router Advertisement Options for DNS Configuration. If your test device is not an iOS or OS X device, make sure it supports this RFC. Note that, unlike DNS64/NAT64 workflows deployed by service providers, a Mac-based IPv6 DNS64/NAT64 always generates synthesized IPv6 addresses. Therefore, it does not provide access to IPv6-only servers outside of your local network, and may behave in unexpected ways if the server you are trying to reach claims to support IPv6, but doesn’t. See Limitations of Local Testing for more details.
To set up a local IPv6 Wi-Fi network using your Mac
Make sure your Mac is connected to the Internet, but not through Wi-Fi.
Launch System Preferences from your Dock, LaunchPad, or the Apple menu.
Press the Option key and click Sharing. Don’t release the Option key yet.
Select Internet Sharing in the list of sharing services.
Release the Option key.
Select the Create NAT64 Network checkbox.
Choose the network interface that provides your Internet connection, such as Thunderbolt Ethernet.
Select the Wi-Fi checkbox.
Click Wi-Fi Options, and configure the network name and security options for your network.
Select the Internet Sharing checkbox to enable your local network.
When prompted to confirm you want to begin sharing, click Start.
Once sharing is active, you should see a green status light and a label that says Internet Sharing: On. In the Wi-Fi menu, you will also see a small, faint arrow pointing up, indicating that Internet Sharing is enabled. You now have an IPv6 NAT64 network and can connect to it from other devices in order to test your app.
Important: To ensure that testing takes place strictly on the local IPv6 network, make sure your test devices don’t have other active network interfaces. For example, if you are testing with an iOS device, make sure cellular service is disabled so you are only testing over Wi-Fi.
Limitations of Local Testing
A Mac-based IPv6 DNS64/NAT64 network is a useful tool for testing your app in an IPv6 environment. However, because it always generates synthesized IPv6 addresses and transmits data on the WAN side using IPv4, it’s not an exact replica of the networks supplied by service providers. These networks (as well as the one used during App Review) do allow for direct IPv6-to-IPv6 connectivity. If your server is misconfigured, this might result in your app behaving differently in regular use or during review than it does in your local testing. It might even result in an App Review failure that is hard to reproduce in your own environment.
In particular, you may run into trouble if your server claims to support IPv6, but in practice does not. In this case, during your initial testing, your app appears to be communicating with your server via an IPv6 path, and thus behaves properly. However, your test network is actually translating the IPv6 traffic that your app generates to IPv4 traffic on the WAN. Therefore, you’re actually exercising your server’s IPv4 data path. Later, during App Review (or in the real world), the app operates identically, but the network makes a direct IPv6 connection to the server. If your server fails to respond properly to IPv6 traffic, your app fails to operate as expected, and might fail App Review.
To avoid this, in addition to using a Mac-based IPv6 DNS64/NAT64 test network to validate your app, independently verify that your server is working properly as an IPv6 server. For example, make sure that the server:
Has the correct DNS information. In addition to examining the server itself, you can use the command line tool
dig(1)
from your Mac to see how server reports its AAAA record.Is actually listening on IPv6. Use a tool like ipv6-test.com to test a web server (HTTP or HTTPS). For other protocols, you’ll need to verify this from a native IPv6 network.
Responds properly to IPv6 requests. If you have access, look at the server logs to verify that IPv6 traffic is being handled properly. If not, you’ll need to test from a native IPv6 network.
Resources
For more information on implementing networking, see:
For more information on the IPv6 transition, see:
For technical issues encountered while transitioning to IPv6, see:
Copyright © 2004, 2017 Apple Inc. All Rights Reserved. Terms of Use Privacy Policy Updated: 2017-03-27
These instructions will walk you through installing the required Data Science software stack for the UBC Master of Data Science program. Before starting, ensure that your laptop meets our program requirements:
- runs one of the following operating systems: macOS 10.15.X (Catalina), Ubuntu 20.04, Windows 10 Professional, Enterprise or Education; version 2004.
- Windows 10 Home is not sufficient as not all the software required for the program can be installed on that OS. Click here to download Windows 10 Education for free from UBC.
- When installing Ubuntu, checking the box “Install third party…” will (among other things) install proprietary drivers, which can be helpful for wifi and graphics cards.
- can connect to networks via a wireless connection for on campus work
- has access to an internet connection that is fast and stable enough for video calling and conducting online quizzes
- has at least 50 GB disk space available
- has at least 8 GB of RAM
- uses a 64-bit CPU
- is at most 6 years old at the start of the program (4 years old or newer is recommended)
- uses English as the default language
- student user has full administrative access to the computer
Students’ whose laptops do not meet the requirements specified above will not be able to receive technical assistance from the MDS team in troubleshooting installation issues.
Table of Contents
Installation notes
If you have already installed Git, Latex, or any of the R or Python related packagesplease uninstall these and follow the instructions below to reinstall them(make sure to also remove any user configuration files and backup them if desired).In order to be able to support you effectivelyand minimize setup issues and software conflicts,we require all students to install the software stack the same way.
In all the sections below,if you are presented with the choice to download either a 64-bit (also called x64)or a 32-bit (also called x86) version of the application always choose the 64-bit version.
Once you have completed these installation instructions,make sure to follow the post-installation notes at the endto check that all software is setup correctly.
UBC Student Email
Please sign up for a UBC Student Email. This account will also grant you access to a range of UBC services, including Microsoft Teams and OneDrive. To do so navigate to https://it.ubc.ca/services/email-voice-internet/ubc-student-email-service and follow the instructions under “Get Started”.
Web browser
In MDS we will be using many tools that work most reliably on Google Chrome and Firefox (including our online quiz software), so we recommend that you use one of these browsers.
- To install Chrome, go to https://www.google.com/chrome/, click on “Download Chrome” and follow the instructions on the website to finish the installation.
- To install Firefox, go to https://www.mozilla.org/en-US/firefox/new/, click on “Download Firefox” and follow the instructions on the website to finish the installation.
LastPass password manager
Some MDS courses (e.g. the capstone project) use the LastPass password manager to share credentials. Although we will not cover privacy and security topics until the second semester of the program, we recommend that you use a password manager such as LastPass to help you create strong passwords and store them securely, and to facilitate online authentication. You can sign up for a free LastPass account here: https://lastpass.com/create-account.php. We also recommend installing the LastPass Chrome or Firefox browser extension available here: https://lastpass.com/misc_download2.php.
Slack
For our MDS courses and program announcements, correspondence and course forums we use the communication tool Slack. Slack can be accessed via the web browser, however we strongly recommend installing the Slack App. The Slack app can be installed from the Mac App Store, or from the Slack website. Installation instructions from the Slack website install method are here: https://slack.com/intl/en-ca/help/articles/207677868-Download-Slack-for-Mac
Bash shell
Apple recently changed the Mac default shell in the Terminal to Zsh, however, we aim to teach with the same shell across all three operating systems we support, which is the Bash shell. Thus, we ask that you change the default shell in your Terminal to Bash by opening the Terminal (how to video) and typing:
You will have to quit all instances of open Terminals and then restart the Terminal for this to take effect.
Visual Studio Code
Installing
The open-source text editor Visual Studio Code (VS Code) is both a powerful text editor and a full-blown Python IDE, which we will use for more complex analysis. You can download and install the macOS version of VS Code from the VS code website https://code.visualstudio.com/download. Once the download is finished, click “Open with Archive utility”, and move the extracted VS Code application from “Downloads” to “Applications”.In addition to reading the getting started instructions, be sure to follow the “Launching from the command line” steps as well.
You can test that VS code is installed and can be opened from Terminal by restarting terminal and typing the following command:
you should see something like this if you were successful:
Note: If you get an error message such as -bash: code: command not found
, but you can see the VS Code application has been installed, then something went wrong with setting up the launch from the command line. Try following these instructions again, in particular you might want to try the described manual method of adding VS Code to your path.
GitHub
In MDS we will use the publicly available GitHub.com as well as an Enterprise version of GitHub hosted here at UBC, GitHub.ubc.ca. Please follow the set-up instructions for both below.
GitHub.com
Sign up for a free account at GitHub.com if you don’t have one already.
GitHub.ubc.ca
To add you to the MDS organization on Github.ubc.ca we need you to login to Github.ubc.ca using your CWL credentials.
This step is required for
- being able to store your work
- all homework submission and grading
- working collaboratively
Git
We will be using the command line version of Git as well as Git through RStudio and JupyterLab. Some of the Git commands we will use are only available since Git 2.23, so if you’re Git is older than this version, we ask you to update it using the Xcode command line tools (not all of Xcode), which includes Git.
Open Terminal and type the following command to install Xcode command line tools:
After installation, in terminal type the following to ask for the version:
you should see something like this (does not have to be the exact same version) if you were successful:
Note: If you run into trouble, please see that Install Git > Mac OS section from Happy Git and GitHub for the useR for additional help or strategies for Git installation.
Configuring Git user info
Next, we need to configure Git by telling it your name and email. To do this type the following into the terminal (replacing Jane Doe and janedoe@example.com, with your name and email (the same used to sign up for GitHub), respectively):
Note: to ensure that you haven’t made a typo in any of the above, you can view your global Git configurations by either opening the configuration file in a text editor (e.g. via the command code ~/.gitconfig
) or by typing git config --list --global
.
Setting VS Code as the default editor
To make programs run from the terminal (such as git
) use vscode by default, we will modify ~/.bash_profile
. First, open it using VS Code:
Note: If you see any existing lines in your ~/.bash_profile
related to a previous Python or R installation,please remove these.
Append the following lines:
Then save the file and exit VS Code.
Most terminal programs will read the EDITOR
environmental variable when determining which editor to use, but some read VISUAL
, so we’re setting both to the same value.
Python, Conda, and JupyterLab
Python and Conda
We will be using Python for a large part of the program, and conda
as our Python package manager. To install Python and the conda
package manager, we will use the Miniconda platform (read more here), which Miniconda MacOSX 64-bit pkg install for Python 3.8 can be downloaded here..
After installation, restart the terminal. If the installation was successful, you will see (base)
prepending to your prompt string. To confirm that conda
is working, you can ask it which version was installed:
which should return something like this:
Note: If you see zsh: command not found: conda
, see the section on Bash above to set your default Terminal shell to Bash as opposed to Zsh.
Next, type the following to ask for the version of Python:
which should return something like this:
Note: If instead you see Python 2.7.X
you installed the wrong version. Uninstall the Miniconda you just installed (which usually lives in the /opt
directory), and try the installation again, selecting Python 3.8.
Essential Python packages
conda
installs Python packages from different online repositories which are called “channels”.A package needs to go through thorough testing before it is included in the default channel,which is good for stability,but also means that new versions will be delayed and fewer packages are available overall.There is a community-driven effort called the conda-forge (read more here),which provides more up to date packagesTo enable us to access the most up to date version of the Python packages we are going to use,we will add the more up to date channel,To add the conda-forge channel by typing the following in the terminal:
To install packages individually, we can now use the following command: conda install <package-name>
. Let’s install the key packages needed for the start of our program:
conda
will show you the packages that will be downloaded,and you can press enter to proceed with the installation.If you want to answer yes
by default and skip this confirmation step,you can replace conda install
with conda install -y
.
Note: we will use many more packages than those listed above across the MDS program, however we will manage these using virtual environments (which you will learn about in DSCI 521: Platforms for Data Science).
JupyterLab setup
We will be using the Jupytext Python package and the JupyterLab git extension to facilitate using Jupyter notebooks with Git & GitHub. Install them via the following commands:
To test that your JupyterLab installation is functional, you can type jupyter lab
into a terminal, which should open a new tab in your default browser with the JupyterLab interface.To exit out of JupyterLab you can click File -> Shutdown
,or go to the terminal from which you launched JupyterLab and hold Ctrl
while pressing c
twice.
R, XQuartz, IRkernel, and RStudio
R is another programming language that we will be using a lot in the MDS program. We will use R both in Jupyter notebooks and in RStudio.
R
Go to https://cran.r-project.org/bin/macosx/ and download the latest version of R for Mac (Should look something like this: R-3.6.1.pkg). Open the file and follow the installer instructions.
After installation, in Terminal type the following to ask for the version:
You should see something like this if you were successful:
Note: Although it is possible to install R through conda, we highly recommend not doing so. In case you have already installed R using conda you can remove it by executing conda uninstall r-base
.
XQuartz
Some R packages rely on the dependency XQuartz which no longer ships with the Mac OS, thus we need to install it separately. Download it from here: https://www.xquartz.org/ and follow the installation instructions.
RStudio
Download the macOS Desktop version of RStudio Preview from https://rstudio.com/products/rstudio/download/preview/. Open the file and follow the installer instructions.
To see if you were successful, try opening RStudio by clicking on its icon (from Finder, Applications or Launchpad). It should open and look something like this picture below:
Essential R packages
Next, install the key R packages needed for the start of MDS program,by opening up RStudio andtyping the following into the R console inside RStudio:
Note: we will use many more packages than those listed above across the MDS program, however we will manage these using the renv
package manager (which you will learn about in DSCI 521: Platforms for Data Science).
IRkernel
The IRkernel
package is needed to make R work in Jupyter notebooks. To enable this kernel in the notebooks, install by pasting the following command into the RStudio Console:
Next, open a terminal and type the following(you can’t use RStudio for this stepsince it doesn’t honor $PATH
changes in ~/.bash_profile
)
To see if you were successful, try running JupyterLab and check if you have a working R kernel. To launch the JupyterLab type the following in Terminal:
A browser should have launched and you should see a page that looks like the screenshot below. Now click on “R” notebook (circled in red on the screenshot below) to launch an JupyterLab with an R kernel.
Sometimes a kernel loads, but doesn’t work as expected. To test whether your installation was done correctly now type library(tidyverse)
in the code cell and click on the run button to run the cell. If your R kernel works you should see something like the image below:
To improve the experience of using R in JupyterLab,we will add an extension that allows us to setup keyboard shortcuts for inserting text(thanks to former MDS student Ryan Homer for developing this extension!).By default,it creates shortcuts for inserting two of the most common R operators: <-
and %>%
.Run the following from terminal to install the extension:
To check that the extension is working,open JupyterLab,launch an R notebook,and try inserting the operators by pressing Alt
+ -
or Shift
+ Command
+ m
, respectively.
LaTeX
We will install the lightest possible version of LaTeX and it’s necessary packages as possible so that we can render Jupyter notebooks and R Markdown documents to html and PDF. If you have previously installed LaTeX, please uninstall it before proceeding with these instructions.
First, open RStudio and run the following commands to install the tinytex
package and setup tinytex
:
Note: You might be asked to enter your password during installation.If you see an error message towards the end of the installationtelling you that /usr/local/bin
is not writeable,you will need to open a terminal and run the following two commands before proceeding:
You can check that the installation is working by opening a terminal and asking for the version of latex:
You should see something like this if you were successful:
The above is all we need to have LaTeX work with R Markdown documents, however for Jupyter we need to add several more packages. Do this by opening a terminal and copying the following there press enter:
To test that your latex installation is working with jupyter notebooks,launch jupyter lab
from a terminal and open either a new notebookor the same one you used to test IRkernel above.Go to File -> Export notebook as... -> Export Notebook to PDF
.If the PDF file is created,your LaTeX environment is set up correctly.
PostgreSQL
We will be using PostgreSQL as our database management system. You can [download PostgreSQL 12.4 from here (do not select version 13). Follow the instructions for the installation. In the password page, type whatever password you want, but make sure you’ll remember it later. For all the other options, use the default. You do not need to run “StackBuilder” at the end of the installation (if you accidentally launch the StackBuilder, click “cancel”, you don’t need to check any boxes).
To test if the installation was successful open the SQL Shell
app from the LaunchPad or applications directory. You will be asked to setup your configuration, accept the default value (the one within square brackets) for the first four values by pressing enter four times, then type in your password and press enter one last time. It should look like this if it is working correctly:
Docker
You will use Docker to create reproducible, sharable and shippable computing environments for your analyses. For this you will need a Docker account. You can sign up for a free one here.
After signing-up and signing into the Docker Store, go here: https://store.docker.com/editions/community/docker-ce-desktop-mac and click on the “Get Docker” button on the right hand side of the screen. Then follow the installation instructions on that screen to install the stable version.
To test if Docker is working, after installation open the Docker app by clicking on its icon (from Finder, Applications or Launchpad). Next open Terminal and type the following:
you should see something like this if you were successful:
VS Code extensions
The real magic of VS Code is in the extensions that let you add languages, debuggers, and tools to your installation to support your specific workflow. Now that we have installed all our other Data Science tools, we can install the VS Code extensions that work really well with them. From within VS Code you can open up the Extension Marketplace (read more here) to browse and install extensions by clicking on the Extensions icon in the Activity Bar indicated in the figure below.
To install an extension, you simply search for it in the search bar, click the extension you want, and then click “Install”. There are extensions available to make almost any workflow or task you are interested in more efficient! Here we are interested in setting up VS Code as a Python IDE. To do this, search for and install the following extensions:
- Python (everything Python: notebooks, debugging, linting, formatting, etc.)
- markdownlint (markdown linting and style checking extension)
- GitLens - Git supercharged (powerful extension that extends VS Code’s native git capabilities)
- Docker (easily use Docker from VS Code)
- (Optional) Material Theme and/or Predawn Theme Kit (additional colour themes to choose from)
- (Optional) Material Icon Theme (great-looking custom file icons!)
- (Optional) Bracket Pair Colorizer 2 (add colour to help distinguish your brackets: (), [], {})
This video tutorial is an excellent introduction to using VS Code in Python.
Improving the bash configuration
To improve your experience using bash,we recommend appending a few lines to the end of your bash configuration file.This is optional,but makes it easier to use the TAB key for autocompletionand improves how bash handles the command history(we will talk more about these topics during class).It also adds colors to the terminal’s text,which can make it easier to navigate visually.First,open the configuration file:
Then paste the following at the end of the file(make sure not to overwrite any existing lines)and save it afterwards:
Post-installation notes
You have completed the installation instructions, well done 🙌!We have created a script to help you check that your installation was successful,and to provide instructions for how you can troubleshoot any potential issues.To run this script,please execute the following command from your terminal.
The output from running the script will look something like this:
Dino Wars Test 0 0 2 Mac Os Catalina
As you can see at the end of the output,a log file is saved in your current directory.We might ask you to upload this fileif we need to troubleshoot your installation,so that we can help you more effectively.If any of your packages are marked as “MISSING”you will need to figure out what is wrong and possibly reinstall them.Once all packages are marked as “OK”we will ask you to submit this log file,so that we can confirm that your installation was successful.Details on where to submit will be provided later.
Dino Wars Test 0 0 2 Mac Os X
Note that in general you should be careful running scripts unless they come from a trusted source as in this case (just like how you should be careful when downloading and installing programs on your computer).
Dino Wars Test 0 0 2 Mac Os 7
Attributions
Dino Wars Test 0 0 2 Mac Os Download
- UBC STAT 545 licensed under the CC BY-NC 3.0.