Skip to content

Installing pygslib with conda

Adrian Martinez edited this page Nov 18, 2020 · 16 revisions

Preliminaries

Pygslib is distributed as a conda package and is available for Windows, Linux and macOS. The conda package only supports Python 3.8 (64 bits).

Quick Guide: Installing PyGSLB with Miniconda

This is the fastest and easier way to install pygslib for user without other python distributions, including pre-existing Anaconda or Miniconda installations.

  1. Go to https://conda.io/miniconda.html and download Miniconda 64 bits for Python 3.8

    Execute the installer and follow the instructions until you get this window.

    Add Anaconda to the Path

    Check the option of adding anaconda to the path if you want to get better access to the program from anywhere in your computer and you don't have another "important" python distribution. This will facilitate a lot of the work with python.

  2. Downgrade Python to the version 3.8

    If Miniconda comes with Python version over 3.8 you will need to downgrade Python. Open a terminal and type: conda install python=3.8 and press enter

    Downgrade Python

    press y and enter when requested.

    Downgrade Python

    The entire process will take few minutes

it is recommended using virtual environments to avoid braking existing conda installations.
To create a virtual environment, use the command conda create --name <your preferred env name> python=3.8 and activate it with conda activate <your preferred env name>

  1. Install PyGSLB

    Now you are ready to install pygslib, just type (or copy and paste) conda install pygslib -c opengeostat -c conda-forge in the terminal and press enter

    Install Pygslib

    press y and enter when requested and conda will download and install pygslib and its dependencies and the dependencies of the dependencies, this may be a long list.

    Install Pygslib

  2. Testing the installation

    At this point, we recommend using Chrome, Safari, or Firefox as default browser, IE explorer is not supported and is problematic...

    Download this demo and unpack the file into a working directory, for example, ~/Desktop/Demo1.

    Open a terminal inside this directory, for example, by typing cmd in the address bar of windows explorer, as shown in the image below.

    Test Pygslib

    Then, type in the terminal the command jupyter notebook.

    Test Pygslib

    Note: Here we are assuming that you already have Jupyter, if not, please install it using the command conda install jupyter and try again.

    This will open a Jupyter Notebook dashboard in your browser

    Test Pygslib

    Click on Demo small version.ipynb to open the example and click on Cell/Run All.

    Test Pygslib

    This will run a mineral resource estimate.

    Scroll down to make sure that all cells were executed. The last cell (In [30]:) may look like this:

    Test Pygslib

    If you get an error please describe it here:

    https://github.com/opengeostat/pygslib/issues

Installing some useful non-python programs

You may need Paraview to visualize drillholes and block models, it is available at https://www.paraview.org/download/

Just install the program, open it, and drag and drop files with extension *.vtuand *.vtp generated in the example above to generate visualizations like this one.

Test Pygslib

Do I have conda?

To see if you have a conda distribution, open a terminal (linux/macOS) or a command prompt (windows) and type any of the commands

where conda
which conda
conda info
conda list
conda list --envs

To check what version of python you have just type python, for example:

c:\>python
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

Installing pygslib on a virtual environment

This is a good option if you already have Anaconda or Miniconda with a non-compatible Python version. A virtual environment is just an isolated python installation where you can safely install new python packages without breaking dependencies.

To create a python environment, open a terminal and type

conda create -n py3.8 python=3.8

To use the environment in windows type

conda activate py3.8

In Linux or macOS

conda source activate py3.8

You will see something like this

(py3.6) C:\Users\AMartinez\Desktop\Demo1\>

here the environment active is shown in parenthesis, in this case (py3.8)

For more information on virtual environments, visit https://conda.io/docs/user-guide/tasks/manage-environments.html

Installing pygslib in a python environment or in exiting conda distributions

To install pygslib, use the command as shown above.

conda install pygslib -c opengeostat -c conda-forge

pygslib will be installed in the environment active or in the default conda distribution if no environment is active.

Note that conda-forge channel is required to get the package dependency ezdxf.

Conda will install and upgrade pygslib dependencies:

  • python
  • numpy
  • pandas
  • matplotlib
  • scipy
  • vtk
  • ipython
  • colour
  • bokeh
  • ezdxf