我正试图降级libffi = 3.3,因为我遇到了一个bug(见结尾).

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  

正如你所看到的,我已经把python降级到了3.11——为什么conda solver会抱怨"pin1"以及它对python 3.11的要求?


我遇到的bug是由pystata触发的,并且在降级Python和libffi后得到了解决,如答案所示:

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

推荐答案

Conda不允许Python版本在没有显式声明的情况下更改,这是pin的功能.冲突报告显示,没有一个版本的python=3.11是针对libffi <3.4构建的.进一步降级python应该起到作用,即,

conda install -n mismatch python=3.10 libffi=3.3

请注意,libffi=3.3已经超过3年了,所以Python 3.11(2022年10月发布)不兼容是有道理的.

Python相关问答推荐

使用Keras的线性回归参数估计

numba jitClass,记录类型为字符串

运行总计基于多列pandas的分组和总和

处理带有间隙(空)的duckDB上的重复副本并有效填充它们

Python键入协议默认值

在极性中创建条件累积和

当点击tkinter菜单而不是菜单选项时,如何执行命令?

名为__main__. py的Python模块在导入时不运行'

如何在Python中使用另一个数据框更改列值(列表)

dask无groupby(ddf. agg([min,max])?''''

matplotlib图中的复杂箭头形状

Python避免mypy在相互引用中从另一个类重定义类时失败

PYTHON、VLC、RTSP.屏幕截图不起作用

Odoo16:模板中使用的docs变量在哪里定义?

以异步方式填充Pandas 数据帧

如何强制向量中的特定元素在Gekko中处于优化解决方案中

当HTTP 201响应包含 Big Data 的POST请求时,应该是什么?  

PySpark:如何最有效地读取不同列位置的多个CSV文件

来自Airflow Connection的额外参数

有没有一种方法可以在朗肯代理中集成向量嵌入