Skip to content

pdffit2 dependency on arm Mac #164

Closed

Description

@Tieqiong

When installing requirement/run.txt using Conda, Arm architecture Mac will install 1.4.0 instead of the latest 1.4.3, even though there are 1.4.3 version of diffpy.pdffit2 for osx platform. One thing to notice is that Conda can't find 1.4.3 version when directly installing from Conda-forge. This will lead to pytest failing because of circular dependency:

(test) Tieqiong@TQsMac diffpy.pdfgui % python -m pytest
=================================== test session starts ===================================
platform darwin -- Python 3.12.5, pytest-8.3.2, pluggy-1.5.0
rootdir: /Users/Tieqiong/File/repo/diffpy.pdfgui
configfile: pyproject.toml
plugins: env-1.1.3
collecting 5 items / 4 errors Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/diffpy/pdfgui/tests/rundeps.py", line 28, in
sys.exit(not testdeps().wasSuccessful())
^^^^^^^^^^
File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/diffpy/pdfgui/tests/init.py", line 98, in testdeps
mod = import_module(mname)
^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda3/envs/test/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1310, in _find_and_load_unlocked
File "", line 488, in _call_with_frames_removed
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 995, in exec_module
File "", line 488, in _call_with_frames_removed
File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/diffpy/pdffit2/init.py", line 25, in
from diffpy.pdffit2.pdffit import PdfFit
File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/diffpy/pdffit2/pdffit.py", line 29, in
from diffpy.pdffit2 import pdffit2
ImportError: cannot import name 'pdffit2' from partially initialized module 'diffpy.pdffit2' (most likely due to a circular import) (/opt/miniconda3/envs/test/lib/python3.12/site-packages/diffpy/pdffit2/init.py)
collected 6 items / 16 errors
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/_pytest/main.py", line 283, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/_pytest/main.py", line 336, in _main
INTERNALERROR> config.hook.pytest_collection(session=session)
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in call
INTERNALERROR> return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR> raise exception.with_traceback(exception.traceback)
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR> teardown.throw(exception) # type: ignore[union-attr]
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/_pytest/logging.py", line 792, in pytest_collection
INTERNALERROR> return (yield)
INTERNALERROR> ^^^^^
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR> teardown.throw(exception) # type: ignore[union-attr]
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/_pytest/warnings.py", line 121, in pytest_collection
INTERNALERROR> return (yield)
INTERNALERROR> ^^^^^
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR> teardown.throw(exception) # type: ignore[union-attr]
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/_pytest/config/init.py", line 1413, in pytest_collection
INTERNALERROR> return (yield)
INTERNALERROR> ^^^^^
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/_pytest/main.py", line 347, in pytest_collection
INTERNALERROR> session.perform_collect()
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/_pytest/main.py", line 812, in perform_collect
INTERNALERROR> hook.pytest_collection_modifyitems(
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in call
INTERNALERROR> return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR> raise exception.with_traceback(exception.traceback)
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR> teardown.throw(exception) # type: ignore[union-attr]
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/_pytest/cacheprovider.py", line 445, in pytest_collection_modifyitems
INTERNALERROR> res = yield
INTERNALERROR> ^^^^^
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR> teardown.throw(exception) # type: ignore[union-attr]
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/_pytest/cacheprovider.py", line 373, in pytest_collection_modifyitems
INTERNALERROR> res = yield
INTERNALERROR> ^^^^^
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/Users/Tieqiong/File/repo/diffpy.pdfgui/src/diffpy/pdfgui/tests/conftest.py", line 9, in pytest_collection_modifyitems
INTERNALERROR> subprocess.run(["python", "-m", "diffpy.pdfgui.tests.rundeps"], check=True)
INTERNALERROR> File "/opt/miniconda3/envs/test/lib/python3.12/subprocess.py", line 571, in run
INTERNALERROR> raise CalledProcessError(retcode, process.args,
INTERNALERROR> subprocess.CalledProcessError: Command '['python', '-m', 'diffpy.pdfgui.tests.rundeps']' returned non-zero exit status 1.
==============================1 warning, 16 errors in 1.54s ==============================

This could be solved by pip install diffpy.pdffit2 == 1.4.3. Maybe we want to release a working version of diffpy.pdffit2 on condaforge for arm? Or move diffpy.pdffit2 from requirement/run.txt to requirement/pip.txt?

This issue seems to be only happening on arm Mac. The testing workflow on GitHub using ubuntu didn't face this problem.

Activity

  1. added this to the v3.1.0 milestone on Aug 20, 2024
  2. bobleesj commented on Sep 24, 2024

    @bobleesj
    Contributor

    Comment - This is occurring because no usable pdffit2 is available on conda-forge.
    Once pdffit2 on is released on conda-forge, this should be fixed automatically.

  3. bobleesj commented on Sep 25, 2024

    @bobleesj
    Contributor

    Closing this issues since

    conda create -n gui_env_py3.11_1.4.4rc3 \
        python=3.11 \
        --file requirements/test.txt \
        --file requirements/run.txt \
        --file requirements/build.txt
    
    # Then download locally
    pip install . --no-deps
    pytest
    

    Runs in the cookiecutter version - tested with M1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions