Installing GX Developer

Installing GX Developer

GX Developer is freely available from the Geosoft software download page (https://my.geosoft.com/downloads/gx-developer-toolkit).

GX Developer includes :

  1. GX language (GXC) support to create your own compiled Geosoft GX tools that run directly from Oasis montaj.  This includes GX code compiler (GXC), GX resource (GUI) compiler (GRC), and GX headers (GXH) for all GX API functions.
  2. All source code (GXC, .NET) that are released as part of Oasis montaj and can be used as examples and programming patterns.
  3. 64-bit GX API to access Geosoft from extensions and external programs:
  4. Example programs in Python, .NET, and C++.
  5. Access to the GX Developer Forum in My Geosoft.

On this page

To install GX Developer, run the installation program.  This will create a folder named C:\Program Files\Geosoft\GX Developer\.  The contents are organized as follows:

FolderContent
cpp/examples/example source code for C, C++ and MFC. The MFC examples demonstrate the creation of XTools.
cpp/include/Header files that document the API for C and C++
cpp/lib/C and C++ library files.
gx/bin/GX Developer compilers and tools.
gx/include/GXC header files, which document the GX API for use in GX programs.
gx/src/All Geosoft GX source files, which can be used as examples to develop your own GX.
gxnet/examples/C# (.NET) examples, including an XTool example.
gxnet/src/All Geosoft C# source code and XTools.
hlp/Redirection to this on-line help resource.
python/


redist/binredistributable files to support use of the API without Geosoft Desktop installed.

Installing Python for GX Developer

Configuring your system to run Python involves first installing a Python distribution and the Python packages that your application requires; then installing the Geosoft Python package.

Note that Python can be configured many ways depending on your needs.  Here we describe the configuration recommended by Geosoft. Advanced Python developers may choose other configuration options. If you choose an alternate configuration you should understand the details of the Geosoft recommendation so that you can configure your system correctly.

Frequently Asked Questions

Python version 2.7 or 3? The Geosoft distribution packages only support Python version 3.4 (and later).  Python 2.7 (released in 2010) was the end of development for Python 2.x, and for this reason we have chosen not to support Python 2.7 (or earlier). If you are new to Python, you should start with Python 3.  If you have legacy Python 2 code that you want to run with a Geosoft environment you may need to make modifications to the code to work with Python 3. See https://docs.python.org/2/howto/pyporting.html for infomation on what may be required to port Python 2 code to Python 3.

Which Python distribution? There are many distributions of Python, but Geosoft uses and recommends the Anaconda distribution (https://www.continuum.io/downloads) as this includes all the packages that are required to work with Geosoft code together with the most important and widely used packages that make up what is considered complete for a scientific application. 

Which IDE? At Geosoft we use and recommend the PyCharm IDE (http://www.jetbrains.com/pycharm/), which has both a no-cost "Community Edition" intended for education and personal use, and a very reasonably priced "Professional Edition" for professional use. Note that most complete Python distributions also include IPython. Although not strictly an IDE, IPython does provide an environment for rapid algorithm development, experimentation and documentation and can be very effective for research projects.

Anaconda Python Distribution

We recommend using the Anaconda Python 3 (3.4 or later) 64-bit distribution for Windows.  Choose the most recent version of 64-bit installer for Windows from https://www.continuum.io/downloads.

Once installed, add the Anaconda python folder to your system path so that you can run python.exe from the command line.  To verify that Python 3.5 is installed:

C:\>python.exe -V
Python 3.5.2 :: Anaconda 4.2.0 (64-bit)

If you do not get the expected Python version number (3.5.x), something went wrong with the installation. Check that the correct python.exe can be found in the system path.

If you are managing multiple Python environments using the Anaconda "conda" package manager, ensure that the correct environment is activated. You may need to activate "py35":

C:\>activate py35
(py35) C:\>python.exe -V
Python 3.5.2 :: Anaconda 4.2.0 (64-bit)

Installing the Geosoft Python Package

Each release package will be published on the Python Package Index, which supports installation using pip.

The following will install the Geosoft package:

StepWhatComments
1Install package with pip
C:\><PYTHON_HOME>\Scripts\pip.exe install geosoft==9.1

Or by running pip as a module:

C:\>python.exe python -m pip install geosoft==9.1
3Validate your setup
python.exe
Python 3.5.2 |Anaconda 4.2.0 (64-bit)| (default, Jul  5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import geosoft.gxpy.gx as gx
>>> gxp = gx.GXpy()
>>> print(gxp.gid)
   ... your Geosoft ID should be printed to the console
>>> exit()

The first line imports geosoft.gxpy.gx symbols from the Geosoft gxpy module. This confirms that the Geosoft Python modules were correctly installed into Python site packages.

The second line creates a gx context and returns the context object. If you are not signed-in to Geosoft you will be asked to sign-in. A GX context is required before calling any GX API methods.

One of the gx object members is 'gid', which is your Geosoft ID. The third line displays your Geosoft ID.

The last line exits the Python script.

If this test works without reporting errors your system is properly configured.

Development process for the Geosoft Python Package

The following describes the development process for changing the Geosoft package. Refer to the section above for simply installing and using the package.

Geosoft maintains the source code for the most current Python module on github:

RepositoryDescription
https://github.com/GeosoftInc/gxpyGeosoft gxpy module for Python. This includes both the complete GX API for Python (geosoft.gxapi) and a "pythonic" interface (geosoft.gxpy) to the main GX API functions names "gxpy". Over time, we expect geosoft.gxpy to expand to wrap more of the full geosoft.gxapi into a simpler and more python-oriented interface.

You should clone the repositories to a location on your system (step 1 below).  If you are unfamiliar with github, see https://help.github.com/.

The following will checkout the gxpy project from Github and set it up for active development with your Python distribution:

StepWhatComments
1Clone the Geosoft Python repositories

Open a command shell and go the folder where you want to locate the Geosoft Python files. From here we will clone the Geosoft repositories, which will create sub-folders "gxpy" and "gxpy-examples":

git clone https://github.com/GeosoftInc/gxpy
2

Setup module for development in your Python environment:


cd gxpy
python setup.py develop

Note: The "develop" option links to the files where you cloned the repository instead of installing it in <PYTHON_HOME>\Lib\packages.