xraypy/xraylarch

Unable to script Larch with Python

Closed this issue · 5 comments

Hi Larch community!

I have attempted to install Larch in Anaconda Prompt so that I can write Python scripts for XAS analysis, however the installation is failing. As advised on the website I ran the following lines in sequence:

conda create -y --name xraylarch python=>3.11.5
conda activate xraylarch
conda install -y -c conda-forge wxpython pymatgen scipy h5py matplotlib
conda install -y -c conda-forge openbabel tomopy epicsapps    # <- optional packages
pip install xraylarch

However this did not successfully install Larch. I would be grateful if someone could help me identify the issue. At the end of this text I include a full transcript of the input/output in Anaconda Prompt, along with all the packages in the environment.

I have managed to install Larch using the binary file too, and this works for me in XAS Viewer but I've not managed to make this work with Anaconda (i.e running import larch in Jupyter and Spyder gives an error as the module is not found) - if it's possible to explain how I can make this work that would also solve my problem.

Thanks in advance for your help!

Anaconda prompt transcript

(base) C:\WINDOWS\system32>conda create -y --name xraylarch python=>3.11.5

(base) C:\WINDOWS\system32>conda activate xraylarch

(xraylarch) C:\WINDOWS\system32>conda install -y -c conda-forge wxpython pymatgen scipy h5py matplotlib
Collecting package metadata (current_repodata.json): done
Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
Solving environment: unsuccessful attempt using repodata from current_repodata.json, retrying with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
Solving environment: -
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                                                                                                                                                                                    -

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - h5py -> python[version='3.10.*|3.11.*|3.9.*|3.8.*|3.7.*|<3']
  - pymatgen -> python[version='>=3.10,<3.11.0a0|>=3.9,<3.10.0a0|>=3.11,<3.12.0a0|>=3.8,<3.9.0a0|>=3.7,<3.8.0a0|>=3.6,<3.7.0a0']
  - wxpython -> python[version='2.7.*|3.5.*|>=2.7,<2.8.0a0|>=3.10,<3.11.0a0|>=3.11,<3.12.0a0|>=3.9,<3.10.0a0|>=3.8,<3.9.0a0|>=3.7,<3.8.0a0|>=3.6,<3.7.0a0|>=3.5,<3.6.0a0']

Your python: python=3.12

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versions

Package hdf5 conflicts for:
h5py -> hdf5[version='1.10.1|1.10.1.*|>=1.10.2,<1.10.3.0a0|>=1.10.3,<1.10.4.0a0|>=1.10.4,<1.10.5.0a0|>=1.10.5,<1.10.6.0a0|>=1.10.6,<1.10.7.0a0|>=1.12.1,<1.12.2.0a0|>=1.12.2,<1.12.3.0a0|>=1.14.0,<1.14.1.0a0|>=1.14.1,<1.14.2.0a0|>=1.14.2,<1.14.3.0a0|1.8.18|1.8.18.*|1.8.17|1.8.17.*|1.8.17.*|1.8.15.*|>=1.8.20,<1.9.0a0|>=1.8.18,<1.8.19.0a0|>=1.8.18,<1.9.0a0|>=1.10.1,<1.10.2.0a0|1.8.15.1|1.8.16']
pymatgen -> netcdf4 -> hdf5[version='*|>=1.10.6,<1.10.7.0a0|>=1.12.1,<1.12.2.0a0|>=1.12.2,<1.12.3.0a0|>=1.14.0,<1.14.1.0a0|>=1.14.1,<1.14.2.0a0|>=1.14.2,<1.14.3.0a0|>=1.10.5,<1.10.6.0a0|>=1.10.4,<1.10.5.0a0|>=1.10.3,<1.10.4.0a0|1.10.2.*|>=1.10.2,<1.10.3.0a0|1.10.1.*|1.10.1|1.8.18|1.8.18.*|1.8.17|1.8.17.*|1.8.15.*|>=1.8.20,<1.9.0a0|>=1.8.18,<1.8.19.0a0|>=1.8.18,<1.9.0a0|>=1.10.1,<1.10.2.0a0|1.8.15.1',build=nompi_*]

Package vs2010_runtime conflicts for:
matplotlib -> python=3.4 -> vs2010_runtime
h5py -> python=3.4 -> vs2010_runtime
scipy -> vs2010_runtime

Package mkl_random conflicts for:
h5py -> numpy[version='>=1.26.0,<2.0a0'] -> mkl_random[version='>=1.0.2,<2.0a0|>=1.2.1,<2.0a0|>=1.0.4,<2.0a0']
scipy -> numpy[version='>=1.22.4,<1.28'] -> mkl_random[version='>=1.0.2,<2.0a0|>=1.2.1,<2.0a0|>=1.0.4,<2.0a0']
wxpython -> numpy -> mkl_random[version='>=1.0.2,<2.0a0|>=1.2.1,<2.0a0|>=1.0.4,<2.0a0']
matplotlib -> numpy[version='>=1.14.6,<2.0a0'] -> mkl_random[version='>=1.0.2,<2.0a0|>=1.2.1,<2.0a0|>=1.0.4,<2.0a0']
pymatgen -> numpy[version='>=1.22.4,<2.0a0'] -> mkl_random[version='>=1.0.2,<2.0a0|>=1.2.1,<2.0a0|>=1.0.4,<2.0a0']

Package requests conflicts for:
pymatgen -> requests
python=3.12 -> pip -> requests
scipy -> pooch -> requests[version='>=2.19.0']
pymatgen -> mp-api[version='>=0.27.3'] -> requests[version='>=2.23.0']
wxpython -> requests

Package _python_rc conflicts for:
python=3.12 -> _python_rc
h5py -> python[version='>=3.12.0rc3,<3.13.0a0'] -> _python_rc

Package packaging conflicts for:
pymatgen -> matplotlib-base[version='>=1.5'] -> packaging[version='>=20.0']
scipy -> pooch -> packaging[version='>=20.0']
python=3.12 -> pip -> packaging
matplotlib -> matplotlib-base[version='>=3.8.0,<3.8.1.0a0'] -> packaging[version='>=20.0']

Package setuptools conflicts for:
pymatgen -> joblib -> setuptools[version='<60.0.0|>=0.7']
python=3.12 -> pip -> setuptools
matplotlib -> setuptools
wxpython -> setuptools

Package scipy conflicts for:
pymatgen -> networkx[version='>=2.2'] -> scipy[version='>=1.5,!=1.6.1|>=1.8']
pymatgen -> scipy[version='>=1.0.1|>=1.4.1|>=1.5.0']

Package blas conflicts for:
scipy -> blas[version='*|1.0',build=mkl]
scipy -> numpy[version='>=1.16,<1.23'] -> blas==1.1=openblas

Package pypy3.9 conflicts for:
scipy -> python[version='>=3.9,<3.10.0a0'] -> pypy3.9[version='7.3.*|7.3.11.*|7.3.12.*|7.3.13.*|7.3.9.*|7.3.8.*|>=7.3.8']
scipy -> pypy3.9[version='>=7.3.11|>=7.3.13|>=7.3.9']

Package libblas conflicts for:
scipy -> libblas[version='>=3.8.0,<4.0a0|>=3.9.0,<4.0a0']
scipy -> libcblas[version='>=3.9.0,<4.0a0'] -> libblas[version='3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0.*|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0.*',build='4_mkl|5_blis|5_mkl|6_blis|6_openblas|7_blis|7_mkl|7_openblas|8_blis|8_openblas|8_mkl|9_blis|10_openblas|10_mkl|11_openblas|12_blis|12_openblas|13_mkl|14_blis|15_mkl|16_blis|16_mkl|18_mkl|21_mkl|0_blis|0_openblas|1_blis|1_openblas|3_blis|3_openblas|4_openblas|4_mkl|5_blis|5_mkl|6_blis|6_openblas|7_blis|7_openblas|7_mkl|8_openblas|9_openblas|9_mkl|10_blis|10_openblas|10_mkl|12_win64_blis|12_win64_openblas|14_win64_blis|14_win64_openblas|14_win64_mkl|15_win64_openblas|15_win64_mkl|16_win64_blis|17_win64_mkl|18_win64_blis|19_win64_blis|19_win64_openblas|19_win64_mkl|18_win64_openblas|18_win64_mkl|17_win64_openblas|17_win64_blis|16_win64_mkl|16_win64_openblas|15_win64_blis|13_win64_blis|13_win64_mkl|13_win64_openblas|12_win64_mkl|11_win64_mkl|11_win64_openblas|11_win64_blis|9_blis|8_blis|8_mkl|6_mkl|5_openblas|4_blis|2_openblas|2_blis|20_mkl|19_mkl|17_openblas|16_openblas|15_openblas|15_blis|14_openblas|14_mkl|13_openblas|13_blis|12_mkl|11_mkl|11_blis|10_blis|9_mkl|9_openblas|6_mkl|5_openblas|4_openblas|4_blis']

Package matplotlib conflicts for:
pymatgen -> networkx[version='>=2.2'] -> matplotlib[version='>=3.3']
pymatgen -> matplotlib[version='>=1.5']

Package libcblas conflicts for:
scipy -> blas=[build=mkl] -> libcblas[version='3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.9.0',build='4_mkl|5_mkl|6_mkl|7_mkl|9_mkl|10_mkl|12_mkl|13_mkl|14_mkl|15_mkl|16_mkl|19_mkl|21_mkl|5_mkl|7_mkl|8_mkl|9_mkl|10_mkl|11_win64_mkl|14_win64_mkl|15_win64_mkl|17_win64_mkl|18_win64_mkl|19_win64_mkl|16_win64_mkl|13_win64_mkl|12_win64_mkl|6_mkl|20_mkl|18_mkl|11_mkl|8_mkl']
scipy -> libcblas[version='>=3.8.0,<4.0a0|>=3.9.0,<4.0a0']

Package expat conflicts for:
h5py -> python[version='>=3.12,<3.13.0a0'] -> expat[version='>=2.5.0,<3.0a0']
python=3.12 -> expat[version='>=2.5.0,<3.0a0']
pymatgen -> vtk[version='>=6.0.0'] -> expat[version='2.2.*|>=2.2.10,<3.0.0a0|>=2.3.0,<3.0a0|>=2.4.1,<3.0a0|>=2.4.4,<3.0a0|>=2.4.7,<3.0a0|>=2.4.8,<3.0a0|>=2.4.9,<3.0a0|>=2.5.0,<3.0a0|>=2.2.9,<3.0.0a0|>=2.2.5,<3.0.0a0|>=2.2.10,<3.0a0|>=2.2.5,<3.0a0']
matplotlib -> pypy3.9[version='>=7.3.13'] -> expat[version='>=2.4.1,<3.0a0|>=2.4.8,<3.0a0|>=2.4.9,<3.0a0|>=2.5.0,<3.0a0']
scipy -> pypy3.9[version='>=7.3.13'] -> expat[version='>=2.4.1,<3.0a0|>=2.4.8,<3.0a0|>=2.4.9,<3.0a0|>=2.5.0,<3.0a0']

Package charset-normalizer conflicts for:
wxpython -> requests -> charset-normalizer[version='>=2,<3|>=2,<4|>=2.0.0,<2.1|>=2.0.0,<2.0.1|>=2.0.0,<3|>=2.0.0,<2.1.0']
pymatgen -> requests -> charset-normalizer[version='>=2,<3|>=2,<4|>=2.0.0,<2.1|>=2.0.0,<2.0.1|>=2.0.0,<3|>=2.0.0,<2.1.0']

Package freetype conflicts for:
matplotlib -> matplotlib-base[version='>=3.8.0,<3.8.1.0a0'] -> freetype[version='>=2.10.2,<3.0a0|>=2.10.4,<3.0a0|>=2.10|>=2.12.1,<3.0a0|>=2.3']
wxpython -> pillow -> freetype[version='2.5.*|2.6.*|2.7|2.7.*|2.7|2.8.*|2.8.1|2.8.1.*|>=2.10.4,<3.0a0|>=2.12.1,<3.0a0|>=2.9.1,<3.0a0|>=2.8.1,<2.9.0a0|>=2.10.3,<3.0a0|>=2.8,<2.9.0a0']
matplotlib -> freetype[version='2.6.*|>=2.9.1,<3.0a0|>=2.8,<2.9.0a0']
pymatgen -> matplotlib-base[version='>=1.5'] -> freetype[version='2.6.*|2.7.*|2.8.*|2.8.1.*|>=2.10.2,<3.0a0|>=2.10|>=2.10.4,<3.0a0|>=2.12.1,<3.0a0|>=2.9.1,<3.0a0|>=2.3|>=2.8.1,<2.9.0a0|>=2.8,<2.9.0a0']

Package ca-certificates conflicts for:
wxpython -> python[version='>=2.7,<2.8.0a0'] -> ca-certificates
scipy -> python[version='>=2.7,<2.8.0a0'] -> ca-certificates
matplotlib -> python[version='>=2.7,<2.8.0a0'] -> ca-certificates
python=3.12 -> openssl[version='>=3.1.3,<4.0a0'] -> ca-certificates
h5py -> python[version='>=2.7,<2.8.0a0'] -> ca-certificates

Package liblapack conflicts for:
scipy -> liblapack[version='>=3.8.0,<4.0a0|>=3.9.0,<4.0a0']
scipy -> numpy[version='>=1.18.5,<2.0a0'] -> liblapack[version='3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.8.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0|3.9.0|>=3.8.0,<4.0.0a0',build='4_mkl|5_mkl|6_mkl|7_mkl|9_mkl|10_mkl|12_mkl|13_mkl|14_mkl|15_mkl|16_mkl|19_mkl|21_mkl|5_mkl|7_mkl|8_mkl|9_mkl|10_mkl|11_win64_mkl|14_win64_mkl|15_win64_mkl|17_win64_mkl|18_win64_mkl|19_win64_mkl|16_win64_mkl|13_win64_mkl|12_win64_mkl|6_mkl|20_mkl|18_mkl|11_mkl|8_mkl']

Package mkl conflicts for:
scipy -> libblas[version='>=3.9.0,<4.0a0'] -> mkl[version='2019.1.*|2019.3|2019.4|2020.0|2020.1|2020.2|2020.4|2021.2.0|2021.3.0|2021.4.0|2022.0.0|2022.1.0|2023.2.0|>=2020.4,<2021.0a0|>=2020.2,<2021.0a0|>=2019.3,<2020.0a0|>=2019.0,<2020.0a0|>=2019.4,<2020.0a0|>=2022.1.0,<2023.0a0|>=2022.0.0,<2023.0a0|>=2020.2,<2021.0a0|>=2019.3,<2021.0a0|>=2019.3,<2020.0a0|>=2018.0.1,<2019.0a0',build='203|256|256|hb70f87d_311|hb70f87d_389|h6a75c08_874|h6a75c08_50496|h0e2418a_796|h0e2418a_729|hb70f87d_564|hb70f87d_311|216|166|245|203']
scipy -> mkl[version='11.3.1|11.3.3|2017.0.*|>=2018.0.0,<2019.0a0|>=2018.0.2,<2019.0a0|>=2018.0.3,<2019.0a0|>=2019.1,<2021.0a0|>=2019.4,<2021.0a0|>=2021.2.0,<2022.0a0|>=2021.3.0,<2022.0a0|>=2021.4.0,<2022.0a0|>=2023.1.0,<2024.0a0']

Package m2w64-gcc-libs conflicts for:
scipy -> m2w64-gcc-libs
pymatgen -> scipy[version='>=1.5.0'] -> m2w64-gcc-libs
wxpython -> pthread-stubs -> m2w64-gcc-libs

Package cachecontrol conflicts for:
pymatgen -> pip -> cachecontrol
python=3.12 -> pip -> cachecontrol

Package pypy3.7 conflicts for:
scipy -> pypy3.7[version='>=7.3.5']
scipy -> numpy[version='>=1.20.3,<1.27'] -> pypy3.7[version='7.3.*|7.3.5.*|7.3.7.*|>=7.3.7']

Package wincertstore conflicts for:
matplotlib -> setuptools -> wincertstore[version='>=0.2']
wxpython -> setuptools -> wincertstore[version='>=0.2']

Package msvc_runtime conflicts for:
h5py -> python[version='>=2.7,<2.8.0a0'] -> msvc_runtime
matplotlib -> python[version='>=2.7,<2.8.0a0'] -> msvc_runtime
scipy -> python[version='>=2.7,<2.8.0a0'] -> msvc_runtime
wxpython -> python[version='>=2.7,<2.8.0a0'] -> msvc_runtime

Package pypy3.8 conflicts for:
scipy -> python[version='>=3.8,<3.9.0a0'] -> pypy3.8[version='7.3.*|7.3.11.*|7.3.9.*|7.3.8.*|>=7.3.8']
scipy -> pypy3.8[version='>=7.3.11|>=7.3.9']The following specifications were found to be incompatible with your system:

  - pymatgen -> sympy -> __unix

Your installed version is: not available



(xraylarch) C:\WINDOWS\system32>conda install -y -c conda-forge openbabel tomopy epicsapps    # <- optional packages
The system cannot find the file specified.

(xraylarch) C:\WINDOWS\system32>pip install xraylarch
Collecting xraylarch
  Using cached xraylarch-0.9.72-py3-none-any.whl.metadata (1.8 kB)
Collecting packaging (from xraylarch)
  Downloading packaging-23.2-py3-none-any.whl.metadata (3.2 kB)
Requirement already satisfied: pip in c:\programdata\xraylarch\envs\xraylarch\lib\site-packages (from xraylarch) (23.3.1)
Collecting pyyaml (from xraylarch)
  Downloading PyYAML-6.0.1-cp312-cp312-win_amd64.whl.metadata (2.1 kB)
Collecting toml (from xraylarch)
  Downloading toml-0.10.2-py2.py3-none-any.whl (16 kB)
Collecting pytest (from xraylarch)
  Using cached pytest-7.4.2-py3-none-any.whl.metadata (7.9 kB)
Collecting termcolor (from xraylarch)
  Using cached termcolor-2.3.0-py3-none-any.whl (6.9 kB)
Collecting scipy>=1.7 (from xraylarch)
  Downloading scipy-1.11.3-cp312-cp312-win_amd64.whl.metadata (60 kB)
     ---------------------------------------- 60.4/60.4 kB 1.6 MB/s eta 0:00:00
Collecting numpy>=1.20 (from xraylarch)
  Downloading numpy-1.26.1-cp312-cp312-win_amd64.whl.metadata (61 kB)
     ---------------------------------------- 61.2/61.2 kB 3.4 MB/s eta 0:00:00
Collecting matplotlib>=3.5 (from xraylarch)
  Downloading matplotlib-3.8.0-cp312-cp312-win_amd64.whl.metadata (5.9 kB)
Collecting sqlalchemy>=2.0 (from xraylarch)
  Downloading SQLAlchemy-2.0.22-cp312-cp312-win_amd64.whl.metadata (9.7 kB)
Collecting sqlalchemy-utils (from xraylarch)
  Using cached SQLAlchemy_Utils-0.41.1-py3-none-any.whl (92 kB)
Collecting h5py>=3.2 (from xraylarch)
  Downloading h5py-3.10.0-cp312-cp312-win_amd64.whl.metadata (2.5 kB)
Collecting pillow>=8.3.2 (from xraylarch)
  Downloading Pillow-10.1.0-cp312-cp312-win_amd64.whl.metadata (9.6 kB)
Collecting psycopg2-binary (from xraylarch)
  Downloading psycopg2-binary-2.9.9.tar.gz (384 kB)
     ---------------------------------------- 385.0/385.0 kB 8.0 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting dill (from xraylarch)
  Using cached dill-0.3.7-py3-none-any.whl.metadata (9.9 kB)
Collecting imageio (from xraylarch)
  Downloading imageio-2.31.6-py3-none-any.whl.metadata (4.6 kB)
Collecting charset-normalizer (from xraylarch)
  Downloading charset_normalizer-3.3.1-cp312-cp312-win_amd64.whl.metadata (33 kB)
Collecting peakutils (from xraylarch)
  Using cached PeakUtils-1.3.4-py3-none-any.whl (7.7 kB)
Collecting requests (from xraylarch)
  Downloading requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)
Collecting scikit-image (from xraylarch)
  Downloading scikit_image-0.22.0-cp312-cp312-win_amd64.whl.metadata (13 kB)
Collecting scikit-learn (from xraylarch)
  Downloading scikit_learn-1.3.2-cp312-cp312-win_amd64.whl.metadata (11 kB)
Collecting asteval>=0.9.28 (from xraylarch)
  Using cached asteval-0.9.31-py3-none-any.whl.metadata (2.0 kB)
Collecting lmfit>=1.2.0 (from xraylarch)
  Using cached lmfit-1.2.2-py3-none-any.whl.metadata (9.9 kB)
Collecting uncertainties>=3.1 (from xraylarch)
  Using cached uncertainties-3.1.7-py2.py3-none-any.whl (98 kB)
Collecting pyshortcuts>=1.9.0 (from xraylarch)
  Using cached pyshortcuts-1.9.0-py3-none-any.whl (158 kB)
Collecting xraydb>=4.5 (from xraylarch)
  Using cached xraydb-4.5.1-py3-none-any.whl.metadata (1.6 kB)
Collecting silx>=0.15.2 (from xraylarch)
  Downloading silx-1.1.2.tar.gz (13.8 MB)
     ---------------------------------------- 13.8/13.8 MB 8.4 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [33 lines of output]
      Traceback (most recent call last):
        File "C:\ProgramData\xraylarch\envs\xraylarch\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\ProgramData\xraylarch\envs\xraylarch\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\ProgramData\xraylarch\envs\xraylarch\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 112, in get_requires_for_build_wheel
          backend = _build_backend()
                    ^^^^^^^^^^^^^^^^
        File "C:\ProgramData\xraylarch\envs\xraylarch\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 77, in _build_backend
          obj = import_module(mod_path)
                ^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\ProgramData\xraylarch\envs\xraylarch\Lib\importlib\__init__.py", line 90, in import_module
          return _bootstrap._gcd_import(name[level:], package, level)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
        File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
        File "<frozen importlib._bootstrap>", line 1304, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
        File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
        File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
        File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
        File "<frozen importlib._bootstrap_external>", line 994, in exec_module
        File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
        File "C:\Users\Liam Nagle-Cocco\AppData\Local\Temp\pip-build-env-lqtdz3om\overlay\Lib\site-packages\setuptools\__init__.py", line 16, in <module>
          import setuptools.version
        File "C:\Users\Liam Nagle-Cocco\AppData\Local\Temp\pip-build-env-lqtdz3om\overlay\Lib\site-packages\setuptools\version.py", line 1, in <module>
          import pkg_resources
        File "C:\Users\Liam Nagle-Cocco\AppData\Local\Temp\pip-build-env-lqtdz3om\overlay\Lib\site-packages\pkg_resources\__init__.py", line 2172, in <module>
          register_finder(pkgutil.ImpImporter, find_on_path)
                          ^^^^^^^^^^^^^^^^^^^
      AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

All packages in environment

Here is what happens when I run conda list after this.

(xraylarch) C:\WINDOWS\system32>conda list
# packages in environment at C:\ProgramData\xraylarch\envs\xraylarch:
#
# Name                    Version                   Build  Channel
bzip2                     1.0.8                h8ffe710_4    conda-forge
ca-certificates           2023.7.22            h56e8100_0    conda-forge
libexpat                  2.5.0                h63175ca_1    conda-forge
libffi                    3.4.2                h8ffe710_5    conda-forge
libsqlite                 3.43.2               hcfcfb64_0    conda-forge
libzlib                   1.2.13               hcfcfb64_5    conda-forge
openssl                   3.1.3                hcfcfb64_0    conda-forge
pip                       23.3.1             pyhd8ed1ab_0    conda-forge
python                    3.12.0          h2628c8c_0_cpython    conda-forge
setuptools                68.2.2             pyhd8ed1ab_0    conda-forge
tk                        8.6.13               hcfcfb64_0    conda-forge
tzdata                    2023c                h71feb2d_0    conda-forge
ucrt                      10.0.22621.0         h57928b3_0    conda-forge
vc                        14.3                h64f974e_17    conda-forge
vc14_runtime              14.36.32532         hdcecf7f_17    conda-forge
vs2015_runtime            14.36.32532         h05e6639_17    conda-forge
wheel                     0.41.2             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h8d14728_0    conda-forge

@lnaglecocco I think that the problem is that Python 3.12 was installed and maybe not all the packages are consistently available with Python 3.12.

I might suggest that you try starting with

conda create -y --name xraylarch python==3.11.5

Hi @newville , thanks for getting back to me! Apologies for my slow response.

I have tried following your advice, i.e. forcing the python to be 3.11.5 . I have run conda install -y -c conda-forge wxpython pymatgen scipy h5py matplotlib without issue, but when I then run pip install xraylarch I get an error message.

Below I include the output from conda list before running pip install xraylarch so you can see all the modules in the environment. Then I show the output from pip install xraylarch

If you'd have a suggestion I'd be grateful!

Console

(xraylarch_env) C:\WINDOWS\system32>conda list
# packages in environment at C:\ProgramData\xraylarch\envs\xraylarch_env:
#
# Name                    Version                   Build  Channel
brotli                    1.1.0                hcfcfb64_1    conda-forge
brotli-bin                1.1.0                hcfcfb64_1    conda-forge
brotli-python             1.1.0           py311h12c1d0e_1    conda-forge
bzip2                     1.0.8                h8ffe710_4    conda-forge
ca-certificates           2023.7.22            h56e8100_0    conda-forge
cached-property           1.5.2                hd8ed1ab_1    conda-forge
cached_property           1.5.2              pyha770c72_1    conda-forge
certifi                   2023.7.22          pyhd8ed1ab_0    conda-forge
charset-normalizer        3.3.1              pyhd8ed1ab_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
contourpy                 1.1.1           py311h005e61a_1    conda-forge
cycler                    0.12.1             pyhd8ed1ab_0    conda-forge
fonttools                 4.43.1          py311ha68e1ae_0    conda-forge
freetype                  2.12.1               hdaf720e_2    conda-forge
future                    0.18.3             pyhd8ed1ab_0    conda-forge
gettext                   0.21.1               h5728263_0    conda-forge
glib                      2.78.0               h12be248_0    conda-forge
glib-tools                2.78.0               h12be248_0    conda-forge
gst-plugins-base          1.22.6               h001b923_2    conda-forge
gstreamer                 1.22.6               hb4038d2_2    conda-forge
h5py                      3.10.0          nompi_py311h0d04526_100    conda-forge
hdf5                      1.14.2          nompi_h73e8ff5_100    conda-forge
icu                       73.2                 h63175ca_0    conda-forge
idna                      3.4                pyhd8ed1ab_0    conda-forge
intel-openmp              2023.2.0         h57928b3_50497    conda-forge
joblib                    1.3.2              pyhd8ed1ab_0    conda-forge
kiwisolver                1.4.5           py311h005e61a_1    conda-forge
krb5                      1.21.2               heb0366b_0    conda-forge
latexcodec                2.0.1              pyh9f0ad1d_0    conda-forge
lcms2                     2.15                 h67d730c_3    conda-forge
lerc                      4.0.0                h63175ca_0    conda-forge
libaec                    1.1.2                h63175ca_1    conda-forge
libblas                   3.9.0              19_win64_mkl    conda-forge
libbrotlicommon           1.1.0                hcfcfb64_1    conda-forge
libbrotlidec              1.1.0                hcfcfb64_1    conda-forge
libbrotlienc              1.1.0                hcfcfb64_1    conda-forge
libcblas                  3.9.0              19_win64_mkl    conda-forge
libclang                  15.0.7          default_h77d9078_3    conda-forge
libclang13                15.0.7          default_h77d9078_3    conda-forge
libcurl                   8.4.0                hd5e4a3a_0    conda-forge
libdeflate                1.19                 hcfcfb64_0    conda-forge
libffi                    3.4.2                h8ffe710_5    conda-forge
libglib                   2.78.0               he8f3873_0    conda-forge
libhwloc                  2.9.3           default_haede6df_1009    conda-forge
libiconv                  1.17                 h8ffe710_0    conda-forge
libjpeg-turbo             3.0.0                hcfcfb64_1    conda-forge
liblapack                 3.9.0              19_win64_mkl    conda-forge
libogg                    1.3.4                h8ffe710_1    conda-forge
libpng                    1.6.39               h19919ed_0    conda-forge
libsqlite                 3.43.2               hcfcfb64_0    conda-forge
libssh2                   1.11.0               h7dfc565_0    conda-forge
libtiff                   4.6.0                h6e2ebb7_2    conda-forge
libvorbis                 1.3.7                h0e60522_0    conda-forge
libwebp-base              1.3.2                hcfcfb64_0    conda-forge
libxcb                    1.15                 hcd874cb_0    conda-forge
libxml2                   2.11.5               hc3477c8_1    conda-forge
libzlib                   1.2.13               hcfcfb64_5    conda-forge
m2w64-gcc-libgfortran     5.3.0                         6    conda-forge
m2w64-gcc-libs            5.3.0                         7    conda-forge
m2w64-gcc-libs-core       5.3.0                         7    conda-forge
m2w64-gmp                 6.1.0                         2    conda-forge
m2w64-libwinpthread-git   5.0.0.4634.697f757               2    conda-forge
matplotlib                3.8.0           py311h1ea47a8_2    conda-forge
matplotlib-base           3.8.0           py311h6e989c2_2    conda-forge
mkl                       2023.2.0         h6a75c08_50496    conda-forge
monty                     2023.9.25          pyhd8ed1ab_0    conda-forge
mpmath                    1.3.0              pyhd8ed1ab_0    conda-forge
msys2-conda-epoch         20160418                      1    conda-forge
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
networkx                  3.2.1              pyhd8ed1ab_0    conda-forge
numpy                     1.26.0          py311h0b4df5a_0    conda-forge
openjpeg                  2.5.0                h3d672ee_3    conda-forge
openssl                   3.1.4                hcfcfb64_0    conda-forge
packaging                 23.2               pyhd8ed1ab_0    conda-forge
palettable                3.3.3              pyhd8ed1ab_0    conda-forge
pandas                    2.1.2           py311hf63dbb6_0    conda-forge
pathlib2                  2.3.7.post1     py311h1ea47a8_3    conda-forge
pcre2                     10.40                h17e33f8_0    conda-forge
pillow                    10.1.0          py311h4dd8a23_0    conda-forge
pip                       23.3.1             pyhd8ed1ab_0    conda-forge
plotly                    5.18.0             pyhd8ed1ab_0    conda-forge
ply                       3.11                       py_1    conda-forge
pthread-stubs             0.4               hcd874cb_1001    conda-forge
pthreads-win32            2.9.1                hfa6e2cd_3    conda-forge
pybtex                    0.24.0             pyhd8ed1ab_2    conda-forge
pymatgen                  2023.10.11      py311h59ca53f_0    conda-forge
pyparsing                 3.1.1              pyhd8ed1ab_0    conda-forge
pyqt                      5.15.9          py311h125bc19_5    conda-forge
pyqt5-sip                 12.12.2         py311h12c1d0e_5    conda-forge
pysocks                   1.7.1              pyh0701188_6    conda-forge
python                    3.11.5               he1021f5_0
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python-tzdata             2023.3             pyhd8ed1ab_0    conda-forge
python_abi                3.11                    2_cp311    conda-forge
pytz                      2023.3.post1       pyhd8ed1ab_0    conda-forge
pyyaml                    6.0.1           py311ha68e1ae_1    conda-forge
qt-main                   5.15.8              h9e85ed6_17    conda-forge
requests                  2.31.0             pyhd8ed1ab_0    conda-forge
ruamel.yaml               0.18.3          py311ha68e1ae_0    conda-forge
ruamel.yaml.clib          0.2.7           py311ha68e1ae_2    conda-forge
scipy                     1.11.3          py311h0b4df5a_1    conda-forge
setuptools                68.2.2             pyhd8ed1ab_0    conda-forge
sip                       6.7.12          py311h12c1d0e_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
spglib                    2.0.2           py311h59ca53f_0    conda-forge
sqlite                    3.43.2               hcfcfb64_0    conda-forge
sympy                     1.12               pyh04b8f61_3    conda-forge
tabulate                  0.9.0              pyhd8ed1ab_1    conda-forge
tbb                       2021.10.0            h91493d7_2    conda-forge
tenacity                  8.2.3              pyhd8ed1ab_0    conda-forge
tk                        8.6.13               hcfcfb64_0    conda-forge
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
tomli                     2.0.1              pyhd8ed1ab_0    conda-forge
tornado                   6.3.3           py311ha68e1ae_1    conda-forge
tqdm                      4.66.1             pyhd8ed1ab_0    conda-forge
tzdata                    2023c                h71feb2d_0    conda-forge
ucrt                      10.0.22621.0         h57928b3_0    conda-forge
uncertainties             3.1.7              pyhd8ed1ab_0    conda-forge
urllib3                   2.0.7              pyhd8ed1ab_0    conda-forge
vc                        14.3                h64f974e_17    conda-forge
vc14_runtime              14.36.32532         hdcecf7f_17    conda-forge
vs2015_runtime            14.36.32532         h05e6639_17    conda-forge
wheel                     0.41.2             pyhd8ed1ab_0    conda-forge
win_inet_pton             1.1.0              pyhd8ed1ab_6    conda-forge
wxpython                  4.2.1           py311h12c1d0e_0    conda-forge
xorg-libxau               1.0.11               hcd874cb_0    conda-forge
xorg-libxdmcp             1.1.3                hcd874cb_0    conda-forge
xz                        5.4.2                h8cc25b3_0
yaml                      0.2.5                h8ffe710_2    conda-forge
zlib                      1.2.13               hcfcfb64_5    conda-forge
zstd                      1.5.5                h12be248_0    conda-forge

(xraylarch_env) C:\WINDOWS\system32>pip install xraylarch
Traceback (most recent call last):
  File "C:\ProgramData\xraylarch\envs\xraylarch_env\Scripts\pip-script.py", line 5, in <module>
    from pip._internal.cli.main import main
  File "C:\ProgramData\xraylarch\envs\xraylarch_env\Lib\site-packages\pip\_internal\cli\main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "C:\ProgramData\xraylarch\envs\xraylarch_env\Lib\site-packages\pip\_internal\cli\autocompletion.py", line 10, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "C:\ProgramData\xraylarch\envs\xraylarch_env\Lib\site-packages\pip\_internal\cli\main_parser.py", line 9, in <module>
    from pip._internal.build_env import get_runnable_pip
  File "C:\ProgramData\xraylarch\envs\xraylarch_env\Lib\site-packages\pip\_internal\build_env.py", line 19, in <module>
    from pip._internal.cli.spinners import open_spinner
  File "C:\ProgramData\xraylarch\envs\xraylarch_env\Lib\site-packages\pip\_internal\cli\spinners.py", line 9, in <module>
    from pip._internal.utils.logging import get_indentation
  File "C:\ProgramData\xraylarch\envs\xraylarch_env\Lib\site-packages\pip\_internal\utils\logging.py", line 29, in <module>
    from pip._internal.utils.misc import ensure_dir
  File "C:\ProgramData\xraylarch\envs\xraylarch_env\Lib\site-packages\pip\_internal\utils\misc.py", line 44, in <module>
    from pip._internal.locations import get_major_minor_version
  File "C:\ProgramData\xraylarch\envs\xraylarch_env\Lib\site-packages\pip\_internal\locations\__init__.py", line 14, in <module>
    from . import _sysconfig
  File "C:\ProgramData\xraylarch\envs\xraylarch_env\Lib\site-packages\pip\_internal\locations\_sysconfig.py", line 11, in <module>
    from .base import change_root, get_major_minor_version, is_osx_framework
  File "C:\ProgramData\xraylarch\envs\xraylarch_env\Lib\site-packages\pip\_internal\locations\base.py", line 9, in <module>
    from pip._internal.utils import appdirs
  File "C:\ProgramData\xraylarch\envs\xraylarch_env\Lib\site-packages\pip\_internal\utils\appdirs.py", line 13, in <module>
    from pip._vendor import platformdirs as _appdirs
  File "C:\ProgramData\xraylarch\envs\xraylarch_env\Lib\site-packages\pip\_vendor\platformdirs\__init__.py", line 46, in <module>
    PlatformDirs = _set_platform_dir_class()  #: Currently active platform
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\xraylarch\envs\xraylarch_env\Lib\site-packages\pip\_vendor\platformdirs\__init__.py", line 26, in _set_platform_dir_class
    from pip._vendor.platformdirs.windows import Windows as Result
  File "C:\ProgramData\xraylarch\envs\xraylarch_env\Lib\site-packages\pip\_vendor\platformdirs\windows.py", line 4, in <module>
    import ctypes
  File "C:\ProgramData\xraylarch\envs\xraylarch_env\Lib\ctypes\__init__.py", line 8, in <module>
    from _ctypes import Union, Structure, Array
ImportError: DLL load failed while importing _ctypes: The specified module could not be found.

@lnaglecocco That seems like a pip problem. Did you try to diagnose that? Maybe check if you can pip install anything else - I would bet not.

It is OK if you want to not use the binary installers or installation scripts and instead install from the Python environment of your choice. But, if you do that, it is very hard for me to help you.

Hi @newville

Thanks for the advice. I actually tried installing the binary first, and I can use XAS Viewer for instance, but couldn't work out how to get the capability to run Larch from a python script that I could write in a text editor like Spyder or VisualStudio. Is there any online material explaining how to do this, or could you let me know how here?

I have managed to fix this by uninstalling Xraylarch and Anaconda and reinstalling. During Anaconda reinstall I clear package cache. Now I can use larch in Anaconda