xraypy / xraylarch

Larch: Applications and Python Library for Data Analysis of X-ray Absorption Spectroscopy (XAS, XANES, XAFS, EXAFS), X-ray Fluorescence (XRF) Spectroscopy and Imaging, and more.
https://xraypy.github.io/xraylarch
MIT License
138 stars 68 forks source link

Issues with larch module when installing xraylarch on anaconda #499

Closed jellyfish1997 closed 9 months ago

jellyfish1997 commented 9 months ago

I have been trying to install xraylarch onto a separate environment in Anaconda and have been having a lot of trouble accessing the larch module. First, I installed xraylarch but when I called "larch" it did not detect the module at all. I then tried installing the larch package itself into the environment; this also failed as python still could not access any of the functions in larch. I tried uninstalling xraylarch, Anaconda and reinstalling and these issues still seem to persist. Has anyone encountered anything similar and has ideas on how to best proceed next? One note is that, this installation process worked for me in the past; I had to get my computer rebooted and wiped for other issues. After my computer was revived, this installation process consistently fails for me.

newville commented 9 months ago

@jellyfish1997 Please give more precise details of what you did to install. For example, what version of Anaconda are you using, what commands did you use to install xraylarch, etc? Do a) "First, I installed xraylarch" and b ) "I then tried installing the larch package itself into the environment" mean different things to you? I don't know what the difference would be.

jellyfish1997 commented 9 months ago

@newville I removed the xraylarch environment and manually deleted any residual files to begin the process again. Here is what I did:

  1. Open anaconda terminal and create a new environment: conda create -y --name xraylarch python=>3.11.5
  2. Activate xraylarch
  3. conda install -y -c conda-forge wxpython pymatgen scipy h5py matplotlib
  4. pip install xraylarch At this last step I get the following error: running build_ext building 'CifFile.StarScan' extension error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pycifrw Failed to build pycifrw ERROR: Could not build wheels for pycifrw, which is required to install pyproject.toml-based projects

I had also tried this installation simply using conda-forge. And in that case, I had a lot of issues getting the env\python.exe to run.

newville commented 9 months ago

@jellyfish1997 One of the reasons we strongly recommend using the installer scripts is that these sorts of issues are easily avoided. Sort of as a corollary, we sort of assume that someone choosing to use their own Anaconda environment would be able to do some troubleshooting about package installation.

I would guess that if you did

 conda install -y -c conda-forge  python==3.11.5 numpy scipy matplotlib h5py scikit-image scikit-learn pycifrw pandas jupyter plotly wxpython fabio pyfai pymatgen mkl_fft tomopy

pip install xraylarch[larix]

That everything would work.

Installing PyCIFrw with pip will try to automatically compile some C code, which can easily fail, especially on Windows. Installing with conda or mamba avoids that.

Again, we strongly recommend using the installation scripts.

jellyfish1997 commented 9 months ago

@newville maybe extra work in this way but I installed MS C++ tools and got the installation to work with some minor troubleshooting.