Differences between revisions 15 and 22 (spanning 7 versions)
Revision 15 as of 2019-10-20 02:31:46
Size: 16636
Editor: TunayDurmaz
Comment: windows native
Revision 22 as of 2020-07-24 19:23:49
Size: 16217
Editor: TunayDurmaz
Comment: PATH related info
Deletions are marked like this. Additions are marked like this.
Line 43: Line 43:
  * The changes made in .profile/.bashrc will ensure updating PATH, so that python/conda/anaconda in the installed EMAN2 package are found correctly. Users who want to use another python version, like the system version, can run 'conda deactivate' which will remove EMAN2 and its python version from PATH.
Line 53: Line 54:
 1. If you have problems with any of these programs, the first thing to check is whether you have PYTHONPATH, PYTHONHOME, LD_LIBRARY_PATH or DYLD_LIBRARY_PATH set in your shell. While used in previous versions of EMAN, variables are no longer used, and in some cases may interfere with Anaconda. If they are set to make some other software package work, but they interfere with the programs above, you will have to unset them, and set them only when you need the other software.
 1. Specifically, if only the last command fails and you are using an Nvidia graphics card, it is likely caused by a graphics card driver incompatibility. Updating the Nvidia driver usually fixes the problem. On recent Ubuntu systems, running ''apt-get install nvidia-current'' works. On other systems, you may need to follow the installation guide from Nvidia.

 1. If you have problems with any of these programs
   * The first thing to check is whether you have PYTHONPATH, PYTHONHOME, LD_LIBRARY_PATH or DYLD_LIBRARY_PATH set in your shell. While used in previous versions of EMAN, variables are no longer used, and in some cases may interfere with Anaconda. If they are set to make some other software package work, but they interfere with the programs above, you will have to unset them, and set them only when you need the other software.
   * Check PATH in your shell and make sure you have an entry that points to your installation, before any other python entries. The entry might look like like '<path-to-EMAN2-installation>/condabin' or similar. Probably, best not to have any other python entries at all in PATH.
   * Specifically, if only the last command fails and you are using an Nvidia graphics card, it is likely caused by a graphics card driver incompatibility. Updating the Nvidia driver usually fixes the problem. On recent Ubuntu systems, running ''apt-get install nvidia-current'' works. On other systems, you may need to follow the installation guide from Nvidia.
 1. You will find that when you open a new shell, you will see (base) added to your command prompt. This indicates that Anaconda, the environment EMAN2 now uses for distribution, is active, and you can run EMAN2/SPARX/SPHIRE commands.
  * If this causes issues for other software, you can type {{{conda deactivate}}} and EMAN2 commands will no longer work (but any software that doesn't like Anaconda will work).
  * Alternatively, you can type {{{conda config --set auto_activate_base False}}}, which will prevent Anaconda from being activated automatically when you open new shells. In that case you will need to do a {{{conda activate}}} before running EMAN2/SPARX/SPHIRE commands.
Line 174: Line 178:
 1. Open Anaconda Prompt by clicking "Windows Start Menu/Anaconda2 (64-bit)/Anaconda Prompt".  1. Open Anaconda Prompt by clicking Windows Start Menu -> Anaconda2 (64-bit) -> Anaconda Prompt.
Line 187: Line 191:
 1. Install "Bash on Windows 10", https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/.
 1. When prompted to set a user name, enter `root`. This should give you an account without a password.

==== Install OpenGL and X Server, set environment variables ====
 1. Enable "Windows Subsystem for Linux" and install Ubuntu or any other distribution that you are familiar with, https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/.
Line 208: Line 210:
 1. Download and install `eman2.X.linux64.centos7.sh`.  1. Download and install `eman2.X.linux64.sh`.
Line 220: Line 222:
=== Using the GPU === == Using the GPU ==
Line 223: Line 225:
Note that due to the NumPy version in the 2.2 release, we are still using the 'old' GPU backend for compatibility (i.e. NOT the libgpuarray backend), so be sure to use ''device=gpu'' in your ''.theanorc''. Hopefully this will change in the 2.21 update (unfortunately it did not...but it is upgraded in the daily build newer than 2.21).

On a freshly installed Ubuntu 16.10, an easy way to install the GPU support is to run the following command after successful binary installation.
Many machines will have CUDA installed already, and if CUDA is an appropriate version, this should work fine with the TensorFlow version shipped with EMAN2. However, if you are running newer versions of CUDA there may be problems. You can test compatibility quickly with:
{{{
# Make sure you have your environment set to run EMAN2 programs
e2version.py
# The above command should work and return your current version. If it does, then run:
python -c "import tensorflow"
}}}

If this command does not return an error, then you should be able to run deep learning software within EMAN2. If it does raise an error, then you will need to debug the problem:

 * If you do not have CUDA installed at all (and you are on a Linux machine with an NVidia GPU):
   * Installation depends on linux distribution, try your package manager for CUDA and/or CUDA-toolkit
   * for example, on Ubuntu 16.10:
Line 230: Line 241:
If you are using a new GPU (like GTX1080 or better), you may need the newest version of CUDA to support the hardware. The following command should work.
 * If the version of CUDA you have installed is too new (definitely problems with 10.1, may be problems with earlier versions), then you will need to get a compatible tensorflow installed in your Anaconda environment. Here is one suggestion:
Line 233: Line 243:
apt-get install cuda-8-0
}}}
If this does not work, you may consider downloading the latest CUDA from Nvidia through the following link and follow their instruction to install. https://developer.nvidia.com/cuda-downloads

 . After the CUDA installation (run "''nvcc --version''" to check if it works), create a text file called ''.theanorc'' in your $HOME directory with the following content:
 {{{
[global]
device = gpu
floatX = float32
}}}

Then try running any neural network related program or simply run ''e2.py'' then ''import theano''. If you see print out message like '''Using gpu device ******* (CNMeM is disabled, cuDNN ****)''', it means the GPU is now being used. For other system (or if the guide above does not work), you may follow the instruction from Theano and Nvidia. Keep in mind that CUDA installation can be a painful process on some computers especially when some of the hardware are old. CUDA also has internal incompatibility issue with newer version of gcc, so it might also break other software you have installed. So be careful and good luck...

==== CUDA 9.0 support ====
(requires EMAN2.21 or newer)

In Theano, we now support CUDA9.0 and the gpuarray backend. To upgrade to CUDA9.0, you will need:

 * Latest version of EMAN2 from GitHub (2017-10-25 or later).
 * Edit ~/.theanorc file to:
 {{{
[global]
device = cuda
floatX = float32
}}}
 * Upgrade Theano to latest GitHub version:
 {{{
conda remove theano
pip install --no-deps git+https://github.com/Theano/Theano.git#egg=Theano
}}}
 * Upgrade pygpu
 {{{
conda install -c conda-forge pygpu=0.7
}}}
 * The latest Theano tries to use CuDNN by default. CuDNN speeds up neural network training, although the improvement is not very significant for the size of networks we are using. So you need to either install the latest CuDNN from Nvidia (https://developer.nvidia.com/cudnn), or disable it by adding this to ~/.theanorc
 {{{
[dnn]
enabled=False
}}}

 . If you get a very long string of errors a few seconds after trying to train a network, and see references to "narrowing" in the errors, this probably means your C++ compiler is newer than Theano expects. You can try adding the following to your .theanorc file:
 {{{
[gcc]
cxxflags = -Wno-narrowing
}}}
conda remove tensorflow-gpu tensorflow-gpu-base
pip install cython
pip install tensorflow
# read any messages carefully, if there are errors you may need other installations
}}}

Binary Installation Instructions v2.31

All Systems

Official releases are in reverse chronological order. The Continuous Build is rebuilt daily and any time a developer makes a change they think users should have access to. It is normally reasonably stable, and will contain the latest pre-publication features. Alternatively, the highest numbered version will contain a stable and tested release. Windows10 users please see the instructions below before downloading.

Mac OS X and Linux Workstations (not clusters)

The neural network code in EMAN2 works best on GPUs, which are available only on the Linux installations. It can still run on Mac, but will be quite slow.

  1. If you have previously installed EMAN2:
    • Please remove or rename any existing installed EMAN2 folder you might have.
    • Please remove any existing EMAN2 entries from PATH.
    • LD_LIBRARY_PATH, DYLD_LIBRARY_PATH, PYTHONPATH and PYTHONHOME are NO LONGER USED, and should be removed if you have them set.
    • If you have any of these shell variables set for use with other software, it may be necessary to remove those settings as well. If the tests below fail after installation, this is the first thing to check.
  2. Download eman2.X.MacOS.sh/eman2.X.linux64.sh.
  3. Run:
       1 bash <path-to-EMAN2-installer>
    
    • You will be prompted for a location to install EMAN2. Note that you cannot rename this folder after installation! You must reinstall if you wish to move the installation.
    • You will be asked if you want to initialize EMAN2.
    • EMAN2 initialization will add a block of code to your .profile/.bashrc file. After initialization open your .profile/.bashrc file and confirm that a block like the following has been added
         1 # added by EMAN2 2.31 installer
         2 # >>> conda init >>>
         3 # !! Contents within this block are managed by 'conda init' !!
         4 ...
         5 ...
         6 ...
         7 unset __conda_setup
         8 # <<< conda init <<<
         9 
      
    If you have any other similar looking blocks before the last one, it might be a good idea to remove them to avoid any potential conflicts.
    • If you use a different shell, such as tcsh or zsh, you may need to edit the appropriate file yourself.
    • You should not normally need to reinstall OpenMPI. The copy of OpenMPI/Pydusa now distributed with the binaries should work on Macs/Linux workstations in most cases.
    • Don't forget to restart your shell if you changed the .profile/.bashrc or other scripts.
    • The changes made in .profile/.bashrc will ensure updating PATH, so that python/conda/anaconda in the installed EMAN2 package are found correctly. Users who want to use another python version, like the system version, can run 'conda deactivate' which will remove EMAN2 and its python version from PATH.
    • Mac users: If you don't understand what the .profile instructions are talking about, this may help: https://stackoverflow.com/questions/7501678/set-environment-variables-on-mac-os-x-lion

  4. Linux users: The new neural network based routines are much faster running on a GPU. If you have an NVidia graphics card, see Using the GPU section below.

  5. Run these programs to see if the install worked:
       1 e2version.py
       2 e2speedtest.py
       3 e2display.py
       4 e2proc2d.py :64:64:1 test.hdf --process mask.sharp:outer_radius=24
       5 e2display.py test.hdf
    
  6. If you have problems with any of these programs
    • The first thing to check is whether you have PYTHONPATH, PYTHONHOME, LD_LIBRARY_PATH or DYLD_LIBRARY_PATH set in your shell. While used in previous versions of EMAN, variables are no longer used, and in some cases may interfere with Anaconda. If they are set to make some other software package work, but they interfere with the programs above, you will have to unset them, and set them only when you need the other software.
    • Check PATH in your shell and make sure you have an entry that points to your installation, before any other python entries. The entry might look like like '<path-to-EMAN2-installation>/condabin' or similar. Probably, best not to have any other python entries at all in PATH.

    • Specifically, if only the last command fails and you are using an Nvidia graphics card, it is likely caused by a graphics card driver incompatibility. Updating the Nvidia driver usually fixes the problem. On recent Ubuntu systems, running apt-get install nvidia-current works. On other systems, you may need to follow the installation guide from Nvidia.

  7. You will find that when you open a new shell, you will see (base) added to your command prompt. This indicates that Anaconda, the environment EMAN2 now uses for distribution, is active, and you can run EMAN2/SPARX/SPHIRE commands.
    • If this causes issues for other software, you can type conda deactivate and EMAN2 commands will no longer work (but any software that doesn't like Anaconda will work).

    • Alternatively, you can type conda config --set auto_activate_base False, which will prevent Anaconda from being activated automatically when you open new shells. In that case you will need to do a conda activate before running EMAN2/SPARX/SPHIRE commands.

Linux Clusters

  • Follow the Linux workstation instructions above.
  • When using EMAN2/SPARX/SPHIRE on a cluster, the version of OpenMPI provided with the EMAN2.31 binaries may not be aware of the batch queuing system used to launch jobs on the cluster, and may only be able to run on one node at a time unless you follow the OpenMPI reinstallation instructions below. Follow only ONE of the sets of instructions below.
  • You will need conda-build for the instructions to work. Binaries include it, but for source installations, it needs to be installed.  conda install -n base conda-build=3.17.8 -c defaults 

  • If you have a file named .condarc in your home directory, temporarily rename or move it for the following instructions to work properly.

Use system OpenMPI

Most Linux clusters will have at least one OpenMPI installation on the cluster. In some cases there may be more than one, and you may have to select a "module" to get the correct one. It is also critical that OpenMPI be compiled with the --disable-dlopen option. If you don't understand this statement, please consult with your cluster sysadmin.

  1. Remove the OpenMPI we provided:
    conda remove openmpi --force
  2. Make sure that the correct OpenMPI for your cluster is in your path. You should be able to run 'mpicc' and get a message like 'gcc: no input files'.
  3. Rebuild Pydusa using the system installed OpenMPI.
    export GIT_PYDUSA_BRANCH=v20180515
    conda build <path-to-EMAN2-directory>/recipes/pydusa --numpy 1.13 --no-test
    • Warning: If you see an error after this process like:

      Can't build /home/stevel/EMAN2/recipes/fftw-mpi due to environment creation error:
      Downloaded bytes did not match Content-Length
        url: http://www.fftw.org/fftw-3.3.6-pl1.tar.gz
        target_path: /home/stevel/EMAN2/conda-bld/src_cache/fftw-3.3.6.tar.gz
        Content-Length: 4179807
        downloaded bytes: 208916

      this means the fftw download failed. You will need to re-run this step, but first, delete the failed download :  rm EMAN2/conda-bld/src_cache/fftw-3.3.6.tar.gz 

    • Warning: If you see an error during this process like:

           configure: error: could not find mpi library for --enable-mpi
      this means the fftw build failed. On our system, this happened due to a libuuid library mismatch in combination with the omnipath cluster architecture. To workaround this situation try:
          cd <path-to-EMAN2-directory>/lib
          rm libuuid.so.1
          ln -s /lib64/libuuid.so.1.3.0 libuuid.so.1 (Try  'ldconfig -p | grep libuuid'  to find the correct libuuid location and version)
          cd -
      Run this step again and revert this change after the whole installation process is complete.
          cd <path-to-EMAN2-directory>/lib
          rm libuuid.so.1
          ln -s libuuid.so.1.0.0 libuuid.so.1
          cd -
  4. Finally, install the compiled Pydusa:
    conda install fftw-mpi --force-reinstall --override-channels -c file://<path-to-EMAN2-directory>/conda-bld -c defaults
    conda install 'pydusa=1.15=np113*' --force-reinstall --override-channels -c file://<path-to-EMAN2-directory>/conda-bld -c defaults

Rebuild your own OpenMPI

This option insures that --disable-dlopen is used when compiling OpenMPI, but may lack some system-specific optimizations provided by your sysadmin.

  1. Remove the OpenMPI we provided:
    conda remove openmpi --force
  2. Rebuild OpenMPI.

    It is important to have the hwloc library available on the system. It might be available with 'module load hwloc'. It is also important to have the libraries of the used queuing system available (slurm, Torque/PBS, SGE, ...).

    conda build <path-to-EMAN2-directory>/recipes/openmpi -c defaults -c conda-forge -c conda-forge/label/cf201901
    conda install openmpi --override-channels -c file://<path-to-EMAN2-directory>/conda-bld -c defaults
  3. Rebuild Pydusa using the rebuilt OpenMPI:
    export GIT_PYDUSA_BRANCH=v20180515
    conda build <path-to-EMAN2-directory>/recipes/pydusa --numpy 1.13 --no-test
    • Warning: If you see an error after this process like:

      Can't build /home/stevel/EMAN2/recipes/fftw-mpi due to environment creation error:
      Downloaded bytes did not match Content-Length
        url: http://www.fftw.org/fftw-3.3.6-pl1.tar.gz
        target_path: /home/stevel/EMAN2/conda-bld/src_cache/fftw-3.3.6.tar.gz
        Content-Length: 4179807
        downloaded bytes: 208916

      this means the fftw download failed. You will need to re-run this step, but first, delete the failed download :  rm EMAN2/conda-bld/src_cache/fftw-3.3.6.tar.gz 

    • Warning: If you see an error during this process like:

           configure: error: could not find mpi library for --enable-mpi
      this means the fftw build failed. On our system, this happened due to a libuuid library mismatch in combination with the omnipath cluster architecture. To workaround this situation try:
          cd <path-to-EMAN2-directory>/lib
          rm libuuid.so.1
          ln -s /lib64/libuuid.so.1.3.0 libuuid.so.1 (Try  'ldconfig -p | grep libuuid'  to find the correct libuuid location and version)
          cd -
      Run this step again and revert this change after the whole installation process is complete.
          cd <path-to-EMAN2-directory>/lib
          rm libuuid.so.1
          ln -s libuuid.so.1.0.0 libuuid.so.1
          cd -
  4. Finally, install the compiled Pydusa:
    •   conda install fftw-mpi --force-reinstall --override-channels -c file://<path-to-EMAN2-directory>/conda-bld -c defaults
        conda install 'pydusa=1.15=np113*' --force-reinstall --override-channels -c file://<path-to-EMAN2-directory>/conda-bld -c defaults

Windows

We are finally able to provide 64 bit Windows binaries for EMAN2, however, please see the Windows 10- Linux/Bash shell option below for what may be a better alternative. Notes:

  • SPARX/SPHIRE are not supported.
  • EMAN2 functionality may not be complete using this first approach. You may get more complete functionality, but with some additional effort using the Linux/Bash shell approach below.
  • Even for EMAN2, Windows support remains somewhat marginal, and is provided primarily for utility functions and basic GUI tools, like micrograph evaluation and particle picking. Complete refinements may not work well under Windows. You are welcome to ask questions in the mailing list, but there may be limited help we can provide because we simply don't have Windows machines around for testing.

Native Win7/10 64 bit

  1. Download eman2.X.win64.exe.
  2. Launch the installer.
    1. Select Installation Type: Just Me

    2. Choose Installation Location: Select a location with NO space in path

    3. Advanced Installation Options: Don't add EMAN2 to PATH environment variable.

  3. Open Anaconda Prompt by clicking Windows Start Menu -> Anaconda2 (64-bit) -> Anaconda Prompt.

  4. In most cases you will want to install: Python Launcher.

  5. Run these programs to see if the install worked:
    e2version.py
    e2speedtest.py
    e2display.py
    e2proc2d.py :64:64:1 test.hdf --process mask.sharp:outer_radius=24

Windows 10 - Linux/Bash shell

Windows 10 includes an embedded Ubuntu Linux environment. It is possible to run the EMAN2 Linux binaries within this Win10 environment, but you will need to install some additional dependencies to do so. Also, you will effectively be running at a Linux command prompt, so you will have to become a bit familiar with Linux to do this, but it does avoid installing an additional operating system on your machine.

  1. Enable "Windows Subsystem for Linux" and install Ubuntu or any other distribution that you are familiar with, https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/.

  2. Install OpenGL.
    sudo apt-get update
    sudo apt-get install libsm-dev libxrender-dev build-essential libgl1-mesa-dev mesa-utils mesa-common-dev libglu1-mesa libglu1-mesa-dev
    sudo apt-get autoremove
  3. Install Xming X Server for Windows.

    • Don't forget the fonts and Mesa (OpenGL) modules! If it seems to work, but the letters are black boxes, or you have other visual artifacts, the problem is probably with OpenGL support.
  4. Set environment variables.
    export DISPLAY=:0
    glxinfo | grep OpenGL
    export KMP_AFFINITY=disabled # per https://github.com/Microsoft/BashOnWindows/issues/785#issuecomment-238079769
  5. Download and install eman2.X.linux64.sh.

  6. Start X Server before running eman2 programs.
  7. Run these programs to see if the install worked:
    e2version.py
    e2speedtest.py
    e2display.py
    e2proc2d.py :64:64:1 test.hdf --process mask.sharp:outer_radius=24

Using the GPU

Currently, the GPU is only used for neural network operations in tomogram annotation and in particle picking. It provides a ~10 fold or more speed up in neural network training. The new GPU developments are currently based on TensorFlow. From about 2006-2012 EMAN2 had its own internal CUDA code, which could be compiled into the C++ library. This has been deprecated, and likely no longer works, though the code is still present. We are working on a new GPU support strategy moving forward.

Many machines will have CUDA installed already, and if CUDA is an appropriate version, this should work fine with the TensorFlow version shipped with EMAN2. However, if you are running newer versions of CUDA there may be problems. You can test compatibility quickly with:

# Make sure you have your environment set to run EMAN2 programs
e2version.py
# The above command should work and return your current version. If it does, then run:
python -c "import tensorflow"

If this command does not return an error, then you should be able to run deep learning software within EMAN2. If it does raise an error, then you will need to debug the problem:

  • If you do not have CUDA installed at all (and you are on a Linux machine with an NVidia GPU):
    • Installation depends on linux distribution, try your package manager for CUDA and/or CUDA-toolkit
    • for example, on Ubuntu 16.10:

apt-get install nvidia-cuda-toolkit
  • If the version of CUDA you have installed is too new (definitely problems with 10.1, may be problems with earlier versions), then you will need to get a compatible tensorflow installed in your Anaconda environment. Here is one suggestion:

conda remove tensorflow-gpu tensorflow-gpu-base
pip install cython
pip install tensorflow
# read any messages carefully, if there are errors you may need other installations

EMAN2/Install/BinaryInstallAnaconda/2.31 (last edited 2020-12-29 02:15:12 by TunayDurmaz)