I guess the problem is fixed now.
If I install cobaya(the new version you upgraded) with this command
Code: Select all
conda create -n py39forge -c conda-forge python=3.9 scipy pandas matplotlib PyYAML PySide2
conda activate py39forge
python -m pip install cobaya[gui] --upgrade
and try to run "cobaya-cosmo-generator," the following error arises:
Code: Select all
PySide2/__init__.py: Unable to import shiboken2 from /home/cosmos/anaconda3/envs/py39forge/bin, /home/cosmos/anaconda3/envs/py39forge/lib/python39.zip, /home/cosmos/anaconda3/envs/py39forge/lib/python3.9, /home/cosmos/anaconda3/envs/py39forge/lib/python3.9/lib-dynload, /home/cosmos/anaconda3/envs/py39forge/lib/python3.9/site-packages
Traceback (most recent call last):
File "/home/cosmos/anaconda3/envs/py39forge/bin/cobaya-cosmo-generator", line 5, in <module>
from cobaya.cosmo_input import gui_script
File "/home/cosmos/anaconda3/envs/py39forge/lib/python3.9/site-packages/cobaya/cosmo_input/__init__.py", line 2, in <module>
from .gui import gui_script
File "/home/cosmos/anaconda3/envs/py39forge/lib/python3.9/site-packages/cobaya/cosmo_input/gui.py", line 33, in <module>
from PySide2.QtWidgets import QWidget, QApplication, QVBoxLayout, QHBoxLayout, \
File "/home/cosmos/anaconda3/envs/py39forge/lib/python3.9/site-packages/PySide2/__init__.py", line 107, in <module>
_setupQtDirectories()
File "/home/cosmos/anaconda3/envs/py39forge/lib/python3.9/site-packages/PySide2/__init__.py", line 58, in _setupQtDirectories
import shiboken2
File "/home/cosmos/anaconda3/envs/py39forge/lib/python3.9/site-packages/shiboken2/__init__.py", line 30, in <module>
_init_pyside_extension()
NameError: name '_init_pyside_extension' is not defined
and I became sure that the problem occurs due to pyside2 and shiboken2 installed by pip because there was no problem with running this command
Code: Select all
from PySide2.QtWidgets import QWidget
before installing cobaya with pip, whereas after installing cobaya, python shows the following same error:
Code: Select all
>>> from PySide2.QtWidgets import QWidget
PySide2/__init__.py: Unable to import shiboken2 from , /home/cosmos/anaconda3/envs/py39forge/lib/python39.zip, /home/cosmos/anaconda3/envs/py39forge/lib/python3.9, /home/cosmos/anaconda3/envs/py39forge/lib/python3.9/lib-dynload, /home/cosmos/anaconda3/envs/py39forge/lib/python3.9/site-packages
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/cosmos/anaconda3/envs/py39forge/lib/python3.9/site-packages/PySide2/__init__.py", line 107, in <module>
_setupQtDirectories()
File "/home/cosmos/anaconda3/envs/py39forge/lib/python3.9/site-packages/PySide2/__init__.py", line 58, in _setupQtDirectories
import shiboken2
File "/home/cosmos/anaconda3/envs/py39forge/lib/python3.9/site-packages/shiboken2/__init__.py", line 30, in <module>
_init_pyside_extension()
NameError: name '_init_pyside_extension' is not defined
So I manually uninstalled and reinstalled two packages with version 5.13.2. Then everything runs fine.
I don't know if this kind of error is a general one, but it would be some help to note explicitly not to use version 5.15.2 version of pyside2(that is, installed by pip) in the document of cobaya?
Anyway, thank you for helping me, Lewis!