Dependency error when installing psi4 in a fresh conda environment

I am installing psi4 in a fresh conda environment using “conda install psi4 -c psi4” and keep getting the following error:

(psitest) vlita@vlita-ThinkPad-T490:~/Desktop/rsrch$ python psi4_test.py
/home/vlita/anaconda3/envs/psitest/lib/python3.10/site-packages/pydantic/_internal/_config.py:321: UserWarning: Valid config keys have changed in V2:

  • ‘allow_mutation’ has been removed
    warnings.warn(message, UserWarning)
    Traceback (most recent call last):
    File “/home/vlita/Desktop/rsrch/psi4_test.py”, line 1, in
    import psi4
    File “/home/vlita/anaconda3/envs/psitest/lib/python3.10/site-packages/psi4/init.py”, line 75, in
    from .driver import endorsed_plugins
    File “/home/vlita/anaconda3/envs/psitest/lib/python3.10/site-packages/psi4/driver/init.py”, line 42, in
    from qcelemental import constants
    File “/home/vlita/anaconda3/envs/psitest/lib/python3.10/site-packages/qcelemental/init.py”, line 6, in
    from . import covalent_radii, models, molparse, molutil, periodic_table, physical_constants, util, vanderwaals_radii
    File “/home/vlita/anaconda3/envs/psitest/lib/python3.10/site-packages/qcelemental/models/init.py”, line 10, in
    from .align import AlignmentMill
    File “/home/vlita/anaconda3/envs/psitest/lib/python3.10/site-packages/qcelemental/models/align.py”, line 6, in
    from …util import blockwise_contract, blockwise_expand
    File “/home/vlita/anaconda3/envs/psitest/lib/python3.10/site-packages/qcelemental/util/init.py”, line 1, in
    from .autodocs import auto_gen_docs_on_demand, get_base_docs
    File “/home/vlita/anaconda3/envs/psitest/lib/python3.10/site-packages/qcelemental/util/autodocs.py”, line 6, in
    from pydantic import BaseModel, BaseSettings
    File “/home/vlita/anaconda3/envs/psitest/lib/python3.10/site-packages/pydantic/init.py”, line 363, in getattr
    return _getattr_migration(attr_name)
    File “/home/vlita/anaconda3/envs/psitest/lib/python3.10/site-packages/pydantic/_migration.py”, line 296, in wrapper
    raise PydanticImportError(
    pydantic.errors.PydanticImportError: BaseSettings has been moved to the pydantic-settings package. See Migration Guide - Pydantic for more details.

For further information visit Redirecting...

Some Information on my system:

  • Ubuntu 18.04.6 LTS
  • Python 3.8.19 in conda env

What I have tried:

  • Installing psi4 in a conda environment with Python 3.10
  • Using bump-pydantic to update pydantic package from V1 to V2 in psi4 source code
  • manually editing files that are throwing error messages

Any help would be much appreciated!

Please use conda install psi4 -c conda-forge as outlined at Install v1.9.1+ | Installs with “conda” selection. (The psi4 channel is still maintained but mostly for the psi4 and libint packages itself, and all deps need to be from c-f.)

Fwiw, psi4 can be used with pydantic v1 or v2 packages; it uses the v1 API importable from v2 package in the latter case.

I wasn’t able to get

conda install --name psi4env_1-9-1 psi4 python=3.10 -c conda-forge

to work for me.

When I run it, I get →

Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - psi4

Current channels:

  - https://conda.anaconda.org/conda-forge/linux-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://repo.anaconda.com/pkgs/main/linux-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/linux-64
  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

Any help would be appreciated!

Just a Psi4 amateur here, but it looks like you’re using the old Conda solver… Did you install Conda with apt (it’s really out of date)?

Our research group has seen similar issues with older versions of Conda, so perhaps ensuring that you’re on the latest version or that you’re using libmamba would help.

I am using:

conda version : 4.12.0 → 2022
conda-build version : 3.17.8 → 2019

So, yes a bit old.

Let me try libmamba first and go from there.

Yes, I have similar issues on some research computing systems. It’s been difficult to get Psi4 running, and there’s nothing I can do about the versions on these systems. Installing libmamba isn’t always an option (ex, if you can’t install global conda packages).

  • The above should be conda create not conda install since it’s a lot easier to solve the environment afresh rather fit into the constraints of an existing environment.

  • When I use conda create with your command, at the moment, it’s solvable. My conditions are below for reference.

> conda info
          conda version : 23.7.4
       virtual packages : __archspec=1=x86_64
                          __glibc=2.17=0
                          __linux=3.10.0=0
                          __unix=0=0
               platform : linux-64
             user-agent : ... solver/libmamba conda-libmamba-solver/23.9.1 libmambapy/1.5.3 ...
  • But I’ve been using the mamba solver exclusively for nearly a year, so I bet @kb1rd’s is a good lead to switch from the classic solver to the mamba solver. Since it can be confusing, I’ll mention that (1) since Fall 2023, the default solver for conda is libmamba and (2) for a while before that, one could install an extra package into the base environment and then use libmamba as the solver backend for conda.

  • @kb1rd is also right that all the preceding is for naught if you can’t edit your base environment. We have the same problem at our university cluster. In this case, you might consider using the installer (linux/installer/3.10/1.9.1 at Install v1.9.1+ | Installs). It’s a bigger download, but it will give a full installation. Because the conda it provides is recent, you’ll also get the mamba solver backend.

@loriab

I actually created the env first and tried to install. But to make sure, I did go ahead and run:
conda create --name psi4env_1-9-1 psi4 python=3.10 -c conda-forge

Same error: 
PackagesNotFoundError: The following packages are not available from current channels:

  - psi4

My conda install specs:

conda version : 4.12.0
conda-build version : 3.17.8
virtual packages : __cuda=12.4=0
                          __linux=3.10.0=0
                          __glibc=2.17=0
                          __unix=0=0
                          __archspec=1=x86_64
platform : linux-64
user-agent : conda/4.12.0 requests/2.22.0 CPython/3.7.11 Linux/3.10.0-1160.114.2.el7.x86_64 centos/7.9.2009 glibc/2.17

I did successfully install libmamba but, as you can see, it does not show up in ‘user-agent’ and I get:
conda: error: unrecognized arguments: --solver=libmamba

when trying to use it as the solver. So, at thsi point I am thinking I need to update conda:

conda update -n base conda

Yes?

However, it does not seem like an update version of psi4 is going to directly solve my current issue.

thanks for the help!

Yes, sounds like it. Here’s some update directions Anaconda | A Faster Solver for Conda: Libmamba