Package: geotecha
Writen by Dr Rohan Walkergeotechais a aGPLv3-licensed Python package for geotechnical
engineering.Many components ofgeotechaderive from geotechnical research
conducted by Dr. Rohan Walker, Prof. Buddhima Indraratna, and others
at the University of Wollongong, NSW, Australia.Primarily a repository of programs, tools, and code used by
Dr. Rohan Walker, the content reflects his primary interest in soft soil
consolidation with and without vertical drains.  In particular:thespecconprograms solve one-dimensional partial differential equations
associated with multi-layer problems using the spectral Galerkin
method.  Material properties are constant with time but piecewise-linear
with depth.  Loads and boundary conditions are piecewise linear with
time (plus a sinusoidal component).specbeammodels a finite elastic Euler-Bernoulli beam resting on
viscoelastic foundation subjected to a moving load(s), with piecewise-linear
spatially varying properties.  It uses the spectral Galerkin method to solve the
dynamic system deflections over time.A number of other analytical solutions to soil consolidation problems are
available in theconsolidationsub-package.Documentationgeotechadocumentation is currently stored athttps://rtrwalker.github.io.
There you can find more descriptions of speccon and specbeam.  Peruse the
api docs for a listing of all the modules, classes and code (make sure you
scroll up to the top of each api_doc page to see the summary listing of
each module - frustratingly a clicked hyperlink doesn’t
take you to the top of the page!)GitHub RepositoryThegeotechacodebase is on GitHub,https://github.com/rtrwalker/geotechahere you will find the development version of the code set.Installationgeotechawas developed on a windows platform.  While I have tried
to use cross platform programming idioms, I have (at the time of
writing) made no attempt to build/usegeotechaon any platform other
than windows.  That does not mean that it will not work.  I simply
do not know if it does or does not.Requirementsgeotechauses a number of other python packages such as
numpy, matplotlib, and scipy.  Setting up your python environment
to successfully run all these packages can be cumbersome so pre-built
python stacks such as the readily availableAnacondaare highly recommended . Note it is generally better to
uninstall any existing python distributions before installing a new
one.Package requirements:numpymatplotlibscipypandassympybrewer2mpltestfixturesnumpydocIPythonpkg_resourcesmpl_toolkitsnoseone of wx (i.e. wxPython) or PyQt (PyQt4 or PyQt5)sphinxmockBefore worrying about if your system has the required packages just
try one of the installation methods below (first try theWindows binariesoption).  Hopefully you will already have
all the packages or else the requirements section of the setup.py
file will get them frompypi.  However, issues can arise.
Due to anomalies in handling dashes in required package
names, the required packagespkg_resourcesandmpl_toolkitswill not automatically be installed.  Just install these using pip if
they are not already present:pip install pkg_resources
pip install mpl_toolkitswxPython and PyQt are not always available throughpypiso may
have to be installed manually (there are usually windows binaries
available).Windows BinariesThe easiest, hassle-free way to installgeotechaon a windows
machine is to download one of the pre-built binaries available
athttps://pypi.python.org/pypi/geotecha.  Once downloaded
double click the .exe file to install.  Note that the installer
will display the raw text of this file and it may look odd. This
does not matter.
You may need to install the dependency packages separately.
If your setup doesn’t match the binaries then you will have to tryBuilding from source.Test you installation by opening a command prompt (Windows+R cmd) and
enter the following command:nosetests geotecha -v --with-doctest --doctest-options=+ELLIPSIS --doctest-options=+IGNORE_EXCEPTION_DETAILIt is common to get an error such as:ImportError: No module named 'brewer2mpl'which usually means one of the dependencies is not installed.  Simply
rerun the tests after installing the missing package with:pip install brewer2mplpipTo installgeotechafrom the Python Package Index (PyPI) using pip:pip install geotechaThis will essentially download the source files and build and install
the package.geotechahas extension modules written in Fortran
which can cause issues if your python environment is not set up to
handle them ( I think you need a Fortran and a c compiler).
.As such you may have difficultly in building the
external extensions (seeBuilding from sourcebelow.See theWindows binariessection above for instructions
on how to to test yourgeotechainstallation.Building from sourceYou can download thegeotechasource files frompypi(release version)
or from the Github repository (development version)https://github.com/rtrwalker/geotecha.geotechauses some external extensions written in Fortran, so
you will need to have a Fortran compiler present.  Building from source on
Windows can be troublesome at the best of times, so see theIssues with building/installingsection below if you are trying to build
on windows.  For other systems it ‘should’ be as easy as:python setup.py build
python setup.py install --record install.recordThe “–record install.record” will make a file containing a list
of all the files installed.  It is possible to skip the build step
(it will be included in the install step).  But I find it more
informative to use two steps.See theWindows binariessection above for instructions
on how to to test yourgeotechainstallation.  When testing
you may wish to use the
‘-w’ working directory tag so that nose runs tests on the
installed version ofgeotecharather than the source code version
(the source version will not have the external extensions).  Change
the working directory to match your python location, for example:nosetests geotecha -v -w C:\Python36\Lib\site-packages\ --with-doctest --doctest-options=+ELLIPSISor if you are using an Anaconda env (like me) use something like:nosetests geotecha -v -w C:\Anaconda3\envs\py36\Lib\site-packages\ --with-doctest --doctest-options=+ELLIPSIS --verbosity=3You might get two test failures about importing ext_integrals and ext_epus.
This indicates that the fortran extensions are not working.  Don’t worry
python/numpy (slower) versions of relevant functions will be used instead.If you have a numpy version less than 1.14 then the tests will probably throw
many failures associated with spaces and string representations of numpy
arrays.  This is due to changes in numpyhttps://docs.scipy.org/doc/numpy-1.14.0/release.htmlDon’t worry I’ve just updated things for python3.6, you will eventually
upgrade and the test failures will disappear. Check which numpy version you
have with :python -c "import numpy; print(numpy.version.version)"I have also had some odd behaviour where I run tests and get a couple
of test failures.  Then run the same tests and they all pass.Building the docsThegeotechadocs can be built by running the following in the
geotecha directory:python setup.py build_sphinx --source-dir=docs/ --build-dir=docs/_build --all-filesThe build requires a symlink to the examples directory.  See the
README.txt in the docs for instructions.Issues with building/installingAt times (every time?) I have had issues with building from source on windows.
So here are some hints to point you in the right direction.
In python2.7 and up to python 3.4 it was relatively easy because
there was a Mingwpy package (https://anaconda.org/carlkl/mingwpy), however,
that very useful project has been abandoned
(https://groups.google.com/forum/#!topic/mingwpy/1k_BLFPLmBI).
So here is what works for me on Windows 10, 64 bit with python3.6Based on the helpful blog post from Michael Hirsch (https://www.scivision.co/python-windows-visual-c++-14-required/)
install the relevant version of Microsoft Build Tools for Visual C++
(2017 for me) fromhttps://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017(look in the “Tools for Visual Studio 2017” section).
Note it is a large install taking up ~6GB.Now install m2w64-toolchain hosted by Anaconda:conda install -c msys2 m2w64-toolchainClean up previous builds:python setup.py clean --allNow try and build the thing explicitly specifying the compiler:python setup.py build --compiler=mingw32
python setup.py install --record install.recordTest the install as above.  No test failures will indicate that the
Fortran extension modules have been successfully built and installed.Removing geotechaThe cleanest method for removinggeotechais simply to use pip:pip uninstall geotechaYou can also manually delete all files in the ‘install.record’ file.Setting up an Anaconda env on WindowsAfter downloading and installing Anaconda make sure “C:Anaconda3Scripts” is
in your PATH environment variable (otherwise conda command will not be found).
Open the Anaconda prompt (start menu).  Create a full anaconda env named py36
with a specified python version using (note it will download large files):conda create -n py36 python=3.6 anacondaIf you need to start again remove the env with:conda env remove --name py36Close the anaconda prompt and then open the py36 anaconda prompt (start menu).
Your py36 env is now ready to installgeotechaand other python packages.