I tried to install psi4 to do a quantum chemistry calculation in the jupyter/minimal-notebook container.
However, as shown in the code block below, I could not install it due to UnsatisfiableError.
(base) jovyan#17285cef33b0:~/work$ conda create -n psi4 python=3.6
Collecting package metadata (current_repodata.json): done
Solving environment: done
....
(ellipsis)
(base) jovyan#17285cef33b0:~/work$ conda activate psi4
(psi4) jovyan#17285cef33b0:~/work$ conda install psi4 -c psi4
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: \
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed
UnsatisfiableError: The following specifications were found to be incompatible with each other:
Output in format: Requested package -> Available versions
(psi4) jovyan#17285cef33b0:~/work$
It did not show what was not satisfied.
I don't want to use anaconda because I need to pay for commercial use of anaconda, and I want to use conda-forge as the environment to run psi4. I also want to use docker because I want to have the same conditions to run the program.
Do you have any good ideas to solve this error?
Or is there any environment that can fulfill my wishes?
My environment is Windows 10 and I am using Docker Desktop WSL 2 backend.
The previous answer was deleted because I just pasted the my blog post link. I extract the main steps of how to build from the my blog post and describe it.
I built and installed Psi4 on a docker container by myself. I wrote a post on my blog about how to do that. Please see the following blog post for more details.
https://solkul.hatenablog.com/entry/2021/04/23/002237
Here are the main steps on how to build it.
Basically, you can build it according to this Psi4 documentation.
1. Clone Psi4 repository
Clone the Psi4 repository.
(base) root$ git clone https://github.com/psi4/psi4.git
(base) root$ cd psi4
2. Create new conda environment
Start bash as root. Psi4 only supports until python 3.7, so I should create a conda environment for python 3.7.
(base) root$ conda create -n quantum python=3.7
(base) root$ conda activate quantum
(quantum) root$
3. Install the packages needed to build
Type the following command to install the packages required for the build. Psi4 documentation lists tools and dependencies required for the build.
(quantum) root$ apt-get update
(quantum) root$ apt-get install -y build-essential cmake clang libssl-dev
(quantum) root$ apt-get install -y libopenblas-base libopenblas-dev
(quantum) root$ conda install -y numpy networkx pint pydantic
(quantum) root$ apt-get install -y libmpfr-dev libeigen3-dev
4. Buid and install
It's time to build! Type the following command to Configure and Generate to build.
(quantum) root /psi4$ mkdir build
(quantum) root /psi4$ cd build
(quantum) root /psi4/build$ cmake ..
Let's build!
(quantum) root /psi4/build$ make -j`getconf _NPROCESSORS_ONLN`
This build takes several hours.
After build is complete, type the following command to install it.
(quantum) root /psi4/build$ make install
5. Append lib of install directry to the python import path
In the default configuration, the binaries, includes, libraries, etc. should be installed in /usr/local/psi4. In order to use Psi4 as python module, it is needed to append /usr/local/psi4/lib to the python import path. You should also use Psi4 in the quantum environment, which I just created as the python 3.7 environment. You can do this by appending the directry to sys.path each time as follows.
import sys
sys.path.append("usr/local/psi4/lib")
From now, you can import Psi4.
import psi4
Related
I'm trying to use make build which has a docker build but every time it reaches a layer in which it tries to install "conda install -c conda-forge r-base" it keeps failing:
Step 12/25 : RUN conda install -c conda-forge r-base
---> Running in 828e7f234ed3
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve.
And then it starts examining conflicts until it reaches this error:
The command '/bin/sh -c conda install -c conda-forge r-base' returned a non-zero code: 1
make: *** [Makefile:2: build] Error 1
Does somebody have any idea what I could do to fix this? So that it continues building with no errors? I didn't code the Dockerfile so I'm a little lost on what to do.
Dockerfile
FROM continuumio/anaconda3
ENV INSTALL_PATH /environment_name
RUN mkdir -p $INSTALL_PATH
WORKDIR $INSTALL_PATH
#COPY environment.yml environment.yml
#RUN conda env create -f environment.yml
RUN conda create -n environment_name
RUN /opt/conda/bin/activate environment_name
#RUN conda config --add channels conda-forge
#RUN conda config --set channel_priority strict
#RUN conda install r-cairodevice
RUN conda install -n environment_name bokeh h5py numpy scipy pandas scikit-learn sphinx spyder jupyter statsmodels
RUN conda install -n environment_name -c bioconda pymzml
RUN conda install -n environment_name -c bioconda netcdf4
RUN conda install -c conda-forge fonts-conda-forge
RUN conda install -c conda-forge r-base
RUN conda install -c bioconda bioconductor-ropls
RUN pip install flask werkzeug gunicorn
RUN conda install seaborn
RUN echo "source activate environment_name" > ~/.bashrc
ENV PATH /opt/conda/envs/environment_name/bin:$PATH
COPY . .
RUN chmod +x run_server.sh
RUN chmod +x start.sh
ADD start.sh /
CMD /start.sh
RUN conda install -c conda-forge libjpeg-turbo
RUN git clone https://bitbucket.org/iAnalytica/mshub_process.git
RUN conda install -n environment_name -c bioconda pyteomics
#CMD gunicorn -b 0.0.0.0:8000 --access-logfile - "api.app:app"
Makefile
build:
docker build -t environment_name .
This means that the dependencies you're listing within your conda file are causing some sort of error during the build. It could be many things, but if you were able to build that conda environment in your local environment outside of docker, then a possible culprit would be that the difference in operating system is creating a sufficient change in the dependencies that's causing the conda build to fail. Without knowing more about the error itself or the traceback, I would try commenting out half of the dependencies in your conda file and rerunning. If it succeeds, then try with the other half commented out. If it fails, uncomment half of the previously commented dependencies and continue this binary-like search until you find the offending dependency(ies).
For what it's worth, using docker removes much of the benefit of using an environment manager like conda. While I don't have visibility into the rest of your application, it might be worth considering what you're really getting out of conda in a containerized environment and determining if other means of setting up your environment better suit your needs. I say this especially because the build times for conda can be quite slow and add to the bloat of the container.
I am trying to install Cartopy on Ubuntu and need to install proj v8.0.0 binaries for Cartopy. However when I try to apt-get install proj-bin I can only get proj v6.3.1. How do I install the latest (or at least v8.0.0) proj for cartopy?
I'm answering my own question here partly to help others with this problem, and partly as an archive for myself so I know how to fix this issue if I come across it again. I spent quite a while trying to figure it out, and wrote detailed instructions, so see below:
Installing cartopy is a huge pain, and I've found using conda to be a very bad idea (it has bricked itself and python along with it multiple times for me)
THIS INSTALLATION IS FOR LINUX.
Step 0. Update apt:
apt update
Step 1. Install GEOS:
Run the following command to install GEOS:
apt-get install libgeos-dev
In case that doesn't do it, install all files with this:
apt-get install libgeos-dev libgeos++-dev libgeos-3.8.0 libgeos-c1v5 libgeos-doc
Step 2. Install proj dependencies:
Install cmake:
apt install cmake
Install sqlite3:
apt install sqlite3
Install curl devlopment package:
apt install curl && apt-get install libcurl4-openssl-dev
Step 3. Install Proj
Trying apt-get just in case it works:
Unfortunately, cartopy requires proj v8.0.0 as a minimum, but if you install proj using apt you can only install proj v6.3.1
Just for reference in case anything changes, this is the command to install proj from apt:
apt-get install proj-bin
I'm fairly sure this is all you need, but in case it's not, this command will install the remaining proj files:
apt-get install proj-bin libproj-dev proj-data
To remove the above installation, run:
apt-get remove proj-bin
or:
apt-get remove proj-bin libproj-dev proj-data
Building Proj from source
So if the above commands don't work (it's not working as of 2022/4/8), then follow the below instructions to install proj from source:
Go to your install folder and download proj-9.0.0 (or any version with proj-x.x.x.tar.gz):
wget https://download.osgeo.org/proj/proj-9.0.0.tar.gz
Extract the tar.gz file:
tar -xf proj-9.0.0.tar.gz
cd into the folder:
cd proj-9.0.0
Make a build folder and cd into it:
mkdir build && cd build
Run (this may take a while):
cmake ..
cmake --build .
cmake --build . --target install
Run to make sure everything installed correctly:
ctest
The test command failed on one test for me (19 - nkg), but otherwise was fine.
You should find the required files in the ./bin directory
Finally:
Move binaries to the /bin directory:
cp ./bin/* /bin
As per Justino, you may also need to move the libraries:
cp ./lib/* /lib
Now after all this, you can finally install cartopy with pip:
pip install cartopy
After doing this, my cartopy still wasn't working. I went home to work on this next week, came back, and all of a sudden it was working so maybe try restarting
The libraries should be copied manually
sudo cp ./lib/* /lib
This works for me
I am trying to create a conda package which should be compatible with all python versions greater than or equal to 3.7.
I specified this requirement in my conda.recipe/meta.yaml:
requirements:
host:
- python >=3.7
- pip
run:
- python >=3.7
- importlib-resources >=1.4.0
- ...
For my build command, I first activated a Python 3.7 conda environment, then I specified the build command should use the same environment, and I also specified that the build command should use Python 3.7 just to be safe:
$ CONDA_ENV=/path/to/py3.7/conda/env
$ conda create --yes -p $CONDA_ENV python=3.7 conda-build conda-verify importlib-resources>=1.4.0 # ...remaining reqs
$ conda activate $CONDA_ENV
$ conda build --python=3.7 -p $CONDA_ENV /path/to/package/dir
The build step in conda.recipy/meta.yaml too uses this same environment:
build:
script: bash -c 'source ~/.bashrc && conda activate /path/to/py3.7/conda/env && python -m pip install --no-deps --ignore-installed -vv /path/to/package/dir'
The problem
Running the above commands creates this file:
my-package-1.1.0-py310_0.tar.bz2
I don't get why py310 is in the package name, I did everything I can think of to make it compatible with 3.7 as well.
Here is what happens when I try to create an environment with both python 3.7 and my created package (after uploading the tar.bz2 file to my conda repo):
$ conda create -p ~/temp/conda python=3.7 my-package
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: \
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed
UnsatisfiableError: The following specifications were found to be incompatible with each other:
Output in format: Requested package -> Available versions
Package python conflicts for:
python=3.7
my-package -> python[version='>=3.10,<3.11.0a0']
my-package -> importlib-resources[version='>=1.4.0'] -> python[version='2.7.*|3.5.*|3.6.*|>=2.7,<2.8.0a0|>=3.8,<3.9.0a0|>=3|>=3.6|>=3.7|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0|3.4.*|>=3.9,<3.10.0a0|3.10.*']
The following specifications were found to be incompatible with your system:
- feature:/linux-64::__glibc==2.27=0
- feature:|#/linux-64::__glibc==2.27=0
Your installed version is: 2.27
But if I don't specify 3.7 when creating the environment it works fine, but creates an environment with 3.10.
$ conda create -p ~/temp/conda python my-package
Question
How can I make my-package compatible with Python 3.7?
After much unproductive research an unending amounts of trial and error, I found that I should have made my package not specific to any python version by adding noarch: python to my meta.yaml:
build:
noarch: python
script: bash -c 'source ~/.bashrc && conda activate /path/to/py3.7/conda/env && python -m pip install --no-deps --ignore-installed -vv /path/to/package/dir'
I have Anaconda3 installed on my Windows 10 computer. I want to install the pysystemtrade package from GitHub. This is the instructions from the author
"This package isn't hosted on pip. So to get the code the easiest way is to use git:
git clone https://github.com/robcarver17/pysystemtrade.git
python3 setup.py develop"
The question is, where do I clone the project to and where do I run setup.py to get it installed in the correct place in Anaconda3 so I can include the files in my python project?
Thanks,
Dana
Create a conda environment with the python version, switch to that environment to keep track of dependencies for that environment. Then clone the Git repo. Afterwards, install the requirements.txt for that Github project, and run the command he gave you to add that dependency to your conda environment.
conda create -n trade-test python=3.8
conda activate trade-test
git clone https://github.com/robcarver17/pysystemtrade.git
cd pysystemtrade/
pip3 install -r requirements.txt
python3 setup.py develop
I followed the directions to install etetoolkit for mac.
# Install Minconda (you can ignore this step if you already have Anaconda/Miniconda)
curl -L 'http://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh' -o Miniconda3-latest-MacOSX-x86_64.sh
bash Miniconda3-latest-MacOSX-x86_64.sh -b -p ~/anaconda_ete/
export PATH=~/anaconda_ete/bin:$PATH;
# Install ETE and external tools
conda install -c etetoolkit ete3 ete_toolchain
# Check installation
ete3 build check
I get an error when I run conda install -c etetoolkit ete3 ete_toolchain
Error:
UnsatisfiableError: The following specifications were found to be
incompatible with the existing python installation in your
environment:
ete3 -> python[version='>=2.7,<2.8.0a0,>=3.5,<3.6.0a0,>=3.6,<3.7.0a0']
ete_toolchain -> python[version='>=2.7,<2.8.0a0,>=3.5,<3.6.0a0,>=3.6,<3.7.0a0'
I ran the [package installer][2] for anaconda 3.7. (I don't think I actually had to do this.)
From terminal run: conda install python=2.7
Then conda install -c etetoolkit ete3 ete_toolchain
Then I verified this worked by running ete3 build check. In the results clustalo: MISSING displayed, but that's a new problem to solve.
UPDATE
The final problem was solved by running conda install -c etetoolkit ete3_external_apps
There is a type-o in the instructions given by ete3. Use this instead.