Search code examples
pythoncondalibffi

Unknown dependency "pin-1" prevents conda installation


I'm trying to downgrade libffi=3.3 because of a bug I'm encountering (see very end).

conda install libffi==3.3 -n mismatch
Channels:
 - defaults
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: \ warning  libmamba Added empty dependency for problem type SOLVER_RULE_UPDATE
failed

LibMambaUnsatisfiableError: Encountered problems while solving:
  - package python-3.11.8-h955ad1f_0 requires libffi >=3.4,<3.5, but none of the providers can be installed

Could not solve for environment specs
The following packages are incompatible
├─ libffi 3.3  is requested and can be installed;
├─ matplotlib is installable with the potential options
│  ├─ matplotlib [3.6.2|3.7.1|3.7.2] would require
│  │  └─ matplotlib-base [>=3.6.2,<3.6.3.0a0 |>=3.7.1,<3.7.2.0a0 |>=3.7.2,<3.7.3.0a0 ] with the potential options
│  │     ├─ matplotlib-base [3.6.2|3.7.1|3.7.2] would require
│  │     │  └─ python >=3.11,<3.12.0a0 , which requires
│  │     │     └─ libffi >=3.4,<3.5 , which conflicts with any installable versions previously reported;
│  │     ├─ matplotlib-base [3.6.2|3.7.1|3.7.2] would require
│  │     │  └─ python >=3.10,<3.11.0a0 , which can be installed;
│  │     ├─ matplotlib-base [3.2.1|3.2.2|...|3.7.2] would require
│  │     │  └─ python >=3.8,<3.9.0a0 , which can be installed;
│  │     └─ matplotlib-base [3.3.2|3.6.2|3.7.1|3.7.2] would require
│  │        └─ python >=3.9,<3.10.0a0 , which can be installed;
│  ├─ matplotlib 3.8.0 would require
│  │  └─ python >=3.11,<3.12.0a0 , which cannot be installed (as previously explained);
│  ├─ matplotlib [2.0.2|2.1.0|...|2.2.3] would require
│  │  └─ python >=2.7,<2.8.0a0 , which can be installed;
│  ├─ matplotlib [2.0.2|2.1.0|...|3.0.0] would require
│  │  └─ python >=3.5,<3.6.0a0 , which can be installed;
│  ├─ matplotlib [2.0.2|2.1.0|...|3.3.4] would require
│  │  └─ python >=3.6,<3.7.0a0 , which can be installed;
│  ├─ matplotlib [2.2.2|2.2.3|...|3.5.3] would require
│  │  └─ python >=3.7,<3.8.0a0 , which can be installed;
│  ├─ matplotlib [3.1.1|3.1.2|...|3.7.2] would require
│  │  └─ python >=3.8,<3.9.0a0 , which can be installed;
│  ├─ matplotlib [3.2.1|3.2.2|3.3.1] would require
│  │  └─ matplotlib-base [>=3.2.1,<3.2.2.0a0 |>=3.2.2,<3.2.3.0a0 |>=3.3.1,<3.3.2.0a0 ] with the potential options
│  │     ├─ matplotlib-base [3.2.1|3.2.2|...|3.7.2], which can be installed (as previously explained);
│  │     ├─ matplotlib-base [3.2.1|3.2.2|3.3.1|3.3.2] would require
│  │     │  └─ python >=3.6,<3.7.0a0 , which can be installed;
│  │     └─ matplotlib-base [3.2.1|3.2.2|3.3.1|3.3.2] would require
│  │        └─ python >=3.7,<3.8.0a0 , which can be installed;
│  ├─ matplotlib 3.3.2 would require
│  │  └─ matplotlib-base >=3.3.2,<3.3.3.0a0 , which can be installed (as previously explained);
│  ├─ matplotlib [3.3.4|3.4.2|...|3.8.0] would require
│  │  └─ python >=3.9,<3.10.0a0 , which can be installed;
│  ├─ matplotlib [3.5.0|3.5.1|...|3.8.0] would require
│  │  └─ python >=3.10,<3.11.0a0 , which can be installed;
│  └─ matplotlib 3.8.0 would require
│     └─ python >=3.12,<3.13.0a0 , which can be installed;
└─ pin-1 is not installable because it requires
   └─ python 3.11.* , which conflicts with any installable versions previously reported.

(mismatch) :$ conda list python -n mismatch
# packages in environment at /home/x/anaconda3/envs/mismatch:
#
# Name                    Version                   Build  Channel
python                    3.11.8               h955ad1f_0  

As you can see I already have downgraded python to 3.11 -- why is the conda solver complaining about "pin1" and its requirement for python 3.11?


The bug that I'm encountering is triggered by pystata, and is resolved after downgrading Python and libffi as suggested by the answer:

Traceback (most recent call last):
  File "/usr/local/stata18/utilities/pystata/config.py", line 239, in init
    stlib = cdll.LoadLibrary(lib_path)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/anaconda3/envs/mismatch/lib/python3.12/ctypes/__init__.py", line 460, in LoadLibrary
    return self._dlltype(name)
           ^^^^^^^^^^^^^^^^^^^
  File "~/anaconda3/envs/mismatch/lib/python3.12/ctypes/__init__.py", line 379, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: /usr/lib/x86_64-linux-gnu/libp11-kit.so.0: undefined symbol: ffi_type_pointer, version LIBFFI_BASE_7.0


During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/snap/pycharm-professional/378/plugins/python/helpers/pydev/pydevd.py", line 1534, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/snap/pycharm-professional/378/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "main.py", line 17, in <module>
    config.init('be')
  File "/usr/local/stata18/utilities/pystata/config.py", line 241, in init

Solution

  • Conda does not allow Python versions to change without explicit declaration, which is the function of the pin. The conflict report shows that there is no version of python=3.11 that was built against libffi <3.4. Downgrading python further should do the trick, i.e.,

    conda install -n mismatch python=3.10 libffi=3.3
    

    Note that libffi=3.3 is over 3 years old, so it makes sense that Python 3.11 (released Oct. 2022) is not compatible.