In import psi4, I got "ImportError: cannot import name 'core' from partially initialized module 'psi4' (most likely due to a circular import)"

Hi,

I tried to do an import psi4 in a python file with the latest psi4 v1.4.0rc3+, and I got

Traceback (most recent call last):
  File "/home/username/psi4conda/lib/python3.7/site-packages/psi4/__init__.py", line 55, in <module>
    from . import core
ImportError: cannot import name 'core' from partially initialized module 'psi4' (most likely due to a circular import) (/home/username/psi4conda/lib/python3.7/site-packages/psi4/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/username/psi4conda/lib/python3.7/site-packages/psi4/__init__.py", line 60, in <module>
    raise ImportError("{0}".format(err))
ImportError: cannot import name 'core' from partially initialized module 'psi4' (most likely due to a circular import) (/home/username/psi4conda/lib/python3.7/site-packages/psi4/__init__.py)

In my .bashrc file, it is

export PATH="/home/username/anaconda3/lib/python3.7/site-packages:$PATH"



export PATH=/home/username/psi4conda/bin:$PATH
export PYTHONPATH=/home/username/psi4conda/lib//python3.7/site-packages:$PYTHONPATH

I checked the post
Unable to import Psi4 in python - Psi4 – Open-Source Quantum Chemistry (psicode.org)
and used

psi4 --psiapi

and

conda create -n p4dev psi4 -c psi4/label/dev # latest version

still the same issue :frowning:

Does import psi4 work in a fresh python terminal?

This PATH is probably not what you want, the bin is enough, but should not cause harm:

export PATH="/home/username/anaconda3/lib/python3.7/site-packages:$PATH"

It looks like you may be mixing installations between anaconda3 and psi4conda. Go with one or the other at a time.

If your goal is psi4 in your ordinary anaconda3 setup, make sure which conda comes from the anaconda3 dir, make sure there’s no psi4conda in path or pythonpath, then do the conda create -n p4dev psi4 -c psi4/label/dev you mentioned above. After the environment p4dev is activated, there’s no need for psi4 --psiapi since the conda activation has already set all that up.