User Tools

Site Tools


eman2:install:sourceinstall

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
eman2:install:sourceinstall [2025/06/14 22:41] steveludtkeeman2:install:sourceinstall [2026/03/07 00:23] (current) steveludtke
Line 22: Line 22:
     * IF you have conda-forge, mini-forge or Anaconda already installed in your account, and wish to try setting up EMAN2 as a new environment skip ahead to //Configure and update conda//. This may or may not work, depending on the age of your previous Anaconda install.     * IF you have conda-forge, mini-forge or Anaconda already installed in your account, and wish to try setting up EMAN2 as a new environment skip ahead to //Configure and update conda//. This may or may not work, depending on the age of your previous Anaconda install.
     * Otherwise:     * Otherwise:
- <code>#!highlight bash+ <code bash>
 echo $PATH echo $PATH
 # make sure no Anaconda/Miniconda/old EMAN2 entries: # make sure no Anaconda/Miniconda/old EMAN2 entries:
Line 38: Line 38:
  
     * Install:     * Install:
- <code>#!highlight bash+ <code bash>
 bash <MiniForge-installer> bash <MiniForge-installer>
 </code> </code>
Line 47: Line 47:
  3. **Initialize conda for shell interaction.** These instructions will depend on what shell you use. The default on most systems is //bash//. If you use a different shell ( //tsch//, //zsh//, ... ), you will need to take that into account:  3. **Initialize conda for shell interaction.** These instructions will depend on what shell you use. The default on most systems is //bash//. If you use a different shell ( //tsch//, //zsh//, ... ), you will need to take that into account:
  
-## <code>#!highlight bash + <code bash
-## # for bash-like shells, such as bash and zsh +# for bash-like shells, such as bash and zsh 
-## source <MiniForge-path>/etc/profile.d/conda.sh +source <MiniForge-path>/etc/profile.d/conda.sh 
-##  + 
-## # for csh-like shells, such as csh and tcsh: +# for csh-like shells, such as csh and tcsh: 
-## source <MiniForge-path>/etc/profile.d/conda.csh +source <MiniForge-path>/etc/profile.d/conda.csh 
-##  + 
-## # <shell-name> is bash, fish, powershell, tcsh, xonsh or zsh +# <shell-name> is bash, fish, powershell, tcsh, xonsh or zsh 
-## conda init <shell-name> +conda init <shell-name> 
-## </code>+</code>
  
  **You will need to close and reopen your shell/terminal for the installation to take effect!**.   **You will need to close and reopen your shell/terminal for the installation to take effect!**. 
Line 63: Line 63:
  
  4. **Configure and update conda.**  4. **Configure and update conda.**
- <code>#!highlight bash+ <code bash>
 # We suggest the following, meaning you will need to use //conda activate// after logging in before using EMAN2 # We suggest the following, meaning you will need to use //conda activate// after logging in before using EMAN2
 conda config --set auto_activate_base False conda config --set auto_activate_base False
Line 82: Line 82:
  
  
- <code>#!highlight bash + <code bash> 
-mamba create -n eman2 eman-dev --only-deps -c cryoem -c conda-forge+conda create -n eman2 eman-dev --only-deps -c conda-forge -c cryoem
 </code> </code>
  
  If, and ONLY if, you are installing on a headless machine without graphics, you can alternatively set up the **non-GUI** variant which will not have pyqt and pyopengl. Doing this will severely limit EMAN2's capabilities:  If, and ONLY if, you are installing on a headless machine without graphics, you can alternatively set up the **non-GUI** variant which will not have pyqt and pyopengl. Doing this will severely limit EMAN2's capabilities:
  
- <code>#!highlight bash + <code bash> 
-mamba create -n eman2 'eman-dev=*=nogui_*' --only-deps -c cryoem -c conda-forge+conda create -n eman2 'eman-dev=*=nogui_*' --only-deps -c conda-forge -c cryoem
 </code> </code>
  
 + **ARM-64 Linux** (aarch64) - At present this requires some special tricks. See section below.
  
- **List of dependencies: **If you wish to see the list of conda dependencies that **eman-dev** is built from, look [[https://github.com/cryoem/eman-feedstock/blob/master/recipe/meta.yaml|here]]. Some of the dependency versions are listed in the appropriate file under [[https://github.com/cryoem/eman-feedstock/tree/master/.ci_support|.ci_support]].+ **List of dependencies: ** (Not required for normal installation)If you wish to see the list of conda dependencies that **eman-dev** is built from, look [[https://github.com/cryoem/eman-feedstock/blob/master/recipe/meta.yaml|here]]. Some of the dependency versions are listed in the appropriate file under [[https://github.com/cryoem/eman-feedstock/tree/master/.ci_support|.ci_support]].
  
 + 6. **GPU Acceleration** EMAN2 increasingly leverages GPU acceleration on compatible machines, and moving forward we have moved from tensorflow to JAX. EMAN2 still includes some tensorflow code, and tensorflow should already have been installed as part of the configuration above. Given its rapid state of development we suggest installing JAX using pip instead:
 +
 + Linux + NVidia GPU:
 + <code bash>
 +conda activate eman2
 +pip install "jax[cuda12]" optax
 +</code>
 +
 + Mac or other non-Nvidia:
 + <code bash>
 +conda activate eman2>
 +pip install jax optax
 +</code>
  
- 6. Ensure you have **OpenGL**:+ 7. Ensure you have **OpenGL**:
   EMAN2 uses OpenGL (via !PyQt) for all of its graphics. OpenGL installation depends on OS variant and, for example, whether you are using proprietary NVidia drivers under Linux. You will need to have OpenGL set up on your machine as a whole before continuing. On Mac, you should already have this with XCode. On Linux with an NVidia driver you will likely also need to install the Mesa header files. If you aren't sure how to set up OpenGL, Google can probably help.   EMAN2 uses OpenGL (via !PyQt) for all of its graphics. OpenGL installation depends on OS variant and, for example, whether you are using proprietary NVidia drivers under Linux. You will need to have OpenGL set up on your machine as a whole before continuing. On Mac, you should already have this with XCode. On Linux with an NVidia driver you will likely also need to install the Mesa header files. If you aren't sure how to set up OpenGL, Google can probably help.
  
- 7. **Get EMAN code** from [[https://github.com/cryoem/eman2|GitHub:cryoem/eman2]]. + 8. **Get EMAN code** from [[https://github.com/cryoem/eman2|GitHub:cryoem/eman2]]. 
- <code>#!highlight bash+ <code bash>
 cd <path-where-you-want-eman2-source>   # eg - $HOME/src cd <path-where-you-want-eman2-source>   # eg - $HOME/src
 git clone https://github.com/cryoem/eman2.git # this will create an eman2 folder containing the current source code from the master branch git clone https://github.com/cryoem/eman2.git # this will create an eman2 folder containing the current source code from the master branch
 </code> </code>
  
- 8. **Create a build directory** (out-of-source builds are recommended). + 9. **Create a build directory** (out-of-source builds are recommended). 
- <code>#!highlight bash+ <code bash>
 mkdir <build-directory> # eg- $HOME/src/eman2-build mkdir <build-directory> # eg- $HOME/src/eman2-build
 </code> </code>
- 9. **GPU/deep learning** Install JAX per the next section for GPU support. JAX is required for virtually all of the new EMAN3 programs  + 10. **GPU/deep learning** Install JAX per the next section for GPU support. JAX is required for virtually all of the new EMAN3 programs 
- +
-===== GPU Aceleration & Deep Learning ===== +
-Older EMAN2 programs make use of Tensorflow for Deep Learning/GPU support, but we have been gradually migrating to the new JAX library, so having both installed is strongly suggested. +
- +
-  * Tensorflow +
-    * Should be installed automatically as part of the EMAN2 environment setup above +
-    * You can check to see what version of Tensorflow and whether it is GPU accelerated with: "conda list|grep tensorflow". On a machine with an NVIDIA GPU and properly configured drivers, you should see a tensorflow version like "2.17.0    cuda120py312h02ad488_203". This says that you are using the CUDA 12.0, Python 3.12 version of tensorflow 2.17.0. If you see "cpu" instead of "cuda" then you do not have GPU acceleration, and you will need to sort that out. +
- +
-  * JAX +
-    * While it is possible to install JAX using conda/mamba, it can be difficult to find a version of GPU JAX and a version of GPU Tensorflow which will install properly together this way. +
-    * Instead, we strongly suggest just installing JAX using pip: +
-      * conda activate eman2 +
-      * Linux (NVIDIA): pip install "jax[cuda12]"      +
-      * Other (cpu): pip install jax +
-    * see [[https://pypi.org/project/jax/]] for up to date JAX instructions, this may change more frequently than this page is updated+
  
 ===== Build and Install: Daily development, Update code, etc. ===== ===== Build and Install: Daily development, Update code, etc. =====
Line 131: Line 130:
  
  10. **Activate** your environment. If you used a different name above, use it here too.  10. **Activate** your environment. If you used a different name above, use it here too.
- <code>#!highlight bash+ <code bash>
 conda activate eman2 conda activate eman2
 </code> </code>
  
  11. **Update and Checkout source code**. Periodically you should update your source using standard git techniques.  11. **Update and Checkout source code**. Periodically you should update your source using standard git techniques.
- <code>#!highlight bash+ <code bash>
 cd <source-directory>    # <path-where-you-want-eman2-source>/eman2 cd <source-directory>    # <path-where-you-want-eman2-source>/eman2
 git fetch --all --prune  # get remote branches and cleanup non-existing remote branches from local repo git fetch --all --prune  # get remote branches and cleanup non-existing remote branches from local repo
Line 144: Line 143:
  
  12. **CMake**  12. **CMake**
- <code>#!highlight bash+ <code bash>
 cd <build-directory> cd <build-directory>
 # on Mac: # on Mac:
Line 177: Line 176:
  
  14. **Other Environments**. To switch to another conda environment (stop working with EMAN2), first deactivate your current environment.  14. **Other Environments**. To switch to another conda environment (stop working with EMAN2), first deactivate your current environment.
- <code>#!highlight bash+ <code bash>
 conda deactivate conda deactivate
 </code> </code>
  
-==== Troubleshooting ====+===== ARM-64 Linux ===== 
 +We have not managed to integrate builds for ARM64 Linux (including RaspberryPi) into the conda-forge build system at present. Building from source will also require some extra effort because the eman-dev package isn't available.  
 + 
 +This will create an environment with most of the dependencies: 
 +<code> 
 +mamba create -n eman2 biopython boost cmake configparser fftw freetype ftgl future gsl hdf5 ipython ipywidgets jupyterlab libfreetype libfreetype6 libgcc libpng libstdcxx libtiff libzlib matplotlib nodejs numpy pandas python==3.12 scikit-learn scipy tqdm umap-learn zlib 
 +</code> 
 +this excludes tensorflow, jax and pydusa. Pydusa isn't really used much in EMAN2 any more (provides MPI support), with most parallelism being either threading or via CUDA through Tensorflow or JAX. JAX and Tensorflow are not required for compilation, but will need to be installed for some programs to function. 
 + 
 +With this environment it should be possible to follow the instructions above beginning with cloning EMAN2 from GitHub and install functional binaries. 
 + 
 +===== Troubleshooting =====
 Solutions to potential known problems will be listed here. If these don't help, please report your problem (http://groups.google.com/group/eman2): Solutions to potential known problems will be listed here. If these don't help, please report your problem (http://groups.google.com/group/eman2):
  
 +  * **Linux**
 +    * On recent linux installs (2025+) when running a tensorflow program you may encounter an error like **ImportError: libtensorflow_cc.so.2: cannot enable executable stack as shared object requires: Invalid argument**. This is a problem with the way conda-forge is compiling tensorflow conflicting with Linux security settings, and has nothing directly to do with EMAN2. It is easy to fix, but the specific method depends on your linux variant. I suggest pasting the exact error you're getting into one of the LLMs (ChatGPT, etc.) and get it to advise you.
 +    * This command may help in some situations: //patchelf --clear-execstack $CONDA_PREFIX/lib/libtensorflow_cc.so.2//
   *  **macOS** Users (bash only)   *  **macOS** Users (bash only)
     * On macOS, installation modifies //~/.bash_profile//. If you have a //~/.profile// startup file, creation of //~/.bash_profile// will prevent //~/.profile// from being read. A simple solution is to //source .profile// within //.bash_profile//.     * On macOS, installation modifies //~/.bash_profile//. If you have a //~/.profile// startup file, creation of //~/.bash_profile// will prevent //~/.profile// from being read. A simple solution is to //source .profile// within //.bash_profile//.
Line 202: Line 215:
 Please, provide the output of the following commands when reporting a problem. Record the session via **script** command. This, also, records the commands, and you can just submit the full text file with your problem report. Please, provide the output of the following commands when reporting a problem. Record the session via **script** command. This, also, records the commands, and you can just submit the full text file with your problem report.
  
- 1. <code>#!highlight bash+ 1. <code bash>
 script filename.txt script filename.txt
  
eman2/install/sourceinstall.1749940891.txt.gz · Last modified: by steveludtke