Error to install psycopg2 install in aws(ubuntu) , how to solve? - postgresql

Collecting psycopg2 Using cached psycopg2-2.8.5.tar.gz (380 kB)
ERROR: Command errored out with exit status 1: command: /home/ubuntu/egrdb/env/bin/python -c 'import sys, setuptools, tokenize; sys.argv0 = '"'"'/tmp/pip-install-gn70jweq/psycopg2/setup.py'"'"'; file='"'"'/tmp/pip-install-gn70jweq/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-4tr67ll8 cwd: /tmp/pip-install-gn70jweq/psycopg2/ Complete output (7 lines): running egg_info creating /tmp/pip-pip-egg-info-4tr67ll8/psycopg2.egg-info writing /tmp/pip-pip-egg-info-4tr67ll8/psycopg2.egg-info/PKG-INFO writing dependency_links to /tmp/pip-pip-egg-info-4tr67ll8/psycopg2.egg-info/dependency_links.txt writing top-level names to /tmp/pip-pip-egg-info-4tr67ll8/psycopg2.egg-info/top_level.txt writing manifest file '/tmp/pip-pip-egg-info-4tr67ll8/psycopg2.egg-info/SOURCES.txt' Error: b'You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.\n'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

If you want to install the source version psycopg2-2.8.5.tar.gz then you will need to do as #Chris says. The simpler way though is to do:
pip install psycopg2-binary
Then you get a pre-compiled version and you don't need the -dev packages.

Related

No module named 'densepose'

installing the following using pip in collab notebook :
pip install torch==1.10.1+cu102 \
torchvision==0.11.2+cu102 \
torchaudio==0.10.1 \
-f https://download.pytorch.org/whl/torch_stable.html \
detectron2==0.6 \
-f https://dl.fbaipublicfiles.com/detectron2/wheels/cu102/torch1.10/index.html \
git+https://github.com/facebookresearch/detectron2#main#subdirectory=projects/DensePose
after, restarting runtime I run:
!python ./apply_net.py dump densepose_rcnn_R_101_FPN_DL_s1x.yaml
https://dl.fbaipublicfiles.com/densepose/densepose_rcnn_R_101_FPN_DL_s1x/165712116/model_final_844d15.pkl
./Tejrab/200404.png --output ./dump/200404.pkl -v
Expected behavior:
pkl file of the png image
Error
Traceback (most recent call last):
File "./apply_net.py", line 19, in
from densepose import add_densepose_config
ModuleNotFoundError: No module named 'densepose'
after installing densepose this error occured
2. ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-g43tc9ql/detectron2_0a570229969d47198f45a267ccc78493/setup.py'"'"'; file='"'"'/tmp/pip-install-g43tc9ql/detectron2_0a570229969d47198f45a267ccc78493/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-px39tp0q/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7/detectron2 Check the logs for full command output.
PS
a new commit to apply_net.py has been added by authors c54429b could it be the reason ?
!pip install pyyaml==5.1
!pip install ninja
!pip install av

pip install apache-beam fails with Building wheels for collected packages

Problem
$ pip3 install apache-beam
...
Building wheels for collected packages: future, avro-python3, docopt
Building wheel for future (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4aondmrw/future/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4aondmrw/future/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-5uobb0_9
cwd: /tmp/pip-install-4aondmrw/future/
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'bdist_wheel'
----------------------------------------
ERROR: Failed building wheel for future
Solution
hy is python setup.py saying invalid command 'bdist_wheel' on Travis CI?
pip3 install wheel
Fixed the issue.
$ pip3 install apache-beam
...
Successfully built avro-python3
Installing collected packages: avro-python3, pyasn1, rsa, pyasn1-modules, oauth2client, apache-beam
Successfully installed apache-beam-2.32.0 avro-python3-1.9.2.1 oauth2client-4.1.3 pyasn1-0.4.8 pyasn1-modules-0.2.8 rsa-4.7.2

Cannot use %install in Swift Colab

I try to install a new library in Swift on Google Colab
%install '.package(url: "https://github.com/IBM-Swift/BlueCryptor.git", from: "1.0.28")' Cryptor
Then, there is an error
...
error: toolchain is invalid: could not find the `swiftc` at expected path /swift/toolchain/usr/bin/swiftc
Install Error: swift-build returned nonzero exit code 1.
But I check that swiftc does exist in /swift/toolchain/usr/bin.
Here's a Colab notebook
that demonstrate the error.
Please help.
Now I update it to the latest Swift version. By running this notebook:
https://colab.research.google.com/github/tensorflow/swift/blob/master/notebooks/install_latest_swift.ipynb
There's no error anymore. So, just need to update it.
You can also do it all from the Swift notebook as well, using this code.
import Python
Python.import("subprocess").getoutput("""
rm -rf /swift
mkdir -p /swift/toolchain
wget -nv -O- https://storage.googleapis.com/s4tf-kokoro-artifact-testing/latest/swift-tensorflow-DEVELOPMENT-cuda10.0-cudnn7-ubuntu18.04.tar.gz | tar xzf - -C /swift/toolchain
wget -nv -O- https://storage.googleapis.com/s4tf-kokoro-artifact-testing/latest/swift-jupyter.tar.gz | tar xzf - -C /swift
python3 /swift/swift-jupyter/register.py --swift-toolchain /swift/toolchain
apt-get install libblocksruntime-dev
""")

rpmbuild on CentOS: no such file or directory

I have created a simple RPM on Fedora27 and it worked fine. It just copied files from tar.gz to /usr/bin/.
When I tried to install this RPM on CentOS I got:
# rpm -i RPMS/x86_64/my_rpm-0.0-5.x86_64.rpm --force
error: Failed dependencies:
libc.so.6(GLIBC_2.26)(64bit) is needed by my_rpm-0.0-5.x86_64
So I assumed I will need to create the RPM on CentOS.
But when I do so I get a weird: 'No such file or directory' that I don't get on Fedora27. Here is a sketch of my spec file:
%define _topdir %(pwd)
%define name my_rpm
%define release 5
%define version 0.0
%define buildroot %{_topdir}/%{name}-%{release}-root
BuildRoot: %{buildroot}
Summary: my_rpm
License: -
Name: %{name}
Release: %{release}
Version: %{version}
Source: %{name}-%{version}-%{release}.tar.gz
Prefix: /usr
Group: Tools
%description
This is my_rpm spec file
%prep
%setup -q -n %(arch)/%{name}-%{version}
%install
install -D my_app -t %{buildroot}/usr/bin/my_rpm/
%files
/usr/bin/my_rpm/*
When I try to build the RPM for it I get:
# rpmbuild -v -bb --clean SPECS/bpf.spec
+ install -D app -t /root/rpmbuild/BUILDROOT/my_rpm-0.0-5.x86_64/usr/bin/my_rpm/
install: failed to access '/root/rpmbuild/BUILDROOT/my_rpm-0.0-5.x86_64/usr/bin/my_rpm/': No such file or directory
The same SPEC exactly runs smoothly on Fedora27.
What should I change in it my spec file so that it would work both on Fedora27 and CentOS7? or maybe I can fix my initial problem with Glibc?
EDIT 1
I added the "mkdir -p ..." command under install and the build was successful but it still gives me the same error, that I need Glibc 2.6.
What I don't understand is why during the build it says:
Requires: libc.so.6()(64bit) libc.so.6(GLIBC_2.14)(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.26)(64bit) libc.so.6(GLIBC_2.3)(64bit) libc.so.6(GLIBC_2.3.4)(64bit) libc.so.6(GLIBC_2.7)(64bit) libc.so.6(GLIBC_2.9)(64bit) libelf.so.1()(64bit) libelf.so.1(ELFUTILS_1.0)(64bit) rtld(GNU_HASH)
Edit 2(solution)
I got it to work. My executables are compiled C code. So I had to re-compile everything on CentOS and then build the rpm. Now it works on both Fedora and CentOS.

AWS ElasticBeanstalk amazon linux pg_config error with psycopg2

I am testing AWS for launching web service.
I stuck with pg_config. Error log is
/app/requirements.txt (line 1))
Using cached psycopg2-2.6.2.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/psycopg2.egg-info
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
Error: pg_config executable not found.
Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
There are many solutions in stackoverflow, but it doesn't work for me.
packages:
yum:
python-devel: []
postgresql95-devel: []
libjpeg-devel: '6b'
container_commands:
01_migrate:
command: "python manage.py migrate"
02_collectstatic:
command: "python manage.py collectstatic --noinput"
03_createsu:
command: "python manage.py createsu"
leader_only: true
option_settings:
"aws:elasticbeanstalk:application:environment":
DJANGO_SETTINGS_MODULE: "onreview.settings"
PYTHONPATH: "$PYTHONPATH"
"aws:elasticbeanstalk:container:python":
WSGIPath: "onreview/wsgi.py"
This is my .ebextensions/python.config files contents. And I'm uploading through zipping my source code.
I changed postgresql95-devel to postgresql-devel, 93, 94, all of it. And I use 9.5 version db right now.
I think --pg-config's path is problem. but I can't change it.
Is there any solution??
p.s I do not want to setup inside the EC2 instance through SSH or something.
You have a syntax error in your original post, packages: should not be indented. I don't know why you have python-devel when python is included in the install, so I can't say that it isn't interfering. Likewise with the line setting the python path.
packages:
yum:
python-devel: []
postgresql95-devel: []
libjpeg-devel: '6b'
container_commands:
01_migrate:
command: "python manage.py migrate"
02_collectstatic:
command: "python manage.py collectstatic --noinput"
03_createsu:
command: "python manage.py createsu"
leader_only: true
option_settings:
aws:elasticbeanstalk:application:environment:
DJANGO_SETTINGS_MODULE: "onreview.settings"
PYTHONPATH: "$PYTHONPATH"
aws:elasticbeanstalk:container:python:
WSGIPath: "onreview/wsgi.py"