diffpy / diffpy.pdffit2

real space structure refinement to atomic PDF
Other
4 stars 16 forks source link

v1.4.3 distributions for Mac Silicon and Noarch? #24

Open matthewcarbone opened 4 months ago

matthewcarbone commented 4 months ago

Hi there,

It looks like the latest version, v1.4.3, is not available for Mac Silicon and noarch. Are there plans for this release? I seemingly cannot use this code due to the following error in v1.4.0 (which I'm not actually sure is due to v1.4.0 or not):

$ conda create -n py3.10-Local-Structure-Modeling python=3.10 -y
$ conda activate py3.10-Local-Structure-Modeling
$ conda install -c conda-forge diffpy.pdffit2
$ pip install ipython

$ ipython

In [1]: from diffpy.pdffit2 import PdfFit

---------------------------------------------------------------------------

ImportError                               Traceback (most recent call last)
Cell In[1], line 1

----> 1 from diffpy.pdffit2 import PdfFit

File ~/miniforge3/envs/py3.10-Local-Structure-Modeling/lib/python3.10/site-packages/diffpy/pdffit2/__init__.py:25
     16 """PDFfit2 - real space structure refinement program.
     17 Classes:
     18     PdfFit
     19 Routines:
     20     redirect_stdout
     21 """
     24 from diffpy.pdffit2.version import __version__, __date__
---> 25 from diffpy.pdffit2.pdffit import PdfFit
     26 from diffpy.pdffit2.output import redirect_stdout
     27 from diffpy.pdffit2.pdffit2 import is_element

File ~/miniforge3/envs/py3.10-Local-Structure-Modeling/lib/python3.10/site-packages/diffpy/pdffit2/pdffit.py:29
     23 import six
     25 # Load pdffit2 and output modules to the current namespace.
     26 # Note that "import diffpy.pdffit2.output as output" would
     27 # crash with AttributeError when executed during imports of
     28 # parent packages.
---> 29 from diffpy.pdffit2 import pdffit2
     30 from diffpy.pdffit2 import output
     32 # helper routines

ImportError: cannot import name 'pdffit2' from partially initialized module 'diffpy.pdffit2' (most likely due to a circular import) (/Users/mc/miniforge3/envs/py3.10-Local-Structure-Modeling/lib/python3.10/site-packages/diffpy/pdffit2/__init__.py)

Any help would be appreciated! Thanks!

sbillinge commented 4 months ago

Thanks Matt. We do have plans to do the Mac releases. We have been working through our releases redoing them without setup.py and we didn't get to this yet, but I think the urgency is increasing, especially with the workaround for M2 chips apparently not working for M3:


CONDA_SUBDIR=osx-64 conda create -n pdfgui2 python=3.9

conda activate pdfgui2

conda config --env --set subdir osx-64

conda install -c conda-forge diffpy.pdfgui

pdfgui

This uses Rosetta to run the osx-64 code on the arm architecture, but we do need a native ARM build

matthewcarbone commented 4 months ago

@sbillinge thanks, Simon! For now I can probably just use a container to make it work.

matthewcarbone commented 4 months ago

@sbillinge in the meantime do you have any advice here? I really want to get this code working, even in a clean Docker container, but the v1.4.0 installation via conda appears to just not work due to this circular import error. Thanks in advance for your help.

matthewcarbone commented 4 months ago

I did ultimately get this working (v1.4.3) in a Docker container. Here's the instructions for Ubuntu 22.04 if it's helpful for you or anyone else. I've also included a few other quality of life installs here:

# Download base image ubuntu 22.04
FROM ubuntu:22.04

# Disable Prompt During Packages Installation
ARG DEBIAN_FRONTEND=noninteractive

# Install essentials
RUN apt -y update
RUN apt -y install aptitude
RUN aptitude -y install vim
RUN aptitude -y install wget
RUN aptitude -y install curl
RUN aptitude -y install build-essential
RUN aptitude -y install libgsl-dev

# Install miniconda on Linux
RUN mkdir -p ~/miniconda3
ARG ARCHITECTURE=aarch64
RUN wget "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-${ARCHITECTURE}.sh" -O ~/miniconda3/miniconda.sh

# Initialize miniconda
RUN bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
RUN rm -rf ~/miniconda3/miniconda.sh
RUN ~/miniconda3/bin/conda init bash
RUN ~/miniconda3/bin/conda init zsh

# Now install diffpy.pdffit2
# note that this requires the manual installation of gcc via build-essential
# and gsl via libgsl-dev
ARG PIP=/root/miniconda3/bin/pip
RUN "${PIP}" install "diffpy.pdffit2==1.4.3"

RUN rm -rf /var/lib/apt/lists/*
sbillinge commented 4 months ago

Thanks Matt

On Sat, May 11, 2024 at 10:41 AM Matthew Carbone @.***> wrote:

I did ultimately get this working (v1.4.3) in a Docker container. Here's the instructions for Ubuntu 22.04 if it's helpful for you or anyone else. I've also included a few other quality of life installs here:

Download base image ubuntu 22.04FROM ubuntu:22.04

Disable Prompt During Packages InstallationARG DEBIAN_FRONTEND=noninteractive

Install essentialsRUN apt -y updateRUN apt -y install aptitudeRUN aptitude -y install vimRUN aptitude -y install wgetRUN aptitude -y install curlRUN aptitude -y install build-essentialRUN aptitude -y install libgsl-dev

Install miniconda on LinuxRUN mkdir -p ~/miniconda3ARG ARCHITECTURE=aarch64RUN wget "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-${ARCHITECTURE}.sh" -O ~/miniconda3/miniconda.sh

Initialize minicondaRUN bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3RUN rm -rf ~/miniconda3/miniconda.shRUN ~/miniconda3/bin/conda init bashRUN ~/miniconda3/bin/conda init zsh

Now install diffpy.pdffit2# note that this requires the manual installation of gcc via build-essential# and gsl via libgsl-devARG PIP=/root/miniconda3/bin/pipRUN "${PIP}" install "diffpy.pdffit2==1.4.3"

RUN rm -rf /var/lib/apt/lists/*

— Reply to this email directly, view it on GitHub https://github.com/diffpy/diffpy.pdffit2/issues/24#issuecomment-2105895462, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABAOWUIU6O3KBIMENWFJVXDZBYUZNAVCNFSM6AAAAABHRQM4TGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBVHA4TKNBWGI . You are receiving this because you were mentioned.Message ID: @.***>

-- Simon Billinge Professor, Department of Applied Physics and Applied Mathematics Columbia University