Jump to content

Mod:Hunt Research Group/CubePy setup

From ChemWiki

getting started

  • Install the 3.5 Python version ofCanopy
  • Open the Canopy terminal: Canopy → (Tab menu) Tools → Canopy Terminal
This is like the regular terminal window, but instead of using your default Python version, it uses the one from Canopy which has all the necessary modules to run CubePy. We will use the Canopy terminal to run CubePy.
  • copy and paste the following python code into a file called test_python.py
# -*- coding: utf-8 -*-
"""
Created on Fri Jun  8 11:22:21 2018

@author: Oxana
"""

import sys
import collections as cd
import time
from operator import itemgetter
import matplotlib
matplotlib.use('TkAgg')
from mpl_toolkits.mplot3d import Axes3D, proj3d
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.cm as cm
from pylab import NaN
import math
from matplotlib.widgets import Slider
from matplotlib.widgets import RadioButtons
from scipy import stats
from mayavi import mlab
from traits.api import HasTraits, Range, Instance, on_trait_change
from traitsui.api import View, Item, Group
from mayavi.core.api import PipelineBase
from mayavi.core.ui.api import MayaviScene, SceneEditor, MlabSceneModel
import pandas as pd
from decimal import Decimal

print("\nAll modules imported successfully.\n")
  • run the code by typing python test_python.py
  • if might not work the first time around, you might get an error like the following
(User)[tricia@ch-pepper]/Users/tricia/Work/Jobs/oxana $ python test_python.py
Traceback (most recent call last):
  File "/Users/tricia/Library/Enthought/Canopy/edm/envs/User/lib/python3.5/site-packages/pyface/qt/__init__.py", line 29, in <module>
    import PySide
ImportError: No module named 'PySide'
  • so if you get any errors regarding PySide/PyQt4, you can try the following:
Open the Canopy Package Manager
Go to the "Available" packages tab
Type "pyqt" in the search bar at the top of the window.
Select the pyqt package, and click "Install"
  • you should then get something like this
(User)[tricia@ch-pepper]/Users/tricia/Work/Jobs/oxana $ python test_python.py
All modules imported successfully.
  • now go back to the main page and download CubePy