Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import issue with diffpy.pdffit2 #68

Open
briantoby opened this issue Aug 16, 2024 · 5 comments
Open

import issue with diffpy.pdffit2 #68

briantoby opened this issue Aug 16, 2024 · 5 comments

Comments

@briantoby
Copy link
Contributor

Installing diffpy.pdffit2 via conda results in a package that cannot be loaded. I used this command to create a separate Python interpreter with PDFfit2:

conda create -n diffpy.pdffit2_env diffpy.pdffit2 -c conda-forge

This installs Py3.12, gsl, pycifrw, diffpy.structure and many more standard packages (such as numpy).

The package fails to be imported, with the following error:

(base) toby@BHT24 /tmp % conda activate diffpy.pdffit2_env
(diffpy.pdffit2_env) toby@BHT24 /tmp % python
Python 3.12.5 | packaged by conda-forge | (main, Aug  8 2024, 18:32:50) [Clang 16.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import diffpy.pdffit2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/G2PY11/envs/diffpy.pdffit2_env/lib/python3.12/site-packages/diffpy/pdffit2/__init__.py", line 25, in <module>
    from diffpy.pdffit2.pdffit import PdfFit
  File "/tmp/G2PY11/envs/diffpy.pdffit2_env/lib/python3.12/site-packages/diffpy/pdffit2/pdffit.py", line 29, in <module>
    from diffpy.pdffit2 import pdffit2
ImportError: cannot import name 'pdffit2' from partially initialized module 'diffpy.pdffit2' (most likely due to a circular import) (/tmp/G2PY11/envs/diffpy.pdffit2_env/lib/python3.12/site-packages/diffpy/pdffit2/__init__.py)
>>> 

The same error occurs (with different file paths) if I install diffpy.pdffit2 into the base Python using command

conda install  diffpy.pdffit2 -c conda-forge
@sbillinge
Copy link
Contributor

Thanks for this Brian.

We are right now, as we speak, working on a new release of pdffit2 and pdfgui that brings it up to most recent Python. We can then address these errors.

@briantoby
Copy link
Contributor Author

This seems to be addressed in diffpy.pdffit2-1.4.3, at least when tested on Intel Mac, but there does not seem to be a osx-arm64 version of diffpy.pdffit2 and the noarch versions are all 1.4.0.

@sbillinge
Copy link
Contributor

@briantoby we are working on the arm64. We hope to have one on pip shortly. It seems hard to build it on conda-forge.

It would be great if you could help test hat we are doing. We have a conda-forge pre-release of pdfgui and pdffit2 for python 3.10-3.12:

conda install -c conda-forge/label/diffpy.pdfgui_rc -c conda-forge/label/diffpy.pdffit2_rc diffpy.pdfgui=3.1.0rc5 diffpy.pdffit2=1.4.4rc4

We should have an arm64 wheel shortly on pip. I guess you need an arm64 build on conda-forge though, right? @Tieqiong and @bobleesj are working on these things.

@briantoby
Copy link
Contributor Author

FWIW, I do my builds on GitHub and then push the created packages to conda-forge. An example is here: https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/blob/main/.github/workflows/gsas2pkg.yml

I was never able to get builds on conda-forge to work for me.

@sbillinge
Copy link
Contributor

Thanks @briantoby we are kind of working out way back to a similar solution so seeing yours is helpful. Not quite as the easy back there yet...

@sbillinge sbillinge added this to the v 1.5.0rc0 pre-release milestone Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants