-
Notifications
You must be signed in to change notification settings - Fork 2
Installation
This installation guide is focused on getting first time users started on the FiskCubeSat code repository. Advanced users can skip most (or all) of this installation guide. Please make improvements to this guide as issues are exposed or updates to systems change the optimal path of installation.
It is always a good idea to back up your commuter before making any major changes. That way you can always start over if something undesirable (catastrophic) happens. I do ask you to do some administrate level stuff here, stay brave, and know that you can revert of backup of your computer if things get out of hand.
This guide was last Modified On September 19, 2017: Mac installation instructions were added based on a fresh install on a new 13-inch 2017 Macbook Air running OSX 10.12.6.
This is a list of programs and internet accounts that I use to work with python seamlessly across many platforms. If you are my student, then this will be how I will send and update code that we write together. This pieces of software, however useful, are not necessary to use Python.
You first need to check if you computer is running a 32-bit or 64-bit version of your computer operating system. Most computers have been 64-bit for a few years.
1.1 Find window _Settings
1.2 Click on System Settings
1.3 Click on About
1.4 Scroll to System Type and there you can find information about the bit-ness of your operating system (OS) and your processor. Mine says "System type 64-bit operating system, x64-based processor"
1.1 Click on the 'apple' (in the upper left of the screen) drop down menu, and select "System Preferences"
1.2 On my Computer it says in macOS Serra, Version 10.12.6, if you are running 10.7.x or higher, you have a 64-bit machine, you can ignore the remaining steps and choose 64 bit software from this point on.
1.3 If you are running OSX 10.6.x or lower, click the "System Report..." button.
1.4 The default table shown is "Hardware Overview", on the row named "Processor Name:" you can find the name of your processor. If you have "Intel Core Solo", or and "Intel Core Duo" you have a 32-bit machine. If you have "Intel 2 Core Duo", "Intel Quad-Core Xeon", "Dual-Core Intel Xeon", "Quad-Core Intel Xeon", "Core i3", "Core i5", "Core i7" or something even newer, then you have 64-bit CPU and therefore a 64-bit OS.
2.1 Download the version of GIT for Windows, if you are lucky the link will still exist here: https://git-scm.com/download/win
2.2 Run the downloaded program, and start the installation.
2.3 I unchecked the Windows Explorer integration and its sub-options.
2.4 I selected use GIT from the Windows Command Prompt
2.5 I selected Use the OpenSSL library
2.6 Please select Chechout Windows-style, commit UNIX style line endings
2.7 I selected Use Widows' default console window.
2.8 I left Enable file system caching and Enable GIT Credential Manager checked.
This is mostly the default installation, anyone willing to provide feedback on how these choices effect the end result is appreciated.
2.1 Download the version of GIT for Mac, if you are lucky the link will still exist here: https://git-scm.com/download/mac
2.2 Open the dmg file from "downloads" or where ever you put it.
2.3 right click on the installer package (For me, the icon is a box and has the name 'git-2.14.1-intel-universal-mavericks.pkg'), from the pop up menu select "open". It will ask you if you are sure (you are) click the "open" Button.
2.4 Do the default install, just agree with everything the install does and be greatful you are not using Windows.
Step 3: Sign up for GitHub, an online code repository and version control service (free for what we are using it for). Skip this step if you already have a GitHub account
3.1 Create a username, and password by signing up here https://github.com/.
3.2 Don't forget to confirm you email address at the end of the sign up.
Note: this is the site that hosts the FiskCubeCat code and this wiki that you are currently reading.
4.1 Download the PyCharm Community Edition for your Window' computers' bitness at the following link. https://www.jetbrains.com/pycharm/download/#section=windows
4.2 Run the the downloaded program and start the installation.
4.3 I selected to create a 64-bit launcher and to make associations with files the end in the suffix .py, otherwise I did the default installation.
4.4 Finish the installation and run PyCharm. Proceed to the finishing steps for step 4 below.
4.1 Download the PyCharm Community Edition for your Mac computer at this link https://www.jetbrains.com/pycharm/download/#section=mac
4.2 Once downloaded, click on the dmg file to start the installation. Then drag the PyCham application in the applications folder to start the installation.
4.3 Launch PyCham from the applications folder, when asked, your sure you want to open it, hit the "open" button. Proceed to the finishing steps for step 4 below.
4.5 For a fresh install for a new computer, select Do not import settings
4.6 Accept the privacy policy.
4.7 I like the following settings for PyCharm's Keymap and look; Keymap scheme: IntelliJ IDEA Classic,
IDE theme: Darcula, Editor colors and fonts: Monokai.
5.1 Launch PyCharm and select Check out From Version Control and from the drop down menu select GitHub.
5.2 Change Auth Type: to password and enter the user name and password that you registered and confirmed in step 3.
5.3 For the Git Repository ULR carefully cut-and-paste https://github.com/chw3k5/fiskCubeSat.git. The other test boxes should look like Parent Directory: C:\Users\my username\PycharmProjects, and Directory Name: fiskCubeSat
5.4 Click on Clone
5.5 Close the tip of the day
5.6 In the lower-left of the PyCharm Window, click on the small square icon. This pops up short cuts to some of the many development features for PyCharm
5.7 In the left side of the window click on project to expand the directory structure of the Fisk CubeSat code repository.
5.8 Expand the directory structure by clicking on the clicking on the triangle to the left of fiskCubeSat and select a .py file to open.
This step can be skipped if you already have python 2.7 somewhere on your computer. This is the case for most mac computer and unix based systems. However, I recommend installing the latest version of Python on your Mac in addition to the Python that it comes with.
6.1 Navigate to https://www.python.org/downloads/windows/ and click the link for Latest Python 2 release At the time this wiki was written it was python 2.7.13. I expect it to be python 2.7.x, as micro releases are now the only updates for Python 2. This micro releases mostly add backwards compatibility for Python 2 to work with new projects and ideas that are made for Python 3.
6.2 depending on the bit-ness of your computer (see step 1) you will use a different installer. For 64-bit installation I selected Windows x86-64 MSI installer to download.
6.3 Run the Python installer.
6.4 Install for all users. Install in _C:\Python27_. This is the default installation. Window may complain about a program making change to your computer, allow those changes.
6.5 Finish the installation
Let us install the latest version of Python 2.7 on our Mac. These instructions are based on the Hitchhiker's Guide to Python
6.1 Open up the "Terminal application" type 'terminal' using the application search feature. This will bring up and a good olde fashion command line.
6.2.1 Installing X code and the developer tools, this includes compiler's for c-code. Type xcode-select --install into the command line and hit enter.
6.2.2 This will open a pop up window asking if you want to first install the Xcode Developer Tools, you do. Click the "install" button. Hit "Done" when process completes.
6.3.1 Time to install "HomeBrew" a package manager for Python. In the terminal enter /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" and press return
6.3.2 Press return again to agree create directories needed for the install. Enter your users admin password when prompted.
6.3.3 You will need to add a line for the HomeBrew "PATH" variable to your ".profile". For me this file needed to be created, for you it may already exist. I will use the nano text editor to do this. Type "cd" and hit return to get to you home directory. Then "nano .profile" and hit return.
6.3.4 For me this created a new black file. I added "export PATH=/usr/local/bin:/usr/local/sbin:$PATH" on the first line and then hit "enter" to leave one black line at the bottom of the file.
6.3.5 To save this file I use "ctrl o" (hold the control button and press the letter 'o'). Then I accepeted the suggestion of writing out the file name as ".profile" by hitting enter. I close the editor by using "ctrl x"
6.3.5 You can use the terminal command "ls -a" to see the file you just created in a list of hidden (files that start with ".") and use "nano .profile" to edit it again. This competes the HomeBrew installation.
6.4 Now things are easier, install python 2.7 from the terminal by typing "brew install python" and hit enter. this installs python 2.7. If you want to install python 3 use the command "brew install python3"
6.5 At this point I now have 3 versions of python installed on my computer. The systems version python that can be executed using the command "python" (use "python -V to see the version mine was Python 2.7.10), the version of python 2 I just install that can be executed using the command "python2" (use "python2 -V to see the version mine was Python 2.7.13), and the version of python 3 I just installed which is executed using the command "python3" (use "python3 -V to see the version mine was Python 3.6.2).
Note: This also installed the packages Setuptools and pip. The pip command for python 2 is "pip2" and the pip command for python 3 is "pip". I did not install a pip that relates to system's python. For installations of other packages that you find outside this guide, the instructions may read something like "pip install scipy" but you will need to interoperate that as "pip2 install scipy" as "pip" alone will refer to the a package manager for the system's version of python. For this reason I choose not to install pip for the system's python, so the the error "-bash: pip: command not found" will remind me that I need to use "pip2" or "pip3" in place of "pip"
There are a lot of different versions of Python in the world like there are many dialects of english in the United states. The interpreter links what version of python you are using so that PyCham can understand how any code will be executed and make suggestions about whether the syntax of your will lead to successful execution, or whether will fail when it is commanded to run. This is one of the best things about PyCham for me, it tells me when I am making simple but hard to spot mistakes. The interpreter links the version of Python that you will use to run your code with the code that you writing the editor window.
7.1 Open fiskCubesat protect in PyCharm.
7.2 In PyCharm, Windows go to File -> Settings (Or Use Ctl-Alt-S). Then select click the triangle next to Project: fiskCubeSat Mac go to Pycham Community Edition -> Preferences (Or Use Command-,). Then select click the triangle next to Project: fiskCubeSat and select "Project Interpreter".
7.3 In the main settings window area for the Project Interpreter, as you gaze to the right, you will see the entry at the top of the window for Project Interpreter: with a drop down menu.
7.4 Click on the down triangle for the drop down menu and select the (which may have been freshly installed in step 6) Windows C:\Python27\python.exe. Mac /usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/bin/python2.7
7.5 Click the Apply button at the bottom-right of the settings window, then hit the OK button. This will kick of some background tasks (indexing) the will take moment to complete. But when they are competed, you should no longer see the warning message about needing to install an interpreter.
If you followed all the step above using a mac, then open up the terminal application type enter the following lines to install all the packages you will need. If you need any other packages this is the formula to follow "pip2 install thepackagename". This is the last step for those using a Mac, Windows users need to do two more steps.
pip2 install pyserial
pip2 install numpy
pip2 install matplotlib
pip2 install scipy
Note: "pip2" replace the command the standard "pip" command for this guide as discussed in the note in Step 6.
PyCharm is a great way to maintain and update additional packages to python. But sometimes this fails. Particularity for the scipy package. If this happens you will need to see the additional steps below that have work around for failed package installations.
8.1 Open fiskCubesat protect in PyCharm.
8.2 In PyCharm, go to File -> Settings (Or Use Ctl-Alt-S). Then select click the triangle next to Project: fiskCubeSat and select "Project Interpreter".
8.3 In the main settings window area on the right, you will see the entry at the top of the window for Project Interpreter: with a drop down menu. If you have been following this guide the the interpreter will be C:\Python27\python.exe but any Python 2.7 interpreter will do.
8.4 To add a Python 2.7 package, click on the green 'plus' icon on near the upper right of the settings window.
8.5 Search for the package you want to install, such as numpy, once selected click install package.
8.6 If you are lucky A green bar will appear that says _Package 'package name' installed successfully. Some packages can be installed through this process but some cannot. If the installation fails for some or all of the packages you need see the additional package installation steps below.
Packages known to install successfully using PyCharm: numpy pyserial matplotlib
Scipy is not an easy package to install. It uses a lot of precompiled c programs to do math really fast, which is a good thing. However, these files need to be compiled for the your computer's CPU architecture so this mean a custom installation. The main issue is the BLAS, a precompiled http://www.lfd.uci.edu/~gohlke/pythonlibs algebra toolbox.
This step assumes you have installed python as outlined in step 6. This step uses the ideas from http://stackoverflow.com/questions/28190534/windows-scipy-install-no-lapack-blas-resources-found
9.1 Download the numpy+mkl and scipy wheel files from http://www.lfd.uci.edu/~gohlke/pythonlibs.
9.2 Use ctl+F to search for the phrase 'Numpy+mkl' and click on the link to find those binary files. Download the latest file for the correct bitness (see step 1) for your computer, I downloaded numpy‑1.12.1+mkl‑cp36‑cp36m‑win_amd64.whl. You should look for the latest versions of the files.
9.3 Use ctl+F to search for the phrase 'Scipy' and click on the link to find those binary files. Download the latest file for the correct bit-ness (see step 1) for your computer, I downloaded scipy‑0.19.0‑cp36‑cp36m‑win_amd64.whl.
9.4 Download Microsoft Visual Studio Community Edition from https://www.visualstudio.com/downloads/, and run the program.
9.5 Install the Microsoft Visual Studio Community base package, with all c++, .net frameworks, and python add-ons.
9.6 When prompted, make a visual studio's account.
9.7 Download Microsoft C++ compiler for Python 2.7 here https://www.microsoft.com/en-us/download/details.aspx?id=44266 and run the program. This installation has no options.
9.8 Run the windows command prompt (search for the program 'cmd').
9.9 When cmd is open it will be a black window with white text that says something like 'C:\Users\yourUserName>' type 'cd ../../' to get to the part of the C drive where python is installed. Here 'cd' means change directory and '../' means go to parent directory of the current directory, we do that twice to get to 'C:>'
9.10 change directory to python 2.7 on my computer that is in C:\Python27\ so I type 'cd Python27' and the prompt will then read 'C:\Python27>'
9.11 enter the command python -m pip install directoryName\filename.whl to install Numpy with mkl and scipy. directoryName will be where you downloaded Numpy+mkl and scipy in parts b) and c) of this step. For me this was the commands
python -m pip install "C:\Users\little pc\Downloads\numpy-1.12.1+mkl-cp27-cp36m-win_amd64.whl"
and then
python -m pip install "C:\Users\little pc\Downloads\scipy-0.19.0-cp27-cp36m-win_amd64.whl"
to be clear the pattern is
python -m pip install "C:\WhereTheFileIs\TheNameOfTheFileYouDownloaded"
One erro that I have encountered was where windows said "...is not a supported wheel on this platform" the magic to fix this was to use "scipy-0.19.0-cp36-cp27m-win_amd64.whl" instead of "scipy-0.19.0-cp36-cp33m-win_amd64.whl" the difference was the "cp27" this stands for cPython2.7 instead of cp33 for cPython3.3. You need to use the cPython that is the same the python distribution that you are using, in this case it is cp27 for python 2.7.
You did it! I am so proud of you! Let me know if there are mistakes or things that have changed since I wrote this guide.