Installation problems - acroucher/PyTOUGH GitHub Wiki

If you install PyTOUGH according to the instructions in the user guide or on the PyTOUGH website front page, but you find that you can't import PyTOUGH modules in your scripts, here are some things to check that may have gone wrong.

Multiple Pythons

A common problem, especially on Windows machines, is that there are multiple versions of Python on your computer. While in principle this is OK, in practice it often causes trouble. The reason is usually that the Python you are trying to use to run your script is not the same one that has had PyTOUGH (or one of the other Python libraries such as numpy) installed for it.

You can check this by looking at the list of installed software on your computer. If there are multiple Pythons in there, the safest thing to do is usually to uninstall them all, as well as other libraries such as numpy etc., then re-install just the one you want to use. Then reinstall the other libraries and PyTOUGH.

You may also have other Pythons installed that are not so obvious, for example if you have a Python distribution (Python + other libraries) like Enthought on your machine. Again, in principle it is possible to set up PyTOUGH to run with other Python distributions, but in practice it's usually more straightforward just to stick to the standard one from www.python.org.

Python 3

Python 3.x is not entirely backwards-compatible with Python 2.x (i.e your Python 2.x scripts may not run on Python 3.x). Python 3 support in PyTOUGH is coming in version 1.5.

In the meantime, you will need to stick with Python 2.x. If you currently have Python 3.x installed, you will need to install Python 2.x (and other Python libraries for Python 2.x) before you can run PyTOUGH. In principle you can leave Python 3.x on your machine, but unless you really need it for something else, it may be safer to uninstall it.

Python libraries not installed

Before PyTOUGH will run, you need to make sure the other Python libraries that it needs are also installed. You need the numpy library before PyTOUGH will run at all. Some parts of PyTOUGH also use other libraries such as scipy and matplotlib.

You can check if numpy is installed by opening a Python shell and typing in import numpy. If this fails, then you have not got numpy installed properly.

Incompatible libraries

On Windows, because it lacks a software package management system, you need to make sure the Python libraries like numpy are compatible with the Python you have installed. The main things to check are:

  • 32-bit or 64-bit: if you have 32-bit Python, all the Python libraries need to be 32-bit as well (similarly for 64-bit). In general there is no reason to install the 32-bit versions unless you actually have a 32-bit machine (which is unusual these days- most are now 64-bit).
  • Versions: check that the Python libraries have the right version number for the version of Python that you are running.

If you are downloading Windows installers for these libraries, look for '32' or '64' (indicating 32-bit or 64-bit), and for the appropriate Python version, in the installer's file name.

In most cases a good option for Windows users is to install all required Python libraries from this site, to help make sure everything is compatible.

PyTOUGH setup script not run correctly

Once you have downloaded the PyTOUGH zip file and unzipped it into a new directory, you need to open a command prompt in that directory and run the setup.py script from there, like this: python setup.py install.

You can't just double-click on the setup.py script in a file manager- if you do, it will not have the 'install' argument and PyTOUGH won't be installed.